-
-
Notifications
You must be signed in to change notification settings - Fork 302
Description
Discovered in: ben-manes/caffeine#728. The BuildAction
class in the BundleTaskExtension
is affecting the output of the jar
task by changing the manifest based on certain properties but not declaring them as inputs.
This was noticed in ben-manes/caffeine#728 regarding the archiveVersion
of the jar
task. In this project, the jar
task was made cacheable. Before that, the task would be considered out of date in the below scenario, since the name of the output file had changed. But when the jar
task is made cacheable, the output file name is not considered as part of the cache key, so an invalid cache hit results in a jar without the newer version.
archiveVersion
is just one example in this action. It appears there are other properties in this action that are effectively inputs but are not declared.
To reproduce:
- Checkout caffeine @ 340e9840.
./gradlew clean :caffeine:jar
unzip -p caffeine/build/libs/caffeine-3.1.2-SNAPSHOT.jar META-INF/MANIFEST.MF | grep Bundle-Version
- Verify the
Bundle-Version
is3.1.2.SNAPSHOT
./gradlew :caffeine:jar -Prelease
unzip -p caffeine/build/libs/caffeine-3.1.2.jar META-INF/MANIFEST.MF | grep Bundle-Version
- Verify the
Bundle-Version
is still3.1.2.SNAPSHOT
, when the desired outcome is3.1.2