Markus Maier
06/16/2025, 10:13 AMclasses
to run does not cause it to remove the stale class in either case.Martin
06/16/2025, 10:19 AMclasses
tasks? If incremental, it should delete the stale files. If not, it should delete the destination content before writing the new oneMarkus Maier
06/16/2025, 10:23 AMclasses
does this (which might point to some error in my build), or is that more of a wish that it should do that?Martin
06/16/2025, 10:23 AMMartin
06/16/2025, 10:24 AMMartin
06/16/2025, 10:24 AMclasses
has some extra logic. Is that from a Java project?Martin
06/16/2025, 10:24 AMcompileJava
?Markus Maier
06/16/2025, 10:26 AMMartin
06/16/2025, 10:30 AMname: :classes
type: class org.gradle.api.DefaultTask
inputProperties:
-
inputsFiles:
-
sourcefiles:
-
outputs:
-
dependencies:
- :compileJava
- :processResources
So classes
looks like it's a lifecycle taskMartin
06/16/2025, 10:31 AMcompileJava
and the matching .class
file is correctly removed from build/classes/java
so there is probably something with the seuptMarkus Maier
06/16/2025, 11:06 AMMarkus Maier
06/16/2025, 12:31 PMgradlew init
project. I'll report back what it was when I find it.Thomas Broyer
06/16/2025, 12:35 PMMarkus Maier
06/16/2025, 12:37 PMMartin
06/16/2025, 12:38 PMtwo tasks configured with the same output directoryAre there valid use cases for this? Sounds like Gradle should give an error for this?
Markus Maier
06/16/2025, 12:56 PM-i
, I don't see any message about overlapping outputs, only that removing a different class file indeed caused a full rebuild:
Task ':foo:compileJava' is not up-to-date because:
Output property 'destinationDirectory' file foo\build\classes\java\main\foo\Bar.class has been removed.
The input changes require a full rebuild for incremental task ':foo:compileJava'.
That did not remove the offending class file, though.Martin
06/16/2025, 12:57 PMMartin
06/16/2025, 12:57 PMMarkus Maier
06/16/2025, 12:59 PMMarkus Maier
06/16/2025, 1:02 PMMarkus Maier
06/16/2025, 1:15 PMTask ':lib:compileJava' is not up-to-date because:
Input property 'stableSources' file Z:\Workspaces\test\lib\src\main\java\org\test\Foobar.java has been removed.
But in my "real" build, I only see that message for a changed file in my conventions build, not for the removed file. In that project, the compileJava
task claims to be up-to-date. Now I'm a bit scared.Vampire
06/17/2025, 1:21 AMthat removing a different class file indeed caused a full rebuild:
Yes an incremental task can only be incremental when incremental inputs change. As soon as another input or the output changed, a full rebuild is necessary.
That did not remove the offending class file, though.
But the full rebuild usually should also clean up the outputs. One thing that produces similar situations is if you have build cache enabled and there is a poisoned cache entry or inputs and outputs not declared properly for a task.
Markus Maier
06/17/2025, 12:11 PMsettings.gradle
, because they are an integral part of the build. For simplification, we recently re-integrated one of those into the main build again, without changing the directory structure. So what was previously a subproject in an included build is now a subproject in the main build. The offending file resided in exactly one of those subprojects.
First building the old branch with the included build and then a newer branch in the same workspace exhibits the problem. Gradle then considers previous-compilation-data.bin
invalid, which it would normally use to find out which .class files are needed, and it does not delete anything.Vampire
06/17/2025, 8:38 PMMarkus Maier
06/18/2025, 12:10 PM