Skip to content

BundleTaskExtension$BuildAction adds undeclared inputs to jar tasks #5279

@clayburn

Description

@clayburn

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:

  1. Checkout caffeine @ 340e9840.
  2. ./gradlew clean :caffeine:jar
  3. unzip -p caffeine/build/libs/caffeine-3.1.2-SNAPSHOT.jar META-INF/MANIFEST.MF | grep Bundle-Version
  4. Verify the Bundle-Version is 3.1.2.SNAPSHOT
  5. ./gradlew :caffeine:jar -Prelease
  6. unzip -p caffeine/build/libs/caffeine-3.1.2.jar META-INF/MANIFEST.MF | grep Bundle-Version
  7. Verify the Bundle-Version is still 3.1.2.SNAPSHOT, when the desired outcome is 3.1.2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions