Skip to content

Commit 3589caf

Browse files
Merge pull request #341 from quidryan/update-gradle-wrapper-Aug2013
Update gradle wrapper to latest
2 parents ee94970 + adb3345 commit 3589caf

File tree

11 files changed

+131
-105
lines changed

11 files changed

+131
-105
lines changed

build.gradle

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1+
2+
ext.githubProjectName = 'RxJava'
3+
14
apply from: file('gradle/convention.gradle')
25
apply from: file('gradle/maven.gradle')
36
//apply from: file('gradle/check.gradle')
47
apply from: file('gradle/license.gradle')
58
apply from: file('gradle/release.gradle')
69

7-
ext.githubProjectName = rootProject.name
8-
910
buildscript {
10-
repositories { mavenCentral() }
11+
repositories {
12+
mavenLocal()
13+
mavenCentral() // maven { url 'http://jcenter.bintray.com' }
14+
}
1115
apply from: file('gradle/buildscript.gradle'), to: buildscript
1216
}
1317

1418
allprojects {
15-
repositories { mavenCentral() }
19+
repositories {
20+
mavenLocal()
21+
mavenCentral() // maven { url: 'http://jcenter.bintray.com' }
22+
}
1623
}
1724

18-
1925
subprojects {
2026
apply plugin: 'java'
2127
apply plugin: 'eclipse'
@@ -66,4 +72,3 @@ subprojects {
6672
project(':rxjava-core') {
6773
sourceSets.test.java.srcDir 'src/test/java'
6874
}
69-

codequality/checkstyle.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
<!-- Checks for common coding problems -->
129129
<!-- See http://checkstyle.sf.net/config_coding.html -->
130130
<!-- <module name="AvoidInlineConditionals"/> -->
131-
<module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
132131
<module name="EmptyStatement"/>
133132
<module name="EqualsHashCode"/>
134133
<module name="HiddenField">

gradle/buildscript.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// Executed in context of buildscript
22
repositories {
33
// Repo in addition to maven central
4-
maven {
5-
name 'build-repo'
6-
url 'https://raw.github.com/Netflix-Skunkworks/build-repo/master/releases/' // gradle-release/gradle-release/1.0-SNAPSHOT/gradle-release-1.0-SNAPSHOT.jar
7-
}
4+
repositories { maven { url 'http://dl.bintray.com/content/netflixoss/external-gradle-plugins/' } } // For gradle-release
85
}
96
dependencies {
10-
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.0'
7+
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.1'
118
classpath 'com.mapvine:gradle-cobertura-plugin:0.1'
12-
classpath 'gradle-release:gradle-release:1.0-SNAPSHOT'
9+
classpath 'gradle-release:gradle-release:1.1.5'
10+
classpath 'org.ajoberstar:gradle-git:0.5.0'
1311
}

gradle/check.gradle

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
subprojects {
2-
// Checkstyle
3-
apply plugin: 'checkstyle'
4-
tasks.withType(Checkstyle) { ignoreFailures = true }
5-
checkstyle {
6-
ignoreFailures = true // Waiting on GRADLE-2163
7-
configFile = rootProject.file('codequality/checkstyle.xml')
8-
}
2+
// Checkstyle
3+
apply plugin: 'checkstyle'
4+
checkstyle {
5+
ignoreFailures = true
6+
configFile = rootProject.file('codequality/checkstyle.xml')
7+
}
98

10-
// FindBugs
11-
apply plugin: 'findbugs'
12-
//tasks.withType(Findbugs) { reports.html.enabled true }
9+
// FindBugs
10+
apply plugin: 'findbugs'
11+
findbugs {
12+
ignoreFailures = true
13+
}
1314

14-
// PMD
15-
apply plugin: 'pmd'
16-
//tasks.withType(Pmd) { reports.html.enabled true }
15+
// PMD
16+
apply plugin: 'pmd'
17+
//tasks.withType(Pmd) { reports.html.enabled true }
1718

18-
apply plugin: 'cobertura'
19-
cobertura {
20-
sourceDirs = sourceSets.main.java.srcDirs
21-
format = 'html'
22-
includes = ['**/*.java', '**/*.groovy']
23-
excludes = []
24-
}
19+
apply plugin: 'cobertura'
20+
cobertura {
21+
sourceDirs = sourceSets.main.java.srcDirs
22+
format = 'html'
23+
includes = ['**/*.java', '**/*.groovy']
24+
excludes = []
25+
}
2526
}

gradle/convention.gradle

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
2-
// For Artifactory
3-
rootProject.status = version.contains('-SNAPSHOT')?'snapshot':'release'
1+
// GRADLE-2087 workaround, perform after java plugin
2+
status = project.hasProperty('preferredStatus')?project.preferredStatus:(version.contains('SNAPSHOT')?'snapshot':'release')
43

54
subprojects { project ->
65
apply plugin: 'java' // Plugin as major conventions
76

8-
version = rootProject.version
9-
107
sourceCompatibility = 1.6
118

12-
// GRADLE-2087 workaround, perform after java plugin
9+
// Restore status after Java plugin
1310
status = rootProject.status
1411

1512
task sourcesJar(type: Jar, dependsOn:classes) {
@@ -51,9 +48,6 @@ subprojects { project ->
5148
}
5249
}
5350

54-
// Ensure output is on a new line
55-
javadoc.doFirst { println "" }
56-
5751
configurations {
5852
provided {
5953
description = 'much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive.'
@@ -70,14 +64,38 @@ subprojects { project ->
7064
}
7165
}
7266

73-
task aggregateJavadoc(type: Javadoc) {
74-
description = 'Aggregate all subproject docs into a single docs directory'
75-
source subprojects.collect {project -> project.sourceSets.main.allJava }
76-
classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath})
77-
destinationDir = new File(projectDir, 'doc')
67+
apply plugin: 'github-pages' // Used to create publishGhPages task
68+
69+
def docTasks = [:]
70+
[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass ->
71+
def allSources = allprojects.tasks*.withType(docClass).flatten()*.source
72+
if (allSources) {
73+
def shortName = docClass.simpleName.toLowerCase()
74+
def docTask = task "aggregate${shortName.capitalize()}"(type: docClass, description: "Aggregate subproject ${shortName}s") {
75+
source = allSources
76+
destinationDir = file("${project.buildDir}/docs/${shortName}")
77+
doFirst {
78+
def classpaths = allprojects.findAll { it.plugins.hasPlugin(JavaPlugin) }.collect { it.sourceSets.main.compileClasspath }
79+
classpath = files(classpaths)
80+
}
81+
}
82+
docTasks[shortName] = docTask
83+
processGhPages.dependsOn(docTask)
84+
}
85+
}
86+
87+
githubPages {
88+
repoUri = "[email protected]:Netflix/${rootProject.githubProjectName}.git"
89+
pages {
90+
docTasks.each { shortName, docTask ->
91+
from(docTask.outputs.files) {
92+
into "docs/${shortName}"
93+
}
94+
}
95+
}
7896
}
7997

8098
// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle
8199
task createWrapper(type: Wrapper) {
82-
gradleVersion = '1.1'
100+
gradleVersion = '1.6'
83101
}

gradle/license.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ apply plugin: 'license' //nl.javadude.gradle.plugins.license.LicensePlugin
55
license {
66
header rootProject.file('codequality/HEADER')
77
ext.year = Calendar.getInstance().get(Calendar.YEAR)
8+
skipExistingHeaders true
89
}
910
}

gradle/maven.gradle

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,29 @@ subprojects {
88
sign configurations.archives
99
}
1010

11-
/**
12-
* Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
13-
*/
14-
task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
15-
configuration = configurations.archives
16-
doFirst {
17-
repositories.mavenDeployer {
18-
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }
11+
/**
12+
* Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
13+
* artifactory will execute uploadArchives to force generation of ivy.xml, and we don't want that to trigger an upload to maven
14+
* central, so using custom upload task.
15+
*/
16+
task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
17+
configuration = configurations.archives
18+
onlyIf { ['release', 'snapshot'].contains(project.status) }
19+
repositories.mavenDeployer {
20+
beforeDeployment { signing.signPom(it) }
1921

2022
// To test deployment locally, use the following instead of oss.sonatype.org
2123
//repository(url: "file://localhost/${rootProject.rootDir}/repo")
2224

25+
def sonatypeUsername = rootProject.hasProperty('sonatypeUsername')?rootProject.sonatypeUsername:''
26+
def sonatypePassword = rootProject.hasProperty('sonatypePassword')?rootProject.sonatypePassword:''
27+
2328
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
24-
authentication(userName: rootProject.sonatypeUsername, password: rootProject.sonatypePassword)
29+
authentication(userName: sonatypeUsername, password: sonatypePassword)
30+
}
31+
32+
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
33+
authentication(userName: sonatypeUsername, password: sonatypePassword)
2534
}
2635

2736
// Prevent datastamp from being appending to artifacts during deployment
@@ -58,5 +67,4 @@ subprojects {
5867
}
5968
}
6069
}
61-
}
6270
}

gradle/release.gradle

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,61 @@
11
apply plugin: 'release'
22

3-
// Ignore release plugin's task because it calls out via GradleBuild. This is a good place to put an email to send out
4-
task release(overwrite: true, dependsOn: commitNewVersion) << {
5-
// This is a good place to put an email to send out
6-
}
7-
commitNewVersion.dependsOn updateVersion
8-
updateVersion.dependsOn createReleaseTag
9-
createReleaseTag.dependsOn preTagCommit
10-
def buildTasks = tasks.matching { it.name =~ /:build/ }
11-
preTagCommit.dependsOn buildTasks
12-
preTagCommit.dependsOn checkSnapshotDependencies
13-
//checkSnapshotDependencies.dependsOn confirmReleaseVersion // Introduced in 1.0, forces readLine
14-
//confirmReleaseVersion.dependsOn unSnapshotVersion
15-
checkSnapshotDependencies.dependsOn unSnapshotVersion // Remove once above is fixed
16-
unSnapshotVersion.dependsOn checkUpdateNeeded
17-
checkUpdateNeeded.dependsOn checkCommitNeeded
18-
checkCommitNeeded.dependsOn initScmPlugin
19-
20-
[
21-
uploadIvyLocal: 'uploadLocal',
22-
uploadArtifactory: 'artifactoryPublish', // Call out to compile against internal repository
23-
buildWithArtifactory: 'build' // Build against internal repository
24-
].each { key, value ->
3+
[ uploadIvyLocal: 'uploadLocal', uploadArtifactory: 'artifactoryPublish', buildWithArtifactory: 'build' ].each { key, value ->
254
// Call out to compile against internal repository
265
task "${key}"(type: GradleBuild) {
276
startParameter = project.gradle.startParameter.newInstance()
7+
doFirst {
8+
startParameter.projectProperties = [status: project.status, preferredStatus: project.status]
9+
}
2810
startParameter.addInitScript( file('gradle/netflix-oss.gradle') )
2911
startParameter.getExcludedTaskNames().add('check')
3012
tasks = [ 'build', value ]
3113
}
3214
}
33-
task releaseArtifactory(dependsOn: [checkSnapshotDependencies, uploadArtifactory])
3415

35-
// Ensure upload happens before taggging but after all pre-checks
36-
releaseArtifactory.dependsOn checkSnapshotDependencies
37-
createReleaseTag.dependsOn releaseArtifactory
38-
gradle.taskGraph.whenReady { taskGraph ->
39-
if ( taskGraph.hasTask(uploadArtifactory) && rootProject.status == 'release' && !taskGraph.hasTask(':release') ) {
40-
throw new GradleException('"release" task has to be run before uploading a release to Artifactory')
16+
// Marker task for following code to key in on
17+
task releaseCandidate(dependsOn: release)
18+
task forceCandidate {
19+
onlyIf { gradle.taskGraph.hasTask(releaseCandidate) }
20+
doFirst { project.status = 'candidate' }
21+
}
22+
task forceRelease {
23+
onlyIf { !gradle.taskGraph.hasTask(releaseCandidate) }
24+
doFirst { project.status = 'release' }
25+
}
26+
release.dependsOn([forceCandidate, forceRelease])
27+
28+
task uploadMavenCentral(dependsOn: subprojects.tasks.uploadMavenCentral)
29+
task releaseSnapshot(dependsOn: [uploadArtifactory, uploadMavenCentral])
30+
31+
// Ensure our versions look like the project status before publishing
32+
task verifyStatus << {
33+
def hasSnapshot = version.contains('-SNAPSHOT')
34+
if (project.status == 'snapshot' && !hasSnapshot) {
35+
throw new GradleException("Version (${version}) needs -SNAPSHOT if publishing snapshot")
4136
}
4237
}
43-
subprojects.each { project ->
44-
project.uploadMavenCentral.dependsOn rootProject.checkSnapshotDependencies
45-
rootProject.createReleaseTag.dependsOn project.uploadMavenCentral
38+
uploadArtifactory.dependsOn(verifyStatus)
39+
uploadMavenCentral.dependsOn(verifyStatus)
4640

47-
gradle.taskGraph.whenReady { taskGraph ->
48-
if ( taskGraph.hasTask(project.uploadMavenCentral) && !taskGraph.hasTask(':release') ) {
49-
throw new GradleException('"release" task has to be run before uploading to Maven Central')
50-
}
41+
// Ensure upload happens before taggging, hence upload failures will leave repo in a revertable state
42+
preTagCommit.dependsOn([uploadArtifactory, uploadMavenCentral])
43+
44+
45+
gradle.taskGraph.whenReady { taskGraph ->
46+
def hasRelease = taskGraph.hasTask('commitNewVersion')
47+
def indexOf = { return taskGraph.allTasks.indexOf(it) }
48+
49+
if (hasRelease) {
50+
assert indexOf(build) < indexOf(unSnapshotVersion), 'build target has to be after unSnapshotVersion'
51+
assert indexOf(uploadMavenCentral) < indexOf(preTagCommit), 'preTagCommit has to be after uploadMavenCentral'
52+
assert indexOf(uploadArtifactory) < indexOf(preTagCommit), 'preTagCommit has to be after uploadArtifactory'
5153
}
5254
}
5355

5456
// Prevent plugin from asking for a version number interactively
5557
ext.'gradle.release.useAutomaticVersion' = "true"
5658

5759
release {
58-
// http://tellurianring.com/wiki/gradle/release
59-
failOnCommitNeeded=true
60-
failOnPublishNeeded=true
61-
failOnUnversionedFiles=true
62-
failOnUpdateNeeded=true
63-
includeProjectNameInTag=true
64-
requireBranch = null
60+
git.requireBranch = null
6561
}

gradle/wrapper/gradle-wrapper.jar

4.27 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Tue Aug 14 16:28:54 PDT 2012
1+
#Tue Sep 03 10:20:57 PDT 2013
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)