-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
253 lines (248 loc) · 8.82 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
251
252
253
// all our subrojects share same settings here
subprojects {
apply plugin: "java"
apply plugin: "idea"
apply plugin: "eclipse"
apply plugin: "maven"
sourceCompatibility = 1.6
targetCompatibility = 1.6
group = "com.redhat.qe.jon"
version = "1.0.0-SNAPSHOT"
// force testng version
configurations.all {
resolutionStrategy {
force 'org.testng:testng:6.8.13'
}
}
eclipse {
classpath {
defaultOutputDir = file("bin")
}
}
repositories {
mavenCentral()
mavenLocal()
[
"https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads",
"http://clojars.org/repo",
"http://download.java.net/maven/2/",
"http://repository.codehaus.org",
"http://snapshots.repository.codehaus.org",
"http://repo1.maven.org/maven2/",
"https://repository.jboss.org/nexus/content/groups/public-jboss/"
].each { repo ->
maven {
url repo
}
}
}
task jacocodump() << {
if ( System.properties["code.coverage"] && System.properties["code.coverage"] == "true" ) {
logger.info("Gathering jacoco results")
ant.taskdef( resource:'org/jacoco/ant/antlib.xml', classpath: project(":common").sourceSets.main.compileClasspath.asPath )
def mergedDump="$buildDir/reports/jacoco.exec"
def dumped = false
if ( System.properties["jon.agent.jacoco.port"] && System.properties["jon.agent.host"] ) {
def agentHosts = System.properties["jon.agent.host"]
for (String agent : agentHosts.split(",")) {
ant.dump(
address:agent,
port:System.properties["jon.agent.jacoco.port"],
reset:true,
destfile:"$buildDir/reports/agent.${agent}.exec")
}
dumped = true
}
if ( System.properties["jon.server.jacoco.port"] && System.properties["jon.server.host"] ) {
def serverHosts = System.properties["jon.server.host"]
for (String server : serverHosts.split(",")) {
ant.dump(
address:server,
port:System.properties["jon.server.jacoco.port"],
reset:true,
destfile:"$buildDir/reports/server.${server}.exec")
}
dumped = true
}
if (!dumped) {
logger.info("Code coverage dumps not gathered, you need to specify [jon.agent.host, jon.agent.jacoco.port] and/or [jon.server.host, jon.server.jacoco.port] system properties")
return
}
// let's merge dumps
ant.merge(destfile:"$mergedDump") {
fileset(dir:"$buildDir/reports",includes:"*.exec")
}
}
else {
logger.info("System property [code.coverage=true] is required, skipping dump")
// wanna know why? just because jenkins does not support conditional build steps correctly :-/
}
}
task test(dependsOn: "testClasses",overwrite:true) << {
def workspace = System.getProperty("workspace.dir", System.getenv("WORKSPACE") ?: System.properties["user.dir"])
def xmlSuite = "src/test/resources/testng.xml"
if ( System.properties["testng.suite"] ) {
xmlSuite = System.properties["testng.suite"]
}
ant.taskdef( resource: 'testngtasks', classpath: project(":common").sourceSets.main.compileClasspath.asPath )
ant.testng(
classpath: sourceSets.test.runtimeClasspath.asPath,
listeners: "com.redhat.qe.auto.testng.TestNGListener,org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter",
outputdir: "$buildDir/reports/tests",
workingDir: "$buildDir"
) {
xmlfileset(file: "${xmlSuite}")
// we pass all system properties to testNG except line.sepatator
// there's an issue that stacktraces are not output on new lines (only god knows why)
for (def prop in System.properties) {
if (prop.key.equals("line.separator")) {
continue
}
else {
sysproperty(key:prop.key,value:prop.value)
}
}
// disable ReportNG escaping
sysproperty(key:"org.uncommons.reportng.escape-output",value:"false")
}
if ( System.properties["code.coverage"] ) {
tasks.jacocodump.execute()
}
}
// we build/install also sources and javadocs to local mvn repo
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
}
}
// project specific stuff
project(":clitest") {
dependencies {
compile project(":common")
testCompile project(":common")
}
task jsdoc() << {
description "generates JSDoc for rhqapi.js"
def jsdocDir = file("$buildDir/jsdoc/rhqapi")
def toolkit = "jsdoc_toolkit-2.4.0"
ant.mkdir(dir:"$jsdocDir")
ant.get(src:"http://jsdoc-toolkit.googlecode.com/files/${toolkit}.zip",dest:"$buildDir",skipexisting:true)
ant.unzip(src:"$buildDir/${toolkit}.zip",dest:"$buildDir")
def toolkit_dir = "$buildDir/$toolkit/jsdoc-toolkit/"
ant.java(jar:"${toolkit_dir}jsrun.jar",fork:true,dir:toolkit_dir,newenvironment:true,timeout:60000) {
arg(value: "app/run.js")
// arg(value: "--allfunctions")
arg(value: "--template=templates/jsdoc")
arg(value: "--directory=$jsdocDir")
arg(value: "--verbose")
arg(value: "$projectDir/src/main/resources/js-files/rhqapi.js")
}
}
}
project(":sahi") {
dependencies {
compile project(":common"),
"net.sf.sahi:sahi:4.4"
testCompile project(":common")
}
}
project(":rest-java") {
dependencies {
compile project(":common")
testCompile project(":common")
}
}
project(":common") {
ext.controllerClientVersion='org.jboss.as:jboss-as-controller-client:7.2.0.Final'
if(JavaVersion.current() == JavaVersion.VERSION_1_8){
logger.debug('Using wildfly-controller-client')
ext.controllerClientVersion='org.wildfly.core:wildfly-controller-client:2.0.5.Final'
}
dependencies {
compile "com.redhat.qe:ssh-tools:1.0.0",
"com.redhat.qe:assertions:1.0.2",
"com.redhat.qe:testng-listeners:1.0.5",
"com.redhat.qe:log-checker:1.0.1-SNAPSHOT",
controllerClientVersion,
"com.google.inject:guice:3.0",
"org.testng:testng:6.8.13",
"com.googlecode.json-simple:json-simple:1.1.1",
"com.sun.jersey:jersey-client:1.18.1",
"com.sun.jersey:jersey-core:1.18.1",
// "org.resteasy:jaxrs-api:1.0-beta-4",
"org.uncommons:reportng:1.1.3",
"org.apache.commons:commons-lang3:3.1",
"org.apache.velocity:velocity:1.7",
"org.jacoco:org.jacoco.ant:0.6.4.201312101107",
// "org.jacoco:org.jacoco.ant:0.5.10.201208310627",
"com.report.engine:java-client:0.0.3-SNAPSHOT"
compile("com.redhat.qe:bz-checker:1.0.3-SNAPSHOT"){
force = true
}
}
}
// rest-groovy project also uses "groovy" plugin
project(":rest-groovy") {
apply plugin: "groovy"
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.10'
compile group: "org.codehaus.groovy.modules.http-builder", name:"http-builder", version:"0.5.2"
compile project(":common")
testCompile project(":common")
}
}
/*project("cli-javapi") {
repositories {
maven {
url "http://download.lab.bos.redhat.com/brewroot/repos/jboss-on-3-build/latest/maven/"
}
}
dependencies {
compile project(":common")
compile module(group:"org.rhq", name :"rhq-enterprise-server", version:"4.4.0.JON311GA") {
artifact {
name = "rhq-enterprise-server"
extension = "jar"
classifier = "client"
type = "ejb-client"
}
transitive = true
}
compile (group:"org.rhq", name :"rhq-remoting-client-api", version:"4.4.0.JON311GA") {
exclude module: "rhq-enterprise-server"
transitive = true
}
compile (group:"org.rhq", name :"rhq-script-bindings", version:"4.4.0.JON311GA") {
exclude module: "rhq-enterprise-server"
transitive = true
}
compile "commons-configuration:commons-configuration:1.8",
"oswego-concurrent:concurrent:1.3.4-jboss",
"commons-configuration:commons-configuration:1.8",
"org.apache.commons:commons-lang3:3.0"
}
}
*/
task docs(type: Javadoc) {
source subprojects.collect {project -> project.sourceSets.main.allJava }
classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath})
destinationDir = new File("$buildDir/javadocs")
options {
group("SAHI ", ["com.redhat.qe.jon.sahi.base*","com.redhat.qe.jon.sahi.tasks"])
group("CLI", ["com.redhat.qe.jon.clitest.base","com.redhat.qe.jon.clitest.tests","com.redhat.qe.jon.clitest.tasks"])
group("REST", ["com.redhat.qe.jon.rest*"])
group("Common", ["com.redhat.qe.jon.common*"])
group("CLI EAP6 Tests", ["com.redhat.qe.jon.clitest.tests.plugins.eap6*"])
group("SAHI Core Tests", ["com.redhat.qe.jon.sahi.tests"])
group("SAHI EAP6 Tests", ["com.redhat.qe.jon.sahi.tests.plugins.eap6*"])
}
title = "JON QE Automation API & tests"
}