forked from jenkinsci/job-dsl-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
134 lines (112 loc) · 3.98 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.github.rholder:gradle-one-jar:1.0.3'
}
}
project(':job-dsl-core') {
// jpi plugin will install appropriate repos for job-dsl-plugin
repositories {
mavenCentral()
}
}
defaultTasks 'build' // For BuildHive
subprojects {
group = 'org.jenkins-ci.plugins'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven' // For artifactory publishing
sourceCompatibility = 1.5
targetCompatibility = 1.5
dependencies {
compile 'org.codehaus.groovy:groovy-all:1.8.6'
compile 'com.google.guava:guava:14.0.1'
testCompile 'org.spockframework:spock-core:0.7-groovy-1.8'
testCompile 'junit:junit-dep:4.10'
testCompile 'cglib:cglib-nodep:2.2.2' // Used by Spock
testCompile 'org.objenesis:objenesis:1.2' // Used by Spock
}
test {
useJUnit() // Causes "failed to create temp file to extract class from jar into"
}
}
project(':job-dsl-core') {
apply plugin: 'application'
description = "Generates Jenkins jobs via a DSL"
dependencies {
compile 'org.slf4j:slf4j-simple:1.4.3' // For perforce
compile 'commons-codec:commons-codec:1.8' // For perforce
compile 'org.apache.ivy:ivy:2.2.0' // Groovy Optional dependency, needed for @Grab
compile 'xmlunit:xmlunit:1.4' // For runtime use, not just for testing
}
jar {
manifest {
attributes('Main-Class': 'javaposse.jobdsl.Run')
}
}
mainClassName = 'javaposse.jobdsl.Run'
apply plugin: 'gradle-one-jar'
task jarSources(type:Jar){
from sourceSets.main.allSource
classifier = 'sources'
}
task jarJavadocs (type: Jar, dependsOn: 'javadoc') {
from project.javadoc.destinationDir
classifier = 'javadoc'
}
task jarGroovydocs (type: Jar, dependsOn: 'groovydoc') {
from project.groovydoc.destinationDir
classifier = 'groovydoc'
}
task oneJar(type: OneJar) {
mainClass = project.mainClassName
}
artifacts {
archives jarJavadocs
archives jarGroovydocs
archives jarSources
archives oneJar
}
run {
if ( project.hasProperty('args') ) {
args project.args.split('\\s+')
}
}
// gradle-jpi plugin does this for plugins, so we're mimicing it to get our additional artifacts up to repo.jenkinsci.org
gradle.taskGraph.whenReady { taskGraph ->
if ( taskGraph.hasTask(uploadArchives) ) {
uploadArchives {
repositories {
mavenDeployer {
def credentials = loadCredentialsForJenkinsCommunityRepository()
repository(url: 'http://maven.jenkins-ci.org:8081/content/repositories/releases') {
authentication(credentials)
}
snapshotRepository(url: 'http://maven.jenkins-ci.org:8081/content/repositories/snapshots') {
authentication(credentials)
}
}
}
}
}
}
}
private Map loadCredentialsForJenkinsCommunityRepository() {
Properties props = new Properties()
def dot = new File(System.getProperty("user.home"), ".jenkins-ci.org")
if ( ! dot.exists() ) {
throw new Exception("Trying to deploy to Jenkins community repository but there's no credential file ${dot}. See https://wiki.jenkins-ci.org/display/JENKINS/Dot+Jenkins+Ci+Dot+Org")
}
dot.withInputStream { i -> props.load(i) }
return [userName: props["userName"], password: props["password"]]
}
project(':job-dsl-plugin') {
description = "This plugin allows definition of Jobs via a DSL, using existing Jobs as a template."
dependencies {
compile project(':job-dsl-core')
}
}
task wrapper(type: Wrapper) { gradleVersion = '1.8' }
apply from: './job-dsl-plugin/ide.gradle'