diff --git a/build.gradle b/build.gradle index 692b92f3cbd..21090ce901d 100644 --- a/build.gradle +++ b/build.gradle @@ -90,10 +90,9 @@ allprojects { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = sourceCompatibility - luceneSnapshotRevision = '1710880' // dependency versions that are used in more than one place versions = [ - lucene: "5.4.0-snapshot-${luceneSnapshotRevision}", + lucene: "${luceneVersion}", randomizedrunner: '2.2.0', httpclient: '4.3.6' ] @@ -107,9 +106,12 @@ subprojects { name 'sonatype-snapshots' url 'http://oss.sonatype.org/content/repositories/snapshots/' } - maven { - name 'lucene-snapshots' - url "http://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/${luceneSnapshotRevision}" + if (versions.lucene.contains('-snapshot')) { + String revision = (luceneVersion =~ /\d\.\d\.\d-snapshot-(\d+)/)[0][1] + maven { + name 'lucene-snapshots' + url "http://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/${revision}" + } } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 9346843a915..e987a173bae 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -24,6 +24,7 @@ repositories { name 'sonatype-snapshots' url "https://oss.sonatype.org/content/repositories/snapshots/" } + jcenter() } dependencies { @@ -34,6 +35,9 @@ dependencies { transitive = false } compile 'com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3' + compile 'com.netflix.nebula:gradle-info-plugin:3.0.3' + compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r' + compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE.... compile 'de.thetaphi:forbiddenapis:2.0' } @@ -44,7 +48,8 @@ version = props.getProperty('version') processResources { inputs.file('../gradle.properties') filter ReplaceTokens, tokens: [ - 'version': props.getProperty('version') + 'version': props.getProperty('version'), + 'luceneVersion': props.getProperty('luceneVersion') ] } diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 46c92741e8c..4b550acc9e4 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -23,6 +23,7 @@ import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.compile.JavaCompile /** @@ -34,8 +35,15 @@ class BuildPlugin implements Plugin { void apply(Project project) { project.pluginManager.apply('java') project.pluginManager.apply('carrotsearch.randomizedtesting') + // these plugins add lots of info to our jars + project.pluginManager.apply('nebula.info-broker') + project.pluginManager.apply('nebula.info-basic') + project.pluginManager.apply('nebula.info-java') + project.pluginManager.apply('nebula.info-scm') + project.pluginManager.apply('nebula.info-jar') configureCompile(project) + configureJarManifest(project) configureTest(project) PrecommitTasks.configure(project) } @@ -51,6 +59,18 @@ class BuildPlugin implements Plugin { } } + /** Adds additional manifest info to jars */ + static void configureJarManifest(Project project) { + project.afterEvaluate { + project.tasks.withType(Jar) { Jar jarTask -> + manifest { + attributes('X-Compile-Elasticsearch-Version': ElasticsearchProperties.version, + 'X-Compile-Lucene-Version': ElasticsearchProperties.luceneVersion) + } + } + } + } + /** Returns a closure of common configuration shared by unit and integration tests. */ static Closure commonTestConfig(Project project) { return { diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/ElasticsearchProperties.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/ElasticsearchProperties.groovy index 333db47f566..8628387e3dc 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/ElasticsearchProperties.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/ElasticsearchProperties.groovy @@ -23,6 +23,7 @@ package org.elasticsearch.gradle */ class ElasticsearchProperties { static final String version + static final String luceneVersion static { Properties props = new Properties() InputStream propsStream = ElasticsearchProperties.class.getResourceAsStream('/elasticsearch.properties') @@ -31,5 +32,6 @@ class ElasticsearchProperties { } props.load(propsStream) version = props.getProperty('version') + luceneVersion = props.getProperty('luceneVersion') } } diff --git a/buildSrc/src/main/resources/elasticsearch.properties b/buildSrc/src/main/resources/elasticsearch.properties index 5bbcd306c72..773b5439a2a 100644 --- a/buildSrc/src/main/resources/elasticsearch.properties +++ b/buildSrc/src/main/resources/elasticsearch.properties @@ -1 +1,2 @@ version=@version@ +luceneVersion=@luceneVersion@ diff --git a/gradle.properties b/gradle.properties index ecff8f3fb67..58dc97027e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ group=org.elasticsearch version=3.0.0-SNAPSHOT +luceneVersion=5.4.0-snapshot-1710880