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@0c50add8ff03024b3c0b0f0646063c161172b1ea
@@ -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' }
}
