-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate-gradle-build.groovy
61 lines (49 loc) · 1.75 KB
/
generate-gradle-build.groovy
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
// Use this script in the jenkins web console to export your jenkins instance's verion + plugins into a build.gradle
println """
apply plugin: 'groovy'
ext {
"""
println " jenkinsVersion = '" + Jenkins.instance.VERSION + "'"
println """
}
repositories {
jcenter()
maven {
url 'https://repo.jenkins-ci.org/public/'
}
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.11'
/**
* JenkinsPipelineUnit for testing pipelines from:
* https://github.com/lesfurets/JenkinsPipelineUnit
*/
//testCompile 'com.lesfurets:jenkins-pipeline-unit:0.12'
/**
* Test framwork stuff
*/
testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
testCompile 'cglib:cglib-nodep:3.2.2'
testCompile 'org.objenesis:objenesis:1.2'
testCompile 'org.assertj:assertj-core:3.7.0'
testCompile 'org.jenkins-ci.main:jenkins-test-harness:2.20'
testCompile "org.jenkins-ci.main:jenkins-war:\${jenkinsVersion}"
testCompile "org.jenkins-ci.main:jenkins-war:\${jenkinsVersion}:war-for-test@jar"
"""
Jenkins.instance.pluginManager.plugins.each {
def attributes = it.getManifest().getMainAttributes()
if(attributes.getValue('Short-Name') != 'metrics' && attributes.getValue('Short-Name') != 'jobConfigHistory' && attributes.getValue('Short-Name') != 'jacoco' ) {
println(" testCompile ('" + attributes.getValue('Group-Id') + ":" + attributes.getValue('Short-Name') + ":" + attributes.getValue('Plugin-Version') + "') { force = true; artifact {name='"+ attributes.getValue('Short-Name') +"';type='jar'}; artifact {name='"+ attributes.getValue('Short-Name') +"';type='hpi' } }")
}
}
println """
}
sourceSets {
test {
groovy {
srcDirs= ['src/test/groovy']
}
}
}
"""
""