From ca48a22ca7d061c4a723a80c621cdf73cdc61365 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 3 Apr 2018 13:45:07 -0400 Subject: [PATCH] Remove license key leniency (elastic/x-pack-elasticsearch#4277) If the license key specified by the system property license.key does not exist, Gradle does not care. Gradle should care, so this commit makes it care. Original commit: elastic/x-pack-elasticsearch@afc0a1443c871d927233ef5ee0ba7fc3650a9fe6 --- plugin/core/build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/core/build.gradle b/plugin/core/build.gradle index ffdd3303531..ca38aee302e 100644 --- a/plugin/core/build.gradle +++ b/plugin/core/build.gradle @@ -2,6 +2,7 @@ import org.elasticsearch.gradle.MavenFilteringHack import java.nio.file.Files import java.nio.file.Path +import java.nio.file.Paths import java.nio.file.StandardCopyOption apply plugin: 'elasticsearch.esplugin' @@ -62,10 +63,13 @@ processResources { if (licenseKey != null) { println "Using provided license key from ${licenseKey}" } else if (snapshot) { - licenseKey = 'snapshot.key' + licenseKey = Paths.get(project.projectDir.path, 'snapshot.key') } else { throw new IllegalArgumentException('Property license.key must be set for release build') } + if (Files.exists(Paths.get(licenseKey)) == false) { + throw new IllegalArgumentException('license.key at specified path [' + licenseKey + '] does not exist') + } from(licenseKey) { rename { String filename -> 'public.key' } }