-
Notifications
You must be signed in to change notification settings - Fork 326
/
build.gradle
97 lines (82 loc) · 3.28 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
apply plugin: 'groovy'
sourceSets {
jobs {
groovy {
srcDirs 'src/jobs'
compileClasspath += main.compileClasspath
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
repositories {
mavenCentral()
maven { url 'https://repo.jenkins-ci.org/releases/' }
jcenter()
}
configurations {
testPlugins {}
// see JENKINS-45512
testCompile {
exclude group: 'xalan'
exclude group: 'xerces'
}
}
// 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.3-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.49') {
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.20@jar'
// Plugins to install in test instance
testPlugins 'org.jenkins-ci.plugins:cloudbees-folder:5.14'
testPlugins 'org.jenkins-ci.plugins:credentials:2.1.10'
testPlugins 'org.jenkins-ci.plugins:cvs:2.13'
testPlugins 'org.jenkins-ci.plugins:ghprb:1.40.0'
testPlugins 'org.jenkins-ci.plugins:token-macro:2.5'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.7'
// Run the following script in the Script Console of your Jenkins instance to generate
// the above testPlugins list. (adapted from https://git.io/fjpUs)
/*
Jenkins.instance.pluginManager.plugins
.findAll { !(it.shortName in ['job-dsl', 'structs']) }
.collect { "testPlugins '${it.manifest.mainAttributes.getValue("Group-Id")}:${it.shortName}:${it.version}'" }
.sort()
.each { println it }
*/
}
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
}