Version Data is Produced Late
Description
Version information is calculated too late in the Gradle build cycle.
Reproduction
The Bintray gradle plugin is an example of a use case which is effected by this issue:
bintray {
...
pkg {
...
version {
...
vcsTag = project.version
}
}
}
This configuration will fail, because project.version
is not assigned until after version {}
block is evaluated.
Proposed Fix
Make VersioningExtension
, VersionConfiguration
& ProcessorConfiguration
properties observable, and update Project.version
whenever a property is changed. This approach has the downside of increasing the complexity of the code.
Failed Fixes
Calculate version string when a version configuration is added
The project is not fully evaluated at the time of DomainObjectCollection.whenObjectAdded
, meaning that version configuration properties are not available in time and therefore precluding the possibility of calculating the version string at this time.
Calculate version string before project evaluation
Unable to diagnose the failure of this approach further, as the debugger refuses to step through anything other than the first level of Plugin.apply
for some reason.
Output
:versioning FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':versioning'.
> Empty collection can't be reduced.