156 lines
5.5 KiB
Groovy
156 lines
5.5 KiB
Groovy
dependsOn(':test-testng')
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'maven'
|
|
|
|
archivesBaseName = "$project.archivesBaseName"
|
|
|
|
processResources.doLast {
|
|
Properties versionProps = new Properties();
|
|
versionProps.setProperty("number", rootProject.version)
|
|
versionProps.setProperty("date", buildTimeStr)
|
|
|
|
File versionFile = new File(sourceSets.main.classesDir, "/org/elasticsearch/version.properties")
|
|
versionFile.parentFile.mkdirs()
|
|
versionFile.withOutputStream {
|
|
versionProps.store(it, '')
|
|
}
|
|
}
|
|
|
|
|
|
manifest.mainAttributes("Implementation-Title": "ElasticSearch", "Implementation-Version": rootProject.version, "Implementation-Date": buildTimeStr)
|
|
|
|
// no need to use the resource dir
|
|
sourceSets.main.resources.srcDirs 'src/main/java', rootProject.file('config')
|
|
sourceSets.test.resources.srcDirs 'src/test/java'
|
|
|
|
dependencies {
|
|
compile('jline:jline:0.9.94') { transitive = false }
|
|
|
|
compile 'org.slf4j:slf4j-api:1.5.11'
|
|
compile('org.slf4j:slf4j-log4j12:1.5.11') { transitive = false }
|
|
compile('log4j:log4j:1.2.15') { transitive = false }
|
|
|
|
compile 'joda-time:joda-time:1.6'
|
|
|
|
compile 'org.codehaus.jackson:jackson-core-asl:1.5.2'
|
|
compile 'org.yaml:snakeyaml:1.6'
|
|
|
|
compile 'org.apache.lucene:lucene-core:3.0.1'
|
|
compile 'org.apache.lucene:lucene-analyzers:3.0.1'
|
|
compile 'org.apache.lucene:lucene-queries:3.0.1'
|
|
compile 'org.apache.lucene:lucene-fast-vector-highlighter:3.0.1'
|
|
|
|
compile('org.jboss.netty:netty:3.1.5.GA') { transitive = false }
|
|
|
|
testCompile project(':test-testng')
|
|
testCompile('org.testng:testng:5.10:jdk15') { transitive = false }
|
|
testCompile('org.hamcrest:hamcrest-all:1.1') { transitive = false }
|
|
}
|
|
|
|
configurations {
|
|
deployerJars
|
|
tools
|
|
}
|
|
|
|
dependencies {
|
|
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-2"
|
|
tools "com.google.code:jarjar:1.0"
|
|
}
|
|
|
|
// add the source files to the dist jar
|
|
//jar {
|
|
// from sourceSets.main.allJava
|
|
//}
|
|
|
|
jar << {
|
|
jarjarArchivePath = new File(jar.archivePath.absolutePath + ".jarjar.jar")
|
|
project.ant {
|
|
taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", classpath: configurations.tools.asPath
|
|
jarjar(jarfile: jarjarArchivePath) {
|
|
zipfileset(src: jar.archivePath)
|
|
configurations.compile.files.findAll {file ->
|
|
['jackson', 'joda', 'snakeyaml'].any { file.name.contains(it) }
|
|
}.each { jarjarFile ->
|
|
zipfileset(src: jarjarFile) {
|
|
exclude(name: "META-INF/**")
|
|
}
|
|
}
|
|
rule pattern: "org.codehaus.jackson.**", result: "org.elasticsearch.util.jackson.@1"
|
|
rule pattern: "org.joda.**", result: "org.elasticsearch.util.joda.@1"
|
|
rule pattern: "org.yaml.**", result: "org.elasticsearch.util.yaml.@1"
|
|
}
|
|
delete(file: jar.archivePath)
|
|
copy(file: jarjarArchivePath, tofile: jar.archivePath)
|
|
delete(file: jarjarArchivePath)
|
|
}
|
|
}
|
|
|
|
javadoc {
|
|
maxMemory = "1g"
|
|
}
|
|
|
|
test {
|
|
useTestNG()
|
|
jmvArgs = ["-ea", "-Xmx1024m"]
|
|
suiteName = project.name
|
|
listeners = ["org.elasticsearch.util.testng.Listeners"]
|
|
systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties")
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
classifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives javadocJar
|
|
}
|
|
|
|
uploadArchives {
|
|
repositories.mavenDeployer {
|
|
configuration = configurations.deployerJars
|
|
repository(url: rootProject.mavenRepoUrl) {
|
|
authentication(userName: rootProject.mavenRepoUser, password: rootProject.mavenRepoPass)
|
|
}
|
|
snapshotRepository(url: rootProject.mavenSnapshotRepoUrl) {
|
|
authentication(userName: rootProject.mavenRepoUser, password: rootProject.mavenRepoPass)
|
|
}
|
|
|
|
pom.project {
|
|
inceptionYear '2009'
|
|
name 'elasticsearch'
|
|
description 'Open Source, Distributed, RESTful Search Engine'
|
|
licenses {
|
|
license {
|
|
name 'The Apache Software License, Version 2.0'
|
|
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
distribution 'repo'
|
|
}
|
|
}
|
|
scm {
|
|
connection 'git://github.com/elasticsearch/elasticsearch.git'
|
|
developerConnection 'git@github.com:elasticsearch/elasticsearch.git'
|
|
url 'http://github.com/elasticsearch/elasticsearch'
|
|
}
|
|
}
|
|
|
|
pom.whenConfigured {pom ->
|
|
pom.dependencies = pom.dependencies.findAll {dep -> dep.scope != 'test' } // removes the test scoped ones
|
|
pom.dependencies = pom.dependencies.findAll {dep -> !dep.artifactId.contains('log4j') }
|
|
pom.dependencies = pom.dependencies.findAll {dep -> !dep.artifactId.contains('slf4j') }
|
|
pom.dependencies = pom.dependencies.findAll {dep -> !dep.artifactId.contains('jline') }
|
|
pom.dependencies = pom.dependencies.findAll {dep -> !dep.artifactId.contains('jackson') }
|
|
pom.dependencies = pom.dependencies.findAll {dep -> !dep.artifactId.contains('joda') }
|
|
pom.dependencies = pom.dependencies.findAll {dep -> !dep.artifactId.contains('snakeyaml') }
|
|
// keep netty required for simpler usage
|
|
// pom.dependencies.findAll {dep -> dep.groupId == 'org.jboss.netty' }*.scope = 'runtime'
|
|
}
|
|
}
|
|
} |