Skip to content

Manifest Last Modified #3118

@swimmesberger

Description

@swimmesberger

It seems that the last modified date of the generated jar of the bnd (gradle) jar task is not updated when only the MANIFEST.MF file is changed*. This is can lead to issues with gradle file caching. For our gradle plugin we rely on the gradle reporting if the generated jar is up to date or not and based on that reporting we do some additional work. When the bnd plugin is used this do not work because sometimes (when only the manifest is changed) gradle reports that the jar file is still up to date (even if it's clearly not because gradle uses last modified before the content is checked).

It know that I could define a manifest file via "-manifest" and then the last modified reporting would work but that is very unfortunate because I want to rely on the bnd manifest generation.
Maybe it's possible to compare the previous calculated manifest with the newly calculated manifest and only call the "updateModified" (with the current timestamp) when a change is detected.

As a workaround for now we added some additional properties to our custom gradle task which ensures that it's reexecuted but it would be much cleaner if we could simply rely on the generated jar.

Example of a flawed gradle build cycle with bnd:
Task :com.example.bundle:jar
Task ':com.example.bundle:jar' is not up-to-date because Value of input property 'someProp' has changed

Task :com.example.bundle:customTask UP-TO-DATE
Skipping task '::com.example.bundle:customTask' as it is up-to-date.

The customTask task defines an InputFile dependency on the generated jar file but even though the jar task of bnd is reexecuted and the file is newly written with an updated Manifest our customTask is not reexecuted because gradle does not detect the file change because the lastModified file property did not change.

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