[ML] Do not download the ml-cpp zip when building it locally (elastic/x-pack-elasticsearch#2262)

When the machine-learning-cpp repo is built locally, the zip file it
creates is preferred over that downloaded from s3 when creating the
overall x-pack-elasticsearch zip.  However, prior to this change the
build would ALSO download an ml-cpp zip from s3, and just not use it.

Original commit: elastic/x-pack-elasticsearch@bd71637edd
This commit is contained in:
David Roberts 2017-08-15 16:31:23 +01:00 committed by GitHub
parent f3a7d46698
commit db8885a46e
1 changed files with 7 additions and 4 deletions

View File

@ -120,8 +120,10 @@ S3Object getZip() {
File snapshotZip = new File(buildDir, "download/ml-cpp-${version}.zip")
task downloadMachineLearningSnapshot {
onlyIf {
// skip for offline builds, just rely on the artifact already having been downloaded before here
project.gradle.startParameter.isOffline() == false
// skip if machine-learning-cpp is being built locally
findProject(':machine-learning-cpp') == null &&
// skip for offline builds - just rely on the artifact already having been downloaded before here
project.gradle.startParameter.isOffline() == false
}
doFirst {
snapshotZip.parentFile.mkdirs()
@ -138,8 +140,9 @@ task downloadMachineLearningSnapshot {
}
gradle.taskGraph.whenReady { taskGraph ->
// do validation of token/java version up front, don't wait for the task to run
if (taskGraph.hasTask(downloadMachineLearningSnapshot)) {
// skip if machine-learning-cpp is being built locally and also for offline builds
if (findProject(':machine-learning-cpp') == null && project.gradle.startParameter.isOffline() == false) {
// do validation of token/java version up front, don't wait for the task to run
checkJavaVersion()
setupVaultAuthMethod()
}