Browse Source

Build upgrades

pull/130/head
Rob Spieldenner 10 years ago
parent
commit
44b253e719
  1. 0
      CHANGELOG.md
  2. 157
      build.gradle
  3. 13
      codequality/HEADER
  4. 15
      core/build.gradle
  5. 4
      dagger.gradle
  6. 6
      example-github/build.gradle
  7. 6
      example-wikipedia/build.gradle
  8. 1
      gradle.properties
  9. 11
      gradle/buildscript.gradle
  10. 26
      gradle/check.gradle
  11. 101
      gradle/convention.gradle
  12. 10
      gradle/license.gradle
  13. 70
      gradle/maven.gradle
  14. 1
      gradle/netflix-oss.gradle
  15. 61
      gradle/release.gradle
  16. 13
      gson/build.gradle
  17. 14
      jackson/build.gradle
  18. 11
      jaxb/build.gradle
  19. 15
      jaxrs/build.gradle
  20. 14
      ribbon/build.gradle
  21. 13
      sax/build.gradle
  22. 12
      slf4j/build.gradle

0
CHANGES.md → CHANGELOG.md

157
build.gradle

@ -1,156 +1,17 @@ @@ -1,156 +1,17 @@
// Establish version and status
ext.githubProjectName = rootProject.name // Change if github project name is not the same as the root project's name
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
apply from: file('gradle/buildscript.gradle'), to: buildscript
}
allprojects {
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet') // Doclint is onerous in Java 8.
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/releases/' }
}
plugins {
id 'nebula.netflixoss' version '2.2.2'
}
apply from: file('gradle/convention.gradle')
apply from: file('gradle/maven.gradle')
if (!JavaVersion.current().isJava8Compatible()) {
apply from: file('gradle/check.gradle') // FindBugs is incompatible with Java 8.
ext {
githubProjectName = rootProject.name // Change if github project name is not the same as the root project's name
}
apply from: file('gradle/license.gradle')
apply from: file('gradle/release.gradle')
apply plugin: 'idea'
subprojects {
apply from: rootProject.file('dagger.gradle')
group = "com.netflix.${githubProjectName}" // TEMPLATE: Set to organization of project
}
project(':feign-core') {
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
testCompile 'com.google.guava:guava:14.0.1'
testCompile 'com.google.code.gson:gson:2.2.4'
testCompile 'com.fasterxml.jackson.core:jackson-databind:2.2.2'
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.mockwebserver:mockwebserver:20130706'
}
}
project(':feign-sax') {
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
testCompile 'com.google.guava:guava:14.0.1'
testCompile 'org.testng:testng:6.8.5'
}
}
project(':feign-gson') {
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'com.google.code.gson:gson:2.2.4'
testCompile 'org.testng:testng:6.8.5'
}
}
project(':feign-jackson') {
apply plugin: 'java'
apply plugin: 'nebula.netflixoss'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.2'
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.guava:guava:14.0.1'
}
}
project(':feign-jaxb') {
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.guava:guava:14.0.1'
}
}
project(':feign-jaxrs') {
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'javax.ws.rs:jsr311-api:1.1.1'
testCompile project(':feign-gson')
testCompile 'com.google.guava:guava:14.0.1'
testCompile 'org.testng:testng:6.8.5'
}
}
project(':feign-ribbon') {
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'com.netflix.ribbon:ribbon-loadbalancer:2.0-RC5'
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.mockwebserver:mockwebserver:20130706'
}
}
project(':feign-slf4j') {
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'org.slf4j:slf4j-api:1.7.5'
testCompile 'org.testng:testng:6.8.5'
testCompile 'org.slf4j:slf4j-simple:1.7.5'
repositories {
jcenter()
}
apply from: rootProject.file('dagger.gradle')
group = "com.netflix.${githubProjectName}" // TEMPLATE: Set to organization of project
}

13
codequality/HEADER

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
Copyright ${year} Netflix, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

15
core/build.gradle

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
apply plugin: 'java'
sourceCompatibility = 1.6
test {
useTestNG()
}
dependencies {
testCompile 'com.google.guava:guava:14.0.1'
testCompile 'com.google.code.gson:gson:2.2.4'
testCompile 'com.fasterxml.jackson.core:jackson-databind:2.2.2'
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.mockwebserver:mockwebserver:20130706'
}

4
dagger.gradle

@ -92,7 +92,7 @@ rootProject.idea.project.ipr.withXml { projectXml -> @@ -92,7 +92,7 @@ rootProject.idea.project.ipr.withXml { projectXml ->
tasks.ideaModule.dependsOn(prepareAnnotationGeneratedSourceDirs)
idea.module {
scopes.PROVIDED.plus += project.configurations.daggerCompiler
scopes.PROVIDED.plus += [project.configurations.daggerCompiler]
iml.withXml { xml->
def moduleSource = xml.asNode().component.find { it.@name = 'NewModuleRootManager' }.content[0]
moduleSource.appendNode('sourceFolder', [url: "file://\$MODULE_DIR\$/${relativePath(annotationGeneratedSources)}", isTestSource: false])
@ -103,7 +103,7 @@ idea.module { @@ -103,7 +103,7 @@ idea.module {
tasks.eclipseClasspath.dependsOn(prepareAnnotationGeneratedSourceDirs)
eclipse.classpath {
plusConfigurations += project.configurations.daggerCompiler
plusConfigurations += [project.configurations.daggerCompiler]
}
tasks.eclipseClasspath {

6
example-github/build.gradle

@ -1,5 +1,11 @@ @@ -1,5 +1,11 @@
plugins {
id 'nebula.provided-base' version '2.0.1'
}
apply plugin: 'java'
sourceCompatibility = 1.6
dependencies {
compile 'com.netflix.feign:feign-core:5.3.0'
compile 'com.netflix.feign:feign-gson:5.3.0'

6
example-wikipedia/build.gradle

@ -1,5 +1,11 @@ @@ -1,5 +1,11 @@
plugins {
id 'nebula.provided-base' version '2.0.1'
}
apply plugin: 'java'
sourceCompatibility = 1.6
dependencies {
compile 'com.netflix.feign:feign-core:5.3.0'
compile 'com.netflix.feign:feign-gson:5.3.0'

1
gradle.properties

@ -1 +0,0 @@ @@ -1 +0,0 @@
version=7.0.0-SNAPSHOT

11
gradle/buildscript.gradle

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
// Executed in context of buildscript
repositories {
// Repo in addition to maven central
repositories { maven { url 'http://dl.bintray.com/content/netflixoss/external-gradle-plugins/' } } // For gradle-release
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.1'
classpath 'com.mapvine:gradle-cobertura-plugin:0.1'
classpath 'gradle-release:gradle-release:1.1.5'
classpath 'org.ajoberstar:gradle-git:0.5.0'
}

26
gradle/check.gradle

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
subprojects {
// Checkstyle
apply plugin: 'checkstyle'
checkstyle {
ignoreFailures = true
configFile = rootProject.file('codequality/checkstyle.xml')
}
// FindBugs
apply plugin: 'findbugs'
findbugs {
ignoreFailures = true
}
// PMD
apply plugin: 'pmd'
//tasks.withType(Pmd) { reports.html.enabled true }
apply plugin: 'cobertura'
cobertura {
sourceDirs = sourceSets.main.java.srcDirs
format = 'html'
includes = ['**/*.java', '**/*.groovy']
excludes = []
}
}

101
gradle/convention.gradle

@ -1,101 +0,0 @@ @@ -1,101 +0,0 @@
// GRADLE-2087 workaround, perform after java plugin
status = project.hasProperty('preferredStatus')?project.preferredStatus:(version.contains('SNAPSHOT')?'snapshot':'release')
subprojects { project ->
apply plugin: 'java' // Plugin as major conventions
sourceCompatibility = 1.6
// Restore status after Java plugin
status = rootProject.status
task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource
classifier 'sources'
extension 'jar'
}
task javadocJar(type: Jar, dependsOn: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'
}
}
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
}
}
project.sourceSets {
main.compileClasspath += project.configurations.provided
main.runtimeClasspath -= project.configurations.provided
test.compileClasspath += project.configurations.provided
test.runtimeClasspath += project.configurations.provided
}
}
apply plugin: 'github-pages' // Used to create publishGhPages task
def docTasks = [:]
[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass ->
def allSources = allprojects.tasks*.withType(docClass).flatten()*.source
if (allSources) {
def shortName = docClass.simpleName.toLowerCase()
def docTask = task "aggregate${shortName.capitalize()}"(type: docClass, description: "Aggregate subproject ${shortName}s") {
source = allSources
destinationDir = file("${project.buildDir}/docs/${shortName}")
doFirst {
def classpaths = allprojects.findAll { it.plugins.hasPlugin(JavaPlugin) }.collect { it.sourceSets.main.compileClasspath }
classpath = files(classpaths)
}
}
docTasks[shortName] = docTask
processGhPages.dependsOn(docTask)
}
}
githubPages {
repoUri = "git@github.com:Netflix/${rootProject.githubProjectName}.git"
pages {
docTasks.each { shortName, docTask ->
from(docTask.outputs.files) {
into "docs/${shortName}"
}
}
}
}
// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle
task createWrapper(type: Wrapper) {
gradleVersion = '1.5'
}

10
gradle/license.gradle

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
// Dependency for plugin was set in buildscript.gradle
subprojects {
apply plugin: 'license' //nl.javadude.gradle.plugins.license.LicensePlugin
license {
header rootProject.file('codequality/HEADER')
ext.year = Calendar.getInstance().get(Calendar.YEAR)
skipExistingHeaders true
}
}

70
gradle/maven.gradle

@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
// Maven side of things
subprojects {
apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work
apply plugin: 'signing'
signing {
required { gradle.taskGraph.hasTask(uploadMavenCentral) }
sign configurations.archives
}
/**
* Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
* artifactory will execute uploadArchives to force generation of ivy.xml, and we don't want that to trigger an upload to maven
* central, so using custom upload task.
*/
task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
configuration = configurations.archives
onlyIf { ['release', 'snapshot'].contains(project.status) }
repositories.mavenDeployer {
beforeDeployment { signing.signPom(it) }
// To test deployment locally, use the following instead of oss.sonatype.org
//repository(url: "file://localhost/${rootProject.rootDir}/repo")
def sonatypeUsername = rootProject.hasProperty('sonatypeUsername')?rootProject.sonatypeUsername:''
def sonatypePassword = rootProject.hasProperty('sonatypePassword')?rootProject.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)
}
// Prevent datastamp from being appending to artifacts during deployment
uniqueVersion = false
// 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'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
url "https://github.com/Netflix/${rootProject.githubProjectName}"
scm {
connection "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git"
url "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git"
developerConnection "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git"
}
issueManagement {
system 'github'
url "https://github.com/Netflix/${rootProject.githubProjectName}/issues"
}
}
}
}
}

1
gradle/netflix-oss.gradle

@ -1 +0,0 @@ @@ -1 +0,0 @@
apply from: 'http://artifacts.netflix.com/gradle-netflix-local/artifactory.gradle'

61
gradle/release.gradle

@ -1,61 +0,0 @@ @@ -1,61 +0,0 @@
apply plugin: 'release'
[ uploadIvyLocal: 'uploadLocal', uploadArtifactory: 'artifactoryPublish', buildWithArtifactory: 'build' ].each { key, value ->
// Call out to compile against internal repository
task "${key}"(type: GradleBuild) {
startParameter = project.gradle.startParameter.newInstance()
doFirst {
startParameter.projectProperties = [status: project.status, preferredStatus: project.status]
}
startParameter.addInitScript( file('gradle/netflix-oss.gradle') )
startParameter.getExcludedTaskNames().add('check')
tasks = [ 'build', value ]
}
}
// Marker task for following code to key in on
task releaseCandidate(dependsOn: release)
task forceCandidate {
onlyIf { gradle.taskGraph.hasTask(releaseCandidate) }
doFirst { project.status = 'candidate' }
}
task forceRelease {
onlyIf { !gradle.taskGraph.hasTask(releaseCandidate) }
doFirst { project.status = 'release' }
}
release.dependsOn([forceCandidate, forceRelease])
task uploadMavenCentral(dependsOn: subprojects.tasks.uploadMavenCentral)
task releaseSnapshot(dependsOn: [uploadArtifactory, uploadMavenCentral])
// Ensure our versions look like the project status before publishing
task verifyStatus << {
def hasSnapshot = version.contains('-SNAPSHOT')
if (project.status == 'snapshot' && !hasSnapshot) {
throw new GradleException("Version (${version}) needs -SNAPSHOT if publishing snapshot")
}
}
uploadArtifactory.dependsOn(verifyStatus)
uploadMavenCentral.dependsOn(verifyStatus)
// Ensure upload happens before taggging, hence upload failures will leave repo in a revertable state
preTagCommit.dependsOn([uploadArtifactory, uploadMavenCentral])
gradle.taskGraph.whenReady { taskGraph ->
def hasRelease = taskGraph.hasTask('commitNewVersion')
def indexOf = { return taskGraph.allTasks.indexOf(it) }
if (hasRelease) {
assert indexOf(build) < indexOf(unSnapshotVersion), 'build target has to be after unSnapshotVersion'
assert indexOf(uploadMavenCentral) < indexOf(preTagCommit), 'preTagCommit has to be after uploadMavenCentral'
assert indexOf(uploadArtifactory) < indexOf(preTagCommit), 'preTagCommit has to be after uploadArtifactory'
}
}
// Prevent plugin from asking for a version number interactively
ext.'gradle.release.useAutomaticVersion' = "true"
release {
git.requireBranch = null
}

13
gson/build.gradle

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
apply plugin: 'java'
sourceCompatibility = 1.6
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'com.google.code.gson:gson:2.2.4'
testCompile 'org.testng:testng:6.8.5'
}

14
jackson/build.gradle

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
apply plugin: 'java'
sourceCompatibility = 1.6
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.2'
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.guava:guava:14.0.1'
}

11
jaxb/build.gradle

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.guava:guava:14.0.1'
}

15
jaxrs/build.gradle

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
apply plugin: 'java'
sourceCompatibility = 1.6
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'javax.ws.rs:jsr311-api:1.1.1'
testCompile project(':feign-gson')
testCompile 'com.google.guava:guava:14.0.1'
testCompile 'org.testng:testng:6.8.5'
}

14
ribbon/build.gradle

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
apply plugin: 'java'
sourceCompatibility = 1.6
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'com.netflix.ribbon:ribbon-loadbalancer:2.0-RC5'
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.mockwebserver:mockwebserver:20130706'
}

13
sax/build.gradle

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
apply plugin: 'java'
sourceCompatibility = 1.6
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
testCompile 'com.google.guava:guava:14.0.1'
testCompile 'org.testng:testng:6.8.5'
}

12
slf4j/build.gradle

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
apply plugin: 'java'
test {
useTestNG()
}
dependencies {
compile project(':feign-core')
compile 'org.slf4j:slf4j-api:1.7.5'
testCompile 'org.testng:testng:6.8.5'
testCompile 'org.slf4j:slf4j-simple:1.7.5'
}
Loading…
Cancel
Save