Use reproducible method of generating properties file for better caching (#42539)
(cherry picked from commit 9772574f9d0b942a1ee8dba5ff503b4cd286e36c)
This commit is contained in:
parent
74d771d8f6
commit
5695992094
|
@ -45,21 +45,17 @@ if (project == rootProject) {
|
||||||
// we update the version property to reflect if we are building a snapshot or a release build
|
// we update the version property to reflect if we are building a snapshot or a release build
|
||||||
// we write this back out below to load it in the Build.java which will be shown in rest main action
|
// we write this back out below to load it in the Build.java which will be shown in rest main action
|
||||||
// to indicate this being a snapshot build or a release build.
|
// to indicate this being a snapshot build or a release build.
|
||||||
File propsFile = project.file('version.properties')
|
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project.file('version.properties'))
|
||||||
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(propsFile)
|
|
||||||
version = props.getProperty("elasticsearch")
|
version = props.getProperty("elasticsearch")
|
||||||
|
|
||||||
|
task generateVersionProperties(type: WriteProperties) {
|
||||||
|
outputFile = "${buildDir}/version.properties"
|
||||||
|
comment = 'Generated version properties'
|
||||||
|
properties(props)
|
||||||
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.file(propsFile)
|
from(generateVersionProperties)
|
||||||
// We need to be explicit with the version because we add snapshot and qualifier to it based on properties
|
|
||||||
inputs.property("dynamic_elasticsearch_version", props.getProperty("elasticsearch"))
|
|
||||||
doLast {
|
|
||||||
Writer writer = file("$destinationDir/version.properties").newWriter()
|
|
||||||
try {
|
|
||||||
props.store(writer, "Generated version properties")
|
|
||||||
} finally {
|
|
||||||
writer.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue