Build: Add back manifest info to jars

closes #14365
This commit is contained in:
Ryan Ernst 2015-10-29 13:59:10 -07:00
parent c86100f636
commit 561436eba3
6 changed files with 37 additions and 6 deletions

View File

@ -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}"
}
}
}

View File

@ -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')
]
}

View File

@ -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<Project> {
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<Project> {
}
}
/** 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 {

View File

@ -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')
}
}

View File

@ -1 +1,2 @@
version=@version@
luceneVersion=@luceneVersion@

View File

@ -1,2 +1,3 @@
group=org.elasticsearch
version=3.0.0-SNAPSHOT
luceneVersion=5.4.0-snapshot-1710880