forked from jenkinsci/job-dsl-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
149 lines (123 loc) · 4.17 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.github.rholder:gradle-one-jar:1.0.4'
classpath 'org.ajoberstar:gradle-git:0.9.0'
}
}
defaultTasks 'build' // for BuildHive
subprojects {
group = 'org.jenkins-ci.plugins'
apply plugin: 'groovy'
apply plugin: 'maven' // for publishing
apply plugin: 'codenarc'
sourceCompatibility = 1.6
targetCompatibility = 1.6
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
}
codenarc {
toolVersion = '0.22'
configFile = file('../config/codenarc/rules.groovy')
}
codenarcTest {
configFile = file('../config/codenarc/rules-test.groovy')
}
}
project(':job-dsl-core') {
repositories {
mavenCentral()
maven {
url('http://maven.jenkins-ci.org/content/repositories/releases')
}
}
apply plugin: 'application'
apply plugin: 'gradle-one-jar'
description = 'Generates Jenkins jobs via a DSL'
mainClassName = 'javaposse.jobdsl.Run'
dependencies {
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
compile 'org.jenkins-ci:version-number:1.1'
compile 'org.jvnet.hudson:xstream:1.4.4-jenkins-3'
}
jar {
manifest {
attributes 'Main-Class': project.mainClassName
}
}
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 mimicking 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() {
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")
}
Properties props = new Properties()
dot.withInputStream { i -> props.load(i) }
[userName: props.userName, password: props.password]
}
task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}
apply plugin: 'github-pages'
githubPages {
commitMessage = "updated wiki for $version"
repoUri = '[email protected]:jenkinsci/job-dsl-plugin.wiki.git'
targetBranch = 'master'
workingPath = "$buildDir/wiki"
pages {
from 'docs'
}
}