-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle
308 lines (265 loc) · 7.27 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.1"
}
}
String gitVersion
if (hasProperty("release")) {
gitVersion = ["git", "describe", "--match", "[0-9]*", "--dirty"].execute().text.trim()
} else {
gitVersion = ["git", "describe", "--match", "[0-9]*", "--abbrev=0"].execute().text.trim() + "-SNAPSHOT"
}
task version {
doLast {
println "Version: ${gitVersion}"
}
}
def ossRelease = hasProperty("oss") || hasProperty("sonatype")
def gradlePluginPortal = hasProperty("oss") || hasProperty("gradle-plugin-portal")
def signArtifacts = ossRelease || hasProperty("sign")
allprojects {
group = "com.prezi.pride"
version = gitVersion
apply plugin: "idea"
}
// Use this Gradle version by default
ext.defaultGradleVersion = "7.0"
subprojects { subproject ->
apply plugin: "maven"
apply plugin: "maven-publish"
apply plugin: "groovy"
description = "Pride manages multiple Gradle modules as a single Gradle project"
sourceCompatibility = 1.6
targetCompatibility = 1.6
tasks.withType(AbstractCompile) {
options.encoding = "UTF-8"
options.compilerArgs << "-Werror" << "-Xlint:all" << "-Xlint:-options" << "-Xlint:-serial"
}
tasks.withType(Javadoc) {
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption 'Xdoclint:none', '-quiet'
}
}
tasks.withType(Upload).all { task -> task.dependsOn "check" }
def generatedIntegTestResourcesDir = file("$buildDir/generated-resources/integTest")
def projectLocationsProperties = file("$generatedIntegTestResourcesDir/project-locations.properties")
task createProjectLocationFile {
inputs.property "projectDir", projectDir
outputs.file projectLocationsProperties
doLast {
mkdir(projectLocationsProperties.parentFile)
def props = [
rootDir: rootDir.path,
projectDir: projectDir.path,
buildDir: buildDir.path,
prideInstallationDir: project(":pride").buildDir.path + "/install/pride",
defaultGradleVersion: defaultGradleVersion
] as Properties
projectLocationsProperties.withOutputStream { props.store(it, "") }
}
}
sourceSets {
test {
output.dir generatedIntegTestResourcesDir, builtBy: createProjectLocationFile
}
integTest {
java.srcDir file('src/integTest/java')
groovy.srcDir file('src/integTest/groovy')
resources.srcDir file('src/integTest/resources')
}
}
dependencies {
integTestCompile sourceSets.main.output
integTestCompile configurations.testCompile
integTestCompile sourceSets.test.output
integTestRuntime configurations.runtime
}
task integTest(type: Test) {
shouldRunAfter test
testClassesDirs = sourceSets.integTest.output.classesDirs
classpath = sourceSets.integTest.runtimeClasspath
}
check.dependsOn integTest
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://repo.gradle.org/gradle/libs-releases"
}
maven {
url "https://repo.gradle.org/gradle/libs-snapshots"
}
}
dependencies {
testCompile "junit:junit:4.11"
testCompile("org.spockframework:spock-core:0.7-groovy-2.0") {
exclude group: "org.codehaus.groovy"
}
testCompile localGroovy()
testRuntime "org.slf4j:slf4j-simple:1.7.7"
}
task javadocJar(type: Jar) {
dependsOn javadoc
classifier = "javadoc"
from "build/docs/javadoc"
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = "sources"
}
jar {
from rootProject.file("LICENSE.txt")
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar
pom {
url = "http://github.com/prezi/pride"
name = subproject.name
description = subproject.description
scm {
url = "scm:[email protected]:prezi/pride.git"
connection = "scm:[email protected]:prezi/pride.git"
developerConnection = "scm:[email protected]:prezi/pride.git"
}
licenses {
license {
name = "The Apache Software License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
developers {
developer {
id = "lptr"
name = "Lorant Pinter"
}
developer {
id = "rosadam"
name = "Adam Rosenberger"
}
}
}
}
}
repositories {
maven {
def isSnapshot = version.endsWith('SNAPSHOT')
if (ossRelease) {
credentials {
username = project.getProperty("sonatypeUsername")
password = project.getProperty("sonatypePassword")
}
url = isSnapshot ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
} else if (project.hasProperty("nexusUser") && project.hasProperty("nexusPassword")) {
credentials {
username = project.getProperty("nexusUser")
password = project.getProperty("nexusPassword")
}
def baseRepoUrl = "https://artifactory.prezi.com/artifactory"
url = isSnapshot ? "${baseRepoUrl}/plugins-snapshot-local/" : "${baseRepoUrl}/plugins-release-local/"
}
}
}
}
if (signArtifacts) {
apply plugin: "signing"
signing {
sign publishing.publications.mavenJava
}
}
processResources {
inputs.property "version", version
filter org.apache.tools.ant.filters.ReplaceTokens, tokens: [
version: version
]
}
}
project("pride-core") {
dependencies {
compile "commons-configuration:commons-configuration:1.10", {
exclude group: "commons-logging"
}
compile "commons-lang:commons-lang:2.6"
compile "commons-codec:commons-codec:1.9"
compile "commons-io:commons-io:2.4"
compile "com.google.guava:guava:17.0"
compile "org.slf4j:jcl-over-slf4j:1.7.7"
}
}
project("pride-git-support") {
dependencies {
compile project(path: ":pride-core")
}
}
project("pride-svn-support") {
dependencies {
compile project(path: ":pride-core")
}
}
project("pride") {
apply plugin: "application"
mainClassName = "com.prezi.pride.cli.PrideCli"
dependencies {
compile project(path: ":pride-core")
compile "org.gradle:gradle-tooling-api:${defaultGradleVersion}"
compile "io.airlift:airline:0.6"
compile "ch.qos.logback:logback-classic:1.1.2"
runtime project(path: ":pride-git-support")
runtime project(path: ":pride-svn-support")
}
install { dependsOn installDist }
configure(applicationDistribution) {
from(rootProject.file("README.md")) {
into "/"
}
from(rootProject.file("LICENSE.txt")) {
into "/"
}
}
distTar {
compression Compression.GZIP
extension "tar.gz"
}
publishing.publications.mavenJava {
artifact distTar
artifact distZip
}
}
project("gradle-pride-plugin") {
dependencies {
compile gradleApi()
compile project(":pride-core")
compile "com.google.guava:guava:17.0"
}
if (gradlePluginPortal) {
apply plugin: "com.gradle.plugin-publish"
pluginBundle {
website = "https://github.com/prezi/pride"
vcsUrl = "https://github.com/prezi/pride.git"
tags = ["gradle", "pride", "git", "svn", "dynamic dependencies"]
plugins {
pridePlugin {
id = "com.prezi.pride"
displayName = "Pride plugin"
description = "Pride manages multiple Gradle modules as a single Gradle project"
}
}
}
uploadArchives.dependsOn publishPlugins
}
}
project("gradle-pride-projectmodel-plugin") {
dependencies {
compile gradleApi()
compile project(":pride-core")
}
}