Build: Make assemble a noop in bwc projects (#37245)

This commit makes the assemble tasks in the bwc projects noops by
setting the dependsOn directly. While we can not remove things from
dependsOn, we can still completely override the dependencies.

closes #33581
This commit is contained in:
Ryan Ernst 2019-01-09 10:57:26 -08:00 committed by GitHub
parent 29c895b55c
commit 722b850efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 15 deletions

View File

@ -197,21 +197,15 @@ bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unre
} }
} }
if (gradle.startParameter.taskNames == ["assemble"]) { artifacts {
// Gradle needs the `artifacts` declaration, including `builtBy` bellow to make projects dependencies on this for (File artifactFile : artifactFiles) {
// project work, but it will also trigger the build of these for the `assemble` task. String artifactName = artifactFile.name.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
// Since these are only used for testing, we don't want to assemble them if `assemble` is the single command being String suffix = artifactFile.toString()[-3..-1]
// ran. 'default' file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion
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
}
}
} }
// make sure no dependencies were added to assemble; we want it to be a no-op
assemble.dependsOn = []
}} }}
class IndentingOutputStream extends OutputStream { class IndentingOutputStream extends OutputStream {