-
Notifications
You must be signed in to change notification settings - Fork 77
/
build.gradle
187 lines (162 loc) · 5.37 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'co.riiid:gradle-github-plugin:0.4.2'
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
}
}
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.3'
id 'org.ajoberstar.grgit' version '1.4.2'
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'co.riiid.gradle'
println "Host: " + java.net.InetAddress.getLocalHost()
println "Gradle: " + gradle.gradleVersion + " JVM: " + org.gradle.internal.jvm.Jvm.current() + " Groovy: " + GroovySystem.getVersion()
println "Build: group: '${project.group}', name: '${project.name}', version: '${project.version}'"
println "Timestamp: " + java.time.Instant.now().atZone(java.time.ZoneId.systemDefault()).toString()
ext {
pluginName = 'knapsack'
pluginClassname = 'org.xbib.elasticsearch.plugin.knapsack.KnapsackPlugin'
pluginDescription = 'An import/export plugin for Elasticsearch'
user = 'jprante'
name = 'elasticsearch-knapsack'
scmUrl = 'https://github.com/' + user + '/' + name
scmConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git'
scmDeveloperConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git'
versions = [
'elasticsearch' : '2.3.4',
'elasticsearch-helper' : '2.3.4.0',
'log4j': '2.5',
'junit' : '4.12',
'wagon' : '2.10'
]
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven {
url "http://xbib.org/repository"
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
wagon
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
releaseJars {
extendsFrom runtime
exclude group: 'org.elasticsearch'
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
exclude group: 'org.slf4j'
exclude group: 'log4j'
}
}
dependencies {
compile "org.elasticsearch:elasticsearch:${versions.elasticsearch}"
compile "org.xbib.elasticsearch.plugin:elasticsearch-helper:${versions.'elasticsearch-helper'}"
compile "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}"
compile "org.apache.logging.log4j:log4j-core:${versions.log4j}"
testCompile "junit:junit:${versions.junit}"
integrationTestCompile "junit:junit:${versions.junit}"
releaseJars "${project.group}:${project.name}:${project.version}"
wagon "org.apache.maven.wagon:wagon-ssh-external:${versions.wagon}"
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked,deprecation"
}
test {
systemProperties['path.home'] = System.getProperty("user.dir")
testLogging {
showStandardStreams = false
exceptionFormat = 'full'
}
}
task integrationTest(type: Test, dependsOn: ['unpackPlugin']) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = configurations.integrationTestCompile
classpath += fileTree("plugins/${pluginName}").include('*.jar')
classpath += sourceSets.integrationTest.output
// without this trick to remove identical jars from classpath, an Elasticsearch bug whines about a "jar hell"
classpath -= configurations.releaseJars
outputs.upToDateWhen { false }
systemProperty 'path.home', projectDir.absolutePath
testLogging.showStandardStreams = false
}
integrationTest.mustRunAfter test
check.dependsOn integrationTest
clean {
delete "plugins"
delete "data"
delete "logs"
}
task makePluginDescriptor(type: Copy) {
from 'src/main/templates'
into 'build/tmp/plugin'
expand([
'descriptor': [
'name': pluginName,
'classname': pluginClassname,
'description': pluginDescription,
'jvm': true,
'site': false,
'isolated': true,
'version': project.property('version'),
'javaVersion': project.property('targetCompatibility'),
'elasticsearchVersion' : versions.elasticsearch
]
])
}
task buildPluginZip(type: Zip, dependsOn: [':jar', ':makePluginDescriptor']) {
from configurations.releaseJars
from 'build/tmp/plugin'
classifier = 'plugin'
}
task unpackPlugin(type: Copy, dependsOn: [':buildPluginZip']) {
delete "plugins"
from configurations.releaseJars
from 'build/tmp/plugin'
into "plugins/${pluginName}"
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
into 'build/tmp/sources'
classifier 'sources'
}
shadowJar {
baseName = project.name
classifier = 'all'
}
task javadocJar(type: Jar, dependsOn: classes) {
from javadoc
into 'build/tmp'
classifier 'javadoc'
}
artifacts {
archives javadocJar, sourcesJar, shadowJar, buildPluginZip
}
if (project.hasProperty('signing.keyId')) {
signing {
sign configurations.archives
}
}
ext.grgit = org.ajoberstar.grgit.Grgit.open()
apply from: 'gradle/git.gradle'
apply from: 'gradle/publish.gradle'