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@afc0a1443c
This commit is contained in:
Jason Tedor 2018-04-03 13:45:07 -04:00 committed by GitHub
parent 3d8c438403
commit ca48a22ca7
1 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import org.elasticsearch.gradle.MavenFilteringHack
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.StandardCopyOption import java.nio.file.StandardCopyOption
apply plugin: 'elasticsearch.esplugin' apply plugin: 'elasticsearch.esplugin'
@ -62,10 +63,13 @@ processResources {
if (licenseKey != null) { if (licenseKey != null) {
println "Using provided license key from ${licenseKey}" println "Using provided license key from ${licenseKey}"
} else if (snapshot) { } else if (snapshot) {
licenseKey = 'snapshot.key' licenseKey = Paths.get(project.projectDir.path, 'snapshot.key')
} else { } else {
throw new IllegalArgumentException('Property license.key must be set for release build') 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) { from(licenseKey) {
rename { String filename -> 'public.key' } rename { String filename -> 'public.key' }
} }