forked from rundeck/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
185 lines (167 loc) · 6.77 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/**
* Rundeck Master-Build Project
*
* This project does not contain any buildable code and does not generate any
* artifacts, however it allows us to set defaults for the subjects and provides
* Groovy syntax highlighting for gradle build files (like this one)
**/
import org.gradle.plugins.signing.Sign
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.adaptc.gradle:nexus-workflow:0.5'
}
}
description = 'The master-build project for Rundeck';
apply plugin: 'nexus-workflow'
apply plugin: 'eclipse';
apply plugin: 'idea'
eclipse.project.name = 'rundeck'
ext.exportedProjects = [
":core",
":rundeck-storage:rundeck-storage-api",
":rundeck-storage:rundeck-storage-data",
":rundeck-storage:rundeck-storage-filesys",
":rundeck-storage:rundeck-storage-conf"
]
/**
* Defaults for all projects
*/
subprojects {
// set the eclipse project naming convention to rundeck:<path>:<projectName>
// so it matches the logical hierarchy more closely
apply from: "${rootDir}/gradle/java.gradle"
apply plugin: 'eclipse'
eclipse.project.name = "${project.getParent().eclipse.project.name}:${name}"
// the environment can be set by adding -Penvironment={value} as a command
// line switch. by default we run as 'development'
ext.environment = project.hasProperty('environment') ? environment : 'development';
// Unless we're doing a release build, append -SNAPSHOT to the end of the
// artifacts. Otherwise use the currentVersion as defined in gradle.properties and
// the releaseTag if it is not 'GA'
def vtag = environment != 'release' ? '-SNAPSHOT' : (project.hasProperty('releaseTag') && releaseTag!='GA' ? '-'+releaseTag : '')
version = currentVersion + vtag
ext.isReleaseBuild = false
ext.isSnapshotBuild = false
ext.isDevBuild = false
if(project.hasProperty('environment') && project.environment == 'release'){
ext.isReleaseBuild=true
}else if(project.hasProperty("snapshot")){
ext.isSnapshotBuild=true
}else{
ext.isDevBuild=true
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
// prompt for PGP key passphrase if not set
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign } && project.hasProperty("signing.keyId") && !project.hasProperty
("signing.password") && !isDevBuild) {
// Use Java 6's console to read from the console (no good for a CI environment)
Console console = System.console()
console.printf "\n\nWe have to sign some things in this build.\n\nPlease enter your signing details.\n\n"
//def id = console.readLine("PGP Key Id: ")
//def file = console.readLine("PGP Secret Key Ring File (absolute path): ")
def password = console.readPassword("PGP Private Key Password: ")
//allprojects { ext."signing.keyId" = id }
//allprojects { ext."signing.secretKeyRingFile" = file }
allprojects { ext."signing.password" = password }
console.printf "\nThanks.\n\n"
}
}
//subproject libs that are uploaded to maven central
exportedProjects.each {
project(it) {
apply plugin: 'signing'
//********* artifact signing *********
if (isReleaseBuild && project.hasProperty("signing.keyId")) {
signing {
sign configurations.archives
}
} else {
task signArchives {
// do nothing
}
}
def archiveName=project.name.startsWith('rundeck-')?project.name: "rundeck-${project.name}"
//build a pom we reuse for both maven builds and release to sonatype
ext.publishPom = pom {
project {
artifactId archiveName
groupId project.group
inceptionYear '2014'
packaging 'jar'
version version
name "Rundeck library ${project.name}"
description project.description?:'Rundeck'
url 'http://rundeck.org'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/rundeck/rundeck'
connection 'scm:git:[email protected]/rundeck/rundeck.git'
developerConnection 'scm:git:[email protected]:rundeck/rundeck.git'
}
developers {
developer {
id('gschueler')
name('Greg Schueler')
email('[email protected]')
}
}
parent {
groupId('org.sonatype.oss')
artifactId('oss-parent')
version('7')
}
}
}
uploadArchives {
if (isDevBuild) {
repositories {
repositories.mavenDeployer {
configuration = configurations.archives
pom = project.publishPom
}
}
} else {
repositories.mavenDeployer {
if (isReleaseBuild) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
configuration = configurations.archives
if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) {
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
pom = project.publishPom
}
}
}
//utility to create a pom for building
if(project.name!='core'){
//:core buildfile will generate its own pom for specialized purpose
task createPom << {
publishPom.writeTo("pom.xml")
}
}
}
}
task alljavadoc(type: Javadoc) {
source exportedProjects.collect { project(it).sourceSets.main.allJava }
classpath = files(exportedProjects.collect { project(it).sourceSets.main.compileClasspath })
destinationDir = file("${buildDir}/docs/javadoc")
}