Skip to content
Browse files

Merge branch 'multi-project' of github.com:Netflix/gradle-template

  • Loading branch information...
2 parents e8173c2 + b7847eb commit 5d95b28d41baf94619c716d0be6035b3eb710c1d @Randgalt Randgalt committed Mar 16, 2013
Showing with 69 additions and 23 deletions.
  1. +3 −2 gradle/buildscript.gradle
  2. +43 −5 gradle/convention.gradle
  3. +10 −1 gradle/maven.gradle
  4. +13 −15 gradle/release.gradle
View
5 gradle/buildscript.gradle
@@ -1,12 +1,13 @@
// Executed in context of buildscript
repositories {
+ // Repo in addition to maven central
maven {
name 'build-repo'
- url 'https://github.com/Netflix-Skunkworks/build-repo/raw/master/releases/'
+ url 'https://raw.github.com/Netflix-Skunkworks/build-repo/master/releases/' // gradle-release/gradle-release/1.0-SNAPSHOT/gradle-release-1.0-SNAPSHOT.jar
}
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.0'
classpath 'com.mapvine:gradle-cobertura-plugin:0.1'
classpath 'gradle-release:gradle-release:1.0-SNAPSHOT'
-}
+}
View
48 gradle/convention.gradle
@@ -13,22 +13,60 @@ subprojects { project ->
status = rootProject.status
task sourcesJar(type: Jar, dependsOn:classes) {
- classifier = 'sources'
from sourceSets.main.allSource
+ classifier 'sources'
+ extension 'jar'
}
task javadocJar(type: Jar, dependsOn:javadoc) {
- classifier = 'javadoc'
from javadoc.destinationDir
+ classifier 'javadoc'
+ extension 'jar'
+ }
+
+ configurations.add('sources')
+ configurations.add('javadoc')
+ configurations.archives {
+ extendsFrom configurations.sources
+ extendsFrom configurations.javadoc
+ }
+
+ // When outputing to an Ivy repo, we want to use the proper type field
+ gradle.taskGraph.whenReady {
+ def isNotMaven = !it.hasTask(project.uploadMavenCentral)
+ if (isNotMaven) {
+ def artifacts = project.configurations.sources.artifacts
+ def sourceArtifact = artifacts.iterator().next()
+ sourceArtifact.type = 'sources'
+ }
+ }
+
+ artifacts {
+ sources(sourcesJar) {
+ // Weird Gradle quirk where type will be used for the extension, but only for sources
+ type 'jar'
+ }
+ javadoc(javadocJar) {
+ type 'javadoc'
+ }
}
// Ensure output is on a new line
javadoc.doFirst { println "" }
+ configurations {
+ provided {
+ 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.'
+ transitive = true
+ visible = true
+ }
+ }
- artifacts {
- archives sourcesJar
- archives javadocJar
+ project.sourceSets {
+ main.compileClasspath += project.configurations.provided
+ main.runtimeClasspath -= project.configurations.provided
+ test.compileClasspath += project.configurations.provided
+ test.runtimeClasspath += project.configurations.provided
}
}
View
11 gradle/maven.gradle
@@ -29,6 +29,15 @@ subprojects {
// Closure to configure all the POM with extra info, common to all projects
pom.project {
+ name "${project.name}"
+ description "${project.name} developed by Netflix"
+ developers {
+ developer {
+ id 'netflixgithub'
+ name 'Netflix Open Source Development'
+ email 'talent@netflix.com'
+ }
+ }
licenses {
license {
name 'The Apache Software License, Version 2.0'
@@ -60,4 +69,4 @@ subprojects {
}
}
}
-}
+}
View
28 gradle/release.gradle
@@ -17,23 +17,21 @@ unSnapshotVersion.dependsOn checkUpdateNeeded
checkUpdateNeeded.dependsOn checkCommitNeeded
checkCommitNeeded.dependsOn initScmPlugin
-// Call out to compile against internal repository
-task uploadArtifactory(type: GradleBuild) {
- startParameter = project.gradle.startParameter.newInstance()
- startParameter.addInitScript( file('gradle/netflix-oss.gradle') )
- startParameter.getExcludedTaskNames().add('check')
- tasks = [ 'build', 'artifactoryPublish' ]
+[
+ uploadIvyLocal: 'uploadLocal',
+ uploadArtifactory: 'artifactoryPublish', // Call out to compile against internal repository
+ buildWithArtifactory: 'build' // Build against internal repository
+].each { key, value ->
+ // Call out to compile against internal repository
+ task "${key}"(type: GradleBuild) {
+ startParameter = project.gradle.startParameter.newInstance()
+ startParameter.addInitScript( file('gradle/netflix-oss.gradle') )
+ startParameter.getExcludedTaskNames().add('check')
+ tasks = [ 'build', value ]
+ }
}
task releaseArtifactory(dependsOn: [checkSnapshotDependencies, uploadArtifactory])
-
-task buildWithArtifactory(type: GradleBuild) {
- startParameter = project.gradle.startParameter.newInstance()
- startParameter.addInitScript( file('gradle/netflix-oss.gradle') )
- startParameter.getExcludedTaskNames().add('check')
- tasks = [ 'build' ]
-}
-
// Ensure upload happens before taggging but after all pre-checks
releaseArtifactory.dependsOn checkSnapshotDependencies
createReleaseTag.dependsOn releaseArtifactory
@@ -64,4 +62,4 @@ release {
failOnUpdateNeeded=true
includeProjectNameInTag=true
requireBranch = null
-}
+}

0 comments on commit 5d95b28

Please sign in to comment.
Something went wrong with that request. Please try again.