forked from sheehan/job-dsl-gradle-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
96 lines (79 loc) · 3.24 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
apply plugin: 'groovy'
sourceSets {
jobs {
groovy {
srcDirs 'src/jobs'
compileClasspath += main.compileClasspath
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
repositories {
mavenCentral()
maven { url 'http://repo.jenkins-ci.org/releases/' }
jcenter()
}
configurations {
testPlugins {}
}
// Exclude buggy Xalan dependency this way the JRE default TransformerFactory is used
// The xalan pulled in by htmlunit does not properly deal with spaces folder / job names
configurations.all*.exclude group: 'xalan'
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.11'
compile "org.jenkins-ci.plugins:job-dsl-core:${jobDslVersion}"
compile 'org.kohsuke:github-api:1.93'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'cglib:cglib-nodep:2.2.2' // used by Spock
// Jenkins test harness dependencies
testCompile('org.jenkins-ci.main:jenkins-test-harness:2.33') {
exclude group: 'org.netbeans.modules', module: 'org-netbeans-insane' // https://github.com/sheehan/job-dsl-gradle-example/issues/90
}
testCompile("org.jenkins-ci.main:jenkins-war:${jenkinsVersion}") {
exclude group: 'org.jenkins-ci.ui', module: 'bootstrap' // https://github.com/sheehan/job-dsl-gradle-example/issues/87
}
// Job DSL plugin including plugin dependencies
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}"
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}@jar"
testCompile 'org.jenkins-ci.plugins:structs:1.13@jar'
testCompile 'org.jenkins-ci.plugins:cloudbees-folder:5.12@jar'
testCompile 'org.jenkins-ci.plugins:ghprb:1.40.0@jar'
testCompile 'org.jenkins-ci.plugins:credentials:2.1.10@jar'
testCompile 'com.coravy.hudson.plugins.github:github:1.29.0@jar'
// plugins to install in test instance
testPlugins 'org.jenkins-ci.plugins:ghprb:1.40.0'
testPlugins 'org.jenkins-ci.plugins:cloudbees-folder:5.12'
testPlugins 'org.jenkins-ci.plugins:credentials:2.1.10'
// plugins used for auto-generated DSL. See example 9.
testPlugins 'org.jenkins-ci.plugins:cvs:2.13'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.7'
// plugin dependencies
testPlugins 'org.jenkins-ci.plugins:token-macro:2.5'
}
task resolveTestPlugins(type: Copy) {
from configurations.testPlugins
into new File(sourceSets.test.output.resourcesDir, 'test-dependencies')
include '*.hpi'
include '*.jpi'
def mapping = [:]
doFirst {
configurations.testPlugins.resolvedConfiguration.resolvedArtifacts.each {
mapping[it.file.name] = "${it.name}.${it.extension}"
}
}
rename { mapping[it] }
doLast {
List<String> baseNames = source*.name.collect { mapping[it] }.collect { it[0..it.lastIndexOf('.') - 1] }
new File(destinationDir, 'index').setText(baseNames.join('\n'), 'UTF-8')
}
}
test {
dependsOn tasks.resolveTestPlugins
inputs.files sourceSets.jobs.groovy.srcDirs
// set build directory for Jenkins test harness, JENKINS-26331
systemProperty 'buildDirectory', project.buildDir.absolutePath
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}