Closed sschuberth closed 5 years ago
Gradle makes this easy enough that I'd rather not put it in the plugin. Something like this should work.
task writeVersion(type: WriteProperties) {
outputFile = project.layout.buildDirectory().file('version.properties')
property 'version', { project.version }
}
processResources.from writeVersion
Agreed. This initially came to my mind as (due to a lack of examples) I wasn't aware that reckon actually does set the Gradle-native project.version
property. I was searching for a reckon-specific property that I could write to a file and did not find one. Later, I found that I could call reckon.reckonVersion(), but of course using a property that is only evaluated once is much better.
Long story short, now that I'm aware that the project.version
property can be used, I totally agree it's better to leave to the user what to do with that version property, and whether to write it to a file or not.
How about some setting that would make reckon create a simple text file or properties file as a resource so applications could also easily use the reckoned version at runtime by reading that resource?