Steve Ebersole
05/30/2024, 3:00 PM@OutputDirectory. This task performs XJC generation of JAXB binding classes (the java files) into said directory. Between branches we changed the package in which these classes are generated. What we've noticed is that when switching branches the output from the "other" branch is not removed and we end up with compile errors. Annoying but understandable.
However, what I don't understand is that even clean does not help the situation. The only thing that works is clean + --no-build-cache. Any thoughts on why that is?
Would switching to @OutputFiles help with that in any way? The difference (to me anyway) is not immediately obvious from their JavadocsSteve Ebersole
05/30/2024, 3:02 PMThe only thing that works isTo clarify, this won't work (get compile errors from the old sources):+clean--no-build-cache
gradlew clean compile
Instead, I have to use:
gradlew clean compile --no-build-cacheSteve Ebersole
05/30/2024, 3:14 PMAnze Sodja
05/30/2024, 3:20 PMSteve Ebersole
05/30/2024, 3:20 PMSteve Ebersole
05/30/2024, 3:21 PMSteve Ebersole
05/30/2024, 3:22 PMSteve Ebersole
05/30/2024, 3:22 PMAnze Sodja
05/30/2024, 3:23 PM--rerun (reruns just one task) or with --rerun-tasks (reruns all in the chain). So just
gradlew compile --rerun (or probably --rerun-tasks if problematic task is not compile task)Anze Sodja
05/30/2024, 3:24 PMSteve Ebersole
05/30/2024, 3:25 PM@InputFile
@PathSensitive( PathSensitivity.RELATIVE )
RegularFileProperty getXjcBindingFile() {
return xjcBindingFile
}
and
@OutputDirectory
@PathSensitive( PathSensitivity.RELATIVE )
DirectoryProperty getOutputDirectory() {
return outputDirectory
}Steve Ebersole
05/30/2024, 3:26 PMSteve Ebersole
05/30/2024, 3:26 PMAnze Sodja
05/30/2024, 3:28 PMSteve Ebersole
05/30/2024, 3:33 PM@InputFile should see that the content of said file has changed?Steve Ebersole
05/30/2024, 3:34 PM<schemaBindings>
<package name="org.hibernate.boot.jaxb.mapping.spi" />
</schemaBindings>Steve Ebersole
05/30/2024, 3:35 PM<package name="..."/> entry, @InputFile is supposed to be sensitive to that right?Steve Ebersole
05/30/2024, 3:37 PM• This will cause the task to be considered out-of-date when the file path or contents have changed.
Anze Sodja
05/30/2024, 3:39 PM@InputFile it will snapshot the file and if content changes the task will be out-of-dateAnze Sodja
05/30/2024, 3:43 PMSteve Ebersole
05/30/2024, 3:44 PMSteve Ebersole
05/30/2024, 3:45 PMSteve Ebersole
05/30/2024, 3:46 PMSteve Ebersole
05/30/2024, 3:49 PMWell, actually maybe I can still make this incrementalIgnore that. Incremental (TaskInputs) rely on the inputs
Steve Ebersole
05/30/2024, 3:49 PMAnze Sodja
05/30/2024, 3:49 PMis to add a property to always delete the contents of that directory as the first step in the task actionIf your task is not incremental, then you always want to compile all sources again, so that makes sense
Steve Ebersole
05/30/2024, 3:50 PMSteve Ebersole
05/30/2024, 3:51 PMAnze Sodja
05/30/2024, 3:55 PMSteve Ebersole
05/30/2024, 3:56 PMSteve Ebersole
05/30/2024, 3:57 PMSteve Ebersole
05/30/2024, 3:58 PMSteve Ebersole
05/30/2024, 3:59 PM=> XJC => bit is literally a call to an Ant taskAnze Sodja
05/30/2024, 4:00 PMSteve Ebersole
05/30/2024, 4:01 PMSteve Ebersole
05/30/2024, 4:02 PMSteve Ebersole
05/30/2024, 4:14 PMSteve Ebersole
05/30/2024, 4:14 PMAdam
05/30/2024, 7:28 PMFileSystemOperations#sync to transfer the generated files from the temp dir into the actual output directory. Using sync is best, because it means you won't end up with outdated files.Adam
05/30/2024, 7:32 PM