Skip to content

Commit

Permalink
fix: Use Classpath normalization for auxClassPaths
Browse files Browse the repository at this point in the history
Declaring `auxClassPaths` as a `Classpath` property allows Gradle to perform additional normalization,
so that functionally-identical jar files do not trigger a re-execution of the SpotBugsTask.

A re-generated jar containing identical classes will have different entry timestamps for each class entry,
and as such is not bitwise identical even though it is functionally identical.
Without this fix, changing an input jar file will change the input cache key, leading to consistent misses from the local build cache.

See https://docs.gradle.org/6.0/userguide/more_about_tasks.html#sec:task_input_using_classpath_annotations
  • Loading branch information
bigdaz authored and KengoTODA committed Jul 30, 2020
1 parent ffb93f6 commit 76ed3a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/groovy/com/github/spotbugs/snom/SpotBugsTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.InputFiles;
Expand Down Expand Up @@ -235,7 +236,7 @@ class SpotBugsTask extends DefaultTask implements VerificationTask {
* Default value is the compile-scope dependencies of the target sourceSet.
*/
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
@Classpath
FileCollection auxClassPaths;

/**
Expand Down

0 comments on commit 76ed3a9

Please sign in to comment.