这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ group = "com.netflix.${project.name}"
apply plugin:'eclipse-wtp'

buildscript {
repositories { mavenCentral() }
repositories {
mavenLocal()
mavenCentral() // maven { url 'http://jcenter.bintray.com' }
}
apply from: file('gradle/buildscript.gradle'), to: buildscript
}

allprojects {
repositories { mavenCentral() }
repositories {
mavenLocal()
mavenCentral() // maven { url: 'http://jcenter.bintray.com' }
}
}

apply from: file('gradle/convention.gradle')
Expand Down Expand Up @@ -69,7 +75,6 @@ tasks.withType(Compile) {
artifacts {
archives tasks.jar
}

import nl.javadude.gradle.plugins.license.License
tasks.withType(License).each { licenseTask ->
licenseTask.exclude '**/*.json'
Expand Down
2 changes: 0 additions & 2 deletions codequality/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!-- <module name="AvoidInlineConditionals"/> -->
<!--The DoubleCheckedLocking rule is not supported in CheckStyle 5.6-->
<!--<module name="DoubleCheckedLocking"/> &lt;!&ndash; MY FAVOURITE &ndash;&gt;-->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
Expand Down
10 changes: 4 additions & 6 deletions gradle/buildscript.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Executed in context of buildscript
repositories {
// Repo in addition to maven central
maven {
name 'build-repo'
url 'https://raw.github.com/Netflix-Skunkworks/build-repo/master/releases/' // gradle-release/gradle-release/1.0-SNAPSHOT/gradle-release-1.0-SNAPSHOT.jar
}
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.0'
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.0-SNAPSHOT'
classpath 'gradle-release:gradle-release:1.1.5'
classpath 'org.ajoberstar:gradle-git:0.5.0'
}
7 changes: 4 additions & 3 deletions gradle/check.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Checkstyle
apply plugin: 'checkstyle'
tasks.withType(Checkstyle) { ignoreFailures = true }
checkstyle {
ignoreFailures = true // Waiting on GRADLE-2163
ignoreFailures = true
configFile = rootProject.file('codequality/checkstyle.xml')
}

// FindBugs
apply plugin: 'findbugs'
//tasks.withType(Findbugs) { reports.html.enabled true }
findbugs {
ignoreFailures = true
}

// PMD
apply plugin: 'pmd'
Expand Down
30 changes: 24 additions & 6 deletions gradle/convention.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apply plugin: 'java' // Plugin as major conventions
apply plugin: 'java' // Plugin as major conventions, overwrites status

sourceCompatibility = 1.6

// GRADLE-2087 workaround, perform after java plugin
status = version.contains('-SNAPSHOT')?'snapshot':'release'
status = project.hasProperty('preferredStatus')?project.preferredStatus:(version.contains('SNAPSHOT')?'snapshot':'release')

// Indenting to align with multi-project branch
task sourcesJar(type: Jar, dependsOn:classes) {
Expand Down Expand Up @@ -45,9 +45,6 @@ status = version.contains('-SNAPSHOT')?'snapshot':'release'
}
}

// 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.'
Expand All @@ -63,7 +60,28 @@ status = version.contains('-SNAPSHOT')?'snapshot':'release'
test.runtimeClasspath += project.configurations.provided
}

apply plugin: 'github-pages' // Used to create publishGhPages task

def docTasks = [:]
[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass ->
tasks.withType(docClass).each { docTask ->
docTasks[docTask.name] = 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.1'
gradleVersion = '1.5'
}
1 change: 1 addition & 0 deletions gradle/license.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ apply plugin: 'license' //nl.javadude.gradle.plugins.license.LicensePlugin
license {
header rootProject.file('codequality/HEADER')
ext.year = Calendar.getInstance().get(Calendar.YEAR)
skipExistingHeaders true
}
22 changes: 14 additions & 8 deletions gradle/maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,27 @@ signing {
*/
task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
configuration = configurations.archives
doFirst {
onlyIf { ['release', 'snapshot'].contains(project.status) }
repositories.mavenDeployer {
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }
beforeDeployment { signing.signPom(it) }

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

repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: rootProject.sonatypeUsername, password: rootProject.sonatypePassword)
}
def sonatypeUsername = rootProject.hasProperty('sonatypeUsername')?rootProject.sonatypeUsername:''
def sonatypePassword = rootProject.hasProperty('sonatypePassword')?rootProject.sonatypePassword:''

// Prevent datastamp from being appending to artifacts during deployment
uniqueVersion = false
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}"
Expand Down Expand Up @@ -58,6 +65,5 @@ task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
}
}
}
}
}

76 changes: 37 additions & 39 deletions gradle/release.gradle
Original file line number Diff line number Diff line change
@@ -1,62 +1,60 @@
apply plugin: 'release'

// Ignore release plugin's task because it calls out via GradleBuild. This is a good place to put an email to send out
task release(overwrite: true, dependsOn: commitNewVersion) << {
// This is a good place to put an email to send out
}
commitNewVersion.dependsOn updateVersion
updateVersion.dependsOn createReleaseTag
createReleaseTag.dependsOn preTagCommit
preTagCommit.dependsOn build
preTagCommit.dependsOn checkSnapshotDependencies
//checkSnapshotDependencies.dependsOn confirmReleaseVersion // Introduced in 1.0, forces readLine
//confirmReleaseVersion.dependsOn unSnapshotVersion
checkSnapshotDependencies.dependsOn unSnapshotVersion // Remove once above is fixed
unSnapshotVersion.dependsOn checkUpdateNeeded
checkUpdateNeeded.dependsOn checkCommitNeeded
checkCommitNeeded.dependsOn initScmPlugin

[
uploadIvyLocal: 'uploadLocal',
uploadArtifactory: 'artifactoryPublish', // Call out to compile against internal repository
buildWithArtifactory: 'build' // Build against internal repository
].each { key, value ->
[ 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 ]
}
}
task releaseArtifactory(dependsOn: [checkSnapshotDependencies, uploadArtifactory])

// Ensure upload happens before taggging but after all pre-checks
releaseArtifactory.dependsOn checkSnapshotDependencies
createReleaseTag.dependsOn releaseArtifactory
gradle.taskGraph.whenReady { taskGraph ->
if ( taskGraph.hasTask(uploadArtifactory) && rootProject.status == 'release' && !taskGraph.hasTask(':release') ) {
throw new GradleException('"release" task has to be run before uploading a release to Artifactory')
// 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 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])


project.uploadMavenCentral.dependsOn rootProject.checkSnapshotDependencies
rootProject.createReleaseTag.dependsOn project.uploadMavenCentral
gradle.taskGraph.whenReady { taskGraph ->
if ( taskGraph.hasTask(project.uploadMavenCentral) && !taskGraph.hasTask(':release') ) {
throw new GradleException('"release" task has to be run before uploading to Maven Central')
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 {
// http://tellurianring.com/wiki/gradle/release
failOnCommitNeeded=true
failOnPublishNeeded=true
failOnUnversionedFiles=true
failOnUpdateNeeded=true
includeProjectNameInTag=true
requireBranch = null
git.requireBranch = null
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 14 16:28:54 PDT 2012
#Tue Apr 02 11:45:56 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.1-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-1.5-bin.zip
6 changes: 3 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

##############################################################################
##
Expand Down Expand Up @@ -61,9 +61,9 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED"
cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

Expand Down