92 lines
3.8 KiB
Groovy
92 lines
3.8 KiB
Groovy
apply plugin: 'java'
|
|
|
|
archivesBaseName = "$project.archivesBaseName"
|
|
|
|
dependencies {
|
|
runtime 'aopalliance:aopalliance:1.0'
|
|
runtime 'javax.inject:javax.inject:1'
|
|
runtime 'com.google.inject:guice:3.0-rc2'
|
|
runtime 'com.google.inject.extensions:guice-assistedinject:3.0-rc2'
|
|
runtime 'com.google.inject.extensions:guice-multibindings:3.0-rc2'
|
|
|
|
runtime 'com.google.guava:guava:r07'
|
|
runtime 'org.elasticsearch:es-trove:2.1.0'
|
|
runtime 'org.elasticsearch:es-jsr166y:20100615'
|
|
|
|
runtime 'commons-codec:commons-codec:1.4'
|
|
|
|
runtime 'joda-time:joda-time:1.6.1'
|
|
runtime 'org.mvel:mvel2:2.0.19'
|
|
|
|
runtime 'org.codehaus.jackson:jackson-core-asl:1.7.1'
|
|
runtime 'org.codehaus.jackson:jackson-smile:1.7.1'
|
|
runtime 'org.yaml:snakeyaml:1.6'
|
|
|
|
runtime('org.jboss.netty:netty:3.2.3.Final') { transitive = false }
|
|
}
|
|
|
|
configurations {
|
|
tools
|
|
}
|
|
|
|
dependencies {
|
|
tools "org.elasticsearch:es-jarjar:1.0.0"
|
|
}
|
|
|
|
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.runtime.files.findAll {file ->
|
|
['inject', 'codec', 'mvel', 'jackson', 'joda', 'snakeyaml', 'netty', 'guice', 'javax.inject', 'aopalliance', 'guava', 'trove', 'jsr166y'].any { file.name.contains(it) }
|
|
}.each { jarjarFile ->
|
|
zipfileset(src: jarjarFile) {
|
|
exclude(name: "META-INF/**")
|
|
}
|
|
}
|
|
rule pattern: "com.google.common.**", result: "org.elasticsearch.common.@1"
|
|
rule pattern: "gnu.trove.**", result: "org.elasticsearch.common.trove.@1"
|
|
rule pattern: "jsr166y.**", result: "org.elasticsearch.common.util.concurrent.jsr166y.@1"
|
|
|
|
rule pattern: "org.aopalliance.**", result: "org.elasticsearch.common.aopalliance.@1"
|
|
rule pattern: "javax.inject.**", result: "org.elasticsearch.common.inject.jex.@1"
|
|
rule pattern: "com.google.inject.**", result: "org.elasticsearch.common.inject.@1"
|
|
|
|
rule pattern: "org.apache.commons.codec.**", result: "org.elasticsearch.common.codec.@1"
|
|
|
|
rule pattern: "org.mvel2.**", result: "org.elasticsearch.common.mvel2.@1"
|
|
|
|
rule pattern: "org.codehaus.jackson.**", result: "org.elasticsearch.common.jackson.@1"
|
|
rule pattern: "org.yaml.**", result: "org.elasticsearch.common.yaml.@1"
|
|
|
|
rule pattern: "org.joda.**", result: "org.elasticsearch.common.joda.@1"
|
|
|
|
rule pattern: "org.jboss.netty.**", result: "org.elasticsearch.common.netty.@1"
|
|
}
|
|
delete(file: jar.archivePath)
|
|
copy(file: jarjarArchivePath, tofile: jar.archivePath)
|
|
delete(file: jarjarArchivePath)
|
|
|
|
// seems like empty dirs still exists, unjar and clean them
|
|
unjar(src: jar.archivePath, dest: "build/tmp/extracted")
|
|
delete(file: "build/tmp/extracted/NOTICE")
|
|
delete(file: "build/tmp/extracted/LICENSE")
|
|
delete(file: "build/tmp/extracted/build.properties")
|
|
delete(dir: "build/tmp/extracted/jsr166y")
|
|
delete(dir: "build/tmp/extracted/gnu")
|
|
delete(dir: "build/tmp/extracted/org/codehaus")
|
|
delete(dir: "build/tmp/extracted/org/aopalliance")
|
|
delete(dir: "build/tmp/extracted/com/google")
|
|
delete(dir: "build/tmp/extracted/org/mvel2")
|
|
delete(dir: "build/tmp/extracted/org/joda")
|
|
delete(dir: "build/tmp/extracted/org/yaml")
|
|
delete(dir: "build/tmp/extracted/org/jboss")
|
|
|
|
delete(file: jar.archivePath)
|
|
jar(destfile: jar.archivePath, basedir: "build/tmp/extracted")
|
|
delete(dir: "build/tmp/extracted")
|
|
}
|
|
}
|