Don't build bwc on assemble (#33372)
Gradle triggers the build of artifacts even if assemble is disabled. Most users will not need bwc distributions after running `./gradlew assemble` so instead of forcing them to add `-x buildBwcVersion`, we detect this and skip the configuration of the artifacts.
This commit is contained in:
parent
cfd3fa72ed
commit
9f96d2ce17
|
@ -51,6 +51,7 @@ subprojects {
|
||||||
apply plugin: 'distribution'
|
apply plugin: 'distribution'
|
||||||
// Not published so no need to assemble
|
// Not published so no need to assemble
|
||||||
assemble.enabled = false
|
assemble.enabled = false
|
||||||
|
assemble.dependsOn.remove('buildBwcVersion')
|
||||||
|
|
||||||
File checkoutDir = file("${buildDir}/bwc/checkout-${bwcBranch}")
|
File checkoutDir = file("${buildDir}/bwc/checkout-${bwcBranch}")
|
||||||
|
|
||||||
|
@ -195,11 +196,19 @@ subprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
if (gradle.startParameter.taskNames == ["assemble"]) {
|
||||||
for (File artifactFile : artifactFiles) {
|
// Gradle needs the `artifacts` declaration, including `builtBy` bellow to make projects dependencies on this
|
||||||
String artifactName = artifactFile.name.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
|
// project work, but it will also trigger the build of these for the `assemble` task.
|
||||||
String suffix = artifactFile.toString()[-3..-1]
|
// Since these are only used for testing, we don't want to assemble them if `assemble` is the single command being
|
||||||
'default' file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion
|
// ran.
|
||||||
|
logger.info("Skipping BWC builds since `assemble` is the only task name provided on the command line")
|
||||||
|
} else {
|
||||||
|
artifacts {
|
||||||
|
for (File artifactFile : artifactFiles) {
|
||||||
|
String artifactName = artifactFile.name.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
|
||||||
|
String suffix = artifactFile.toString()[-3..-1]
|
||||||
|
'default' file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue