From 3d8494bca3074f49567f352f6eedd1ed008eeabd Mon Sep 17 00:00:00 2001 From: Ewen Cheslack-Postava Date: Fri, 29 May 2015 14:50:45 -0700 Subject: [PATCH] KAFKA-2199 Make signing artifacts optional and disabled by default for SNAPSHOTs and allow remote Maven repository configuration from the command line. --- README.md | 3 +++ build.gradle | 50 ++++++++++++++++++++++++----------------------- gradle.properties | 4 ---- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 946ec62cc71d..a9a5d1ef2b74 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,9 @@ Please note for this to work you should create/update `~/.gradle/gradle.properti signing.password= signing.secretKeyRingFile= +### Publishing the jars without signing to a local repository ### + ./gradlew -Dorg.gradle.project.skipSigning=true -Dorg.gradle.project.mavenUrl=file://path/to/repo uploadArchivesAll + ### Building the test jar ### ./gradlew testJar diff --git a/build.gradle b/build.gradle index 3dca28eee55e..30d1cf2f1ff9 100644 --- a/build.gradle +++ b/build.gradle @@ -31,10 +31,13 @@ allprojects { ext { gradleVersion = "2.4" -} -def isVerificationRequired(project) { - project.gradle.startParameter.taskNames.any { it.contains("upload") } + skipSigning = project.hasProperty('skipSigning') && skipSigning.toBoolean() + shouldSign = !skipSigning && !version.endsWith("SNAPSHOT") + + mavenUrl = project.hasProperty('mavenUrl') ? project.mavenUrl : '' + mavenUsername = project.hasProperty('mavenUsername') ? project.mavenUsername : '' + mavenPassword = project.hasProperty('mavenPassword') ? project.mavenPassword : '' } apply from: file('wrapper.gradle') @@ -54,27 +57,26 @@ subprojects { uploadArchives { repositories { signing { - if (isVerificationRequired(project)) { - sign configurations.archives - - // To test locally, replace mavenUrl in ~/.gradle/gradle.properties to file://localhost/tmp/myRepo/ - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - repository(url: "${mavenUrl}") { - authentication(userName: "${mavenUsername}", password: "${mavenPassword}") - } - afterEvaluate { - pom.artifactId = "${archivesBaseName}" - pom.project { - name 'Apache Kafka' - packaging 'jar' - url 'http://kafka.apache.org' - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } + required { shouldSign } + sign configurations.archives + + // To test locally, replace mavenUrl in ~/.gradle/gradle.properties to file://localhost/tmp/myRepo/ + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + repository(url: "${mavenUrl}") { + authentication(userName: "${mavenUsername}", password: "${mavenPassword}") + } + afterEvaluate { + pom.artifactId = "${archivesBaseName}" + pom.project { + name 'Apache Kafka' + packaging 'jar' + url 'http://kafka.apache.org' + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' } } } diff --git a/gradle.properties b/gradle.properties index 90b1945372e7..cd4050b983c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,3 @@ version=0.8.3-SNAPSHOT scalaVersion=2.10.5 task=build org.gradle.jvmargs=-XX:MaxPermSize=512m -Xmx1024m - -mavenUrl= -mavenUsername= -mavenPassword=