From db8885a46eb9e3bac3bfc2f95d664f044875d210 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Tue, 15 Aug 2017 16:31:23 +0100 Subject: [PATCH] [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@bd71637edd0217e6b67538c4febbaea706b82485 --- plugin/ml-cpp-snapshot/build.gradle | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugin/ml-cpp-snapshot/build.gradle b/plugin/ml-cpp-snapshot/build.gradle index 13583acdf70..44a4da3e470 100644 --- a/plugin/ml-cpp-snapshot/build.gradle +++ b/plugin/ml-cpp-snapshot/build.gradle @@ -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() }