forked from treelogic-swe/aws-mock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
251 lines (214 loc) · 7.19 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
allprojects {
repositories {
maven { url 'http://repo2.maven.org/maven2/' }
}
}
buildscript {
repositories {
maven { url 'http://repo2.maven.org/maven2/' }
}
dependencies {
classpath "net.saliman:gradle-cobertura-plugin:2.3.2"
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'jetty'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: "net.saliman.cobertura"
group = 'com.treelogic-swe'
version = '1.2.0'
ext.packaging = 'jar'
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
[jettyRun,jettyRunWar]*.daemon = false
[jettyRun,jettyRunWar]*.httpPort = 8000
[jettyRun,jettyRunWar,jettyStop]*.stopPort = 38091 // Port for stop signal
[jettyRun,jettyRunWar,jettyStop]*.stopKey = 'foo'
// fix the issue that jetty not stops in daemon mode
import org.gradle.api.plugins.jetty.internal.Monitor
[jettyRun, jettyRunWar]*.doLast {
if (getStopPort() != null && getStopPort() > 0 && getStopKey() != null) {
Monitor monitor = new Monitor(getStopPort(), getStopKey(), server.getProxiedObject());
monitor.start();
}
}
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5'
compile 'org.apache.commons:commons-lang3:3.1'
compile 'org.slf4j:slf4j-log4j12:1.7.5'
compile 'log4j:log4j:1.2.17'
compile 'org.freemarker:freemarker:2.3.20'
compile 'com.treelogic-swe:cxf-stub:1.0.4'
compile group: 'joda-time', name: 'joda-time', version: '2.8.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.0.1'
testCompile "com.amazonaws:aws-java-sdk:1.11.52"
testCompile "org.powermock:powermock:1.6.5"
testCompile "org.powermock:powermock-module-junit4:1.6.5"
testCompile "org.powermock:powermock-api-mockito:1.6.5"
}
// fix the issue that in eclipse workspace source/javadoc of dependency libs don't show correctly
eclipse.classpath.file {
withXml { xml ->
def node = xml.asNode()
node.remove( node.find { it.@path == 'org.eclipse.jst.j2ee.internal.web.container' } )
node.appendNode( 'classpathentry', [ kind: 'con', path: 'org.eclipse.jst.j2ee.internal.web.container', exported: 'true'])
}
}
sourceSets {
// example code also in java source sets
examples {
java {
srcDir 'example/java/simple'
srcDir 'example/java/full/client-usage'
srcDir 'example/java/full/extending-aws-mock/java'
srcDir 'example/java/test'
}
compileClasspath += sourceSets.main.runtimeClasspath
}
test {
compileClasspath += sourceSets.examples.runtimeClasspath
runtimeClasspath += sourceSets.examples.runtimeClasspath
}
// integration test code are separated from src/test/java
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 {
examplesCompile.extendsFrom testCompile
examplesRuntime.extendsFrom testRuntime
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
doFirst {
jettyRun.daemon = true
jettyRun.httpPort = 8001
[jettyRun,jettyStop]*.stopPort = 38092
[jettyRun,jettyStop]*.stopKey = 'bar'
jettyRun.execute()
}
doLast {
jettyStop.execute()
}
}
check.dependsOn integrationTest
checkstyle {
sourceSets = [ sourceSets.main, sourceSets.examples ]
}
task checkstylejs (type: Checkstyle) {
source 'example/nodejs'
include '**/*.js'
classpath=files()
}
task sourcesJar(type:Jar, dependsOn: classes){
classifier = 'sources'
from sourceSets.main.allSource
exclude "**/log4j.properties"
}
task javadocJar(type: Jar) {
classifier = "javadoc"
from javadoc
}
task run(dependsOn: jettyRun) {
}
test {
testLogging.showStandardStreams = false
}
jar {
exclude('log4j.properties')
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
/**
* We comment the signing task for avoiding travis-ci build failure
* because we don't commit secret key for signing jars to github.com.
*/
//signing {
// sign configurations.archives
//}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
/**
* for publishing to local folder - for normal travis-ci builds
* run with signing task commented
*/
repository(url: "file:/tmp/tlswe/repo")
/**
* for publishing to public maven repo - for manually releasing to maven repo
* run with signing task uncommented
*/
//repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
// authentication(userName: sonatypeUsername, password: sonatypePassword)
//}
addFilter('upload_jars') {artifact, file ->
artifact.type != 'war'
}
pom('upload_jars').project {
name 'aws-mock'
packaging 'jar'
description 'A lightweight, language-agnostic mock of essential AWS services, for test automation.'
url 'https://github.com/treelogic-swe/aws-mock'
scm {
url 'scm:[email protected]:treelogic-swe/aws-mock.git'
connection 'scm:[email protected]:treelogic-swe/aws-mock.git'
developerConnection 'scm:[email protected]:treelogic-swe/aws-mock.git'
}
licenses {
license {
name 'MIT'
distribution 'repo'
}
}
developers {
developer {
id 'christopherbalz'
name 'Christopher Balz'
email '[email protected]'
}
developer {
id 'maxiaohao'
name 'Ma Xiaohao'
email '[email protected]'
}
developer {
id 'Jayscrivner'
name 'Jay Scrivner'
email '[email protected]'
}
developer {
id 'zkareem'
name 'Zaki Kareem'
email '[email protected]'
}
}
}
}
}
}
cobertura {
coverageCheckHaltOnFailure = true
coverageCheckBranchRate = 0
coverageCheckLineRate = 0
coverageCheckPackageBranchRate = 0
coverageCheckPackageLineRate = 0
coverageCheckTotalLineRate = 80
coverageCheckTotalBranchRate = 80
coverageReportDir = file("$buildDir/cobertura/")
}