diff options
author | Rocky Madden <git@rockymadden.com> | 2012-12-11 10:17:35 -0700 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2012-12-11 10:17:35 -0700 |
commit | 456af9c718c0173c37c754a7276948d0d694fb59 (patch) | |
tree | 3cab8a8db4676949df9efdc8095bb8a5be37eae6 | |
parent | aeea02eae077fc8bb916c962539c2b3db5383606 (diff) | |
download | stringmetric-456af9c718c0173c37c754a7276948d0d694fb59.tar.gz stringmetric-456af9c718c0173c37c754a7276948d0d694fb59.tar.bz2 stringmetric-456af9c718c0173c37c754a7276948d0d694fb59.zip |
Restructured to more gracefully handle for Maven Repository deployment.
-rwxr-xr-x | cli/build.gradle | 52 | ||||
-rwxr-xr-x | core/build.gradle | 48 | ||||
-rwxr-xr-x | gradle.properties | 10 |
3 files changed, 51 insertions, 59 deletions
diff --git a/cli/build.gradle b/cli/build.gradle index 397468d..c7b3ec6 100755 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -5,6 +5,8 @@ apply plugin: 'signing' evaluationDependsOn(':stringmetric-core') +def isMavenDeployable = hasProperty('mavenRepositoryUrl') && hasProperty('mavenRepositoryUsername') && hasProperty('mavenRepositoryPassword') + compileScala { compileScala.scalaCompileOptions.additionalParameters = ['-optimise', '–Xdisable-assertions'] } @@ -22,10 +24,6 @@ dependencies { testCompile 'org.scalatest:scalatest_2.9.2:1.8' } -signing { - sign configurations.archives -} - sourceSets { main { output.resourcesDir "${project.buildDir}/classes/main" @@ -55,16 +53,6 @@ sourceSets { } } -task scaladocJar(type: Jar, dependsOn: scaladoc) { - classifier = 'javadoc' - from "${project.buildDir}/docs/scaladoc" -} - -task sourceJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} - task tar(description: 'Assembles a compressed tar archive of source files.', dependsOn: [':stringmetric-cli:jar', ':stringmetric-core:jar']) { ext.sourcePath = "${project.projectDir}/source/core/scala" ext.outputPath = "${project.buildDir}" @@ -128,22 +116,34 @@ task tar(description: 'Assembles a compressed tar archive of source files.', dep } } -artifacts { - archives jar - archives scaladocJar - archives sourceJar -} +if (isMavenDeployable) { + signing { + sign configurations.archives + } + + task scaladocJar(type: Jar, dependsOn: scaladoc) { + classifier = 'javadoc' + from "${project.buildDir}/docs/scaladoc" + } -def isDeployable = hasProperty('sonatypeRepositoryUrl') && hasProperty('sonatypeUsername') && hasProperty('sonatypePassword') + task sourceJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } -uploadArchives { - repositories { - if(isDeployable) { + artifacts { + archives jar + archives scaladocJar + archives sourceJar + } + + uploadArchives { + repositories { mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - repository(url: sonatypeRepositoryUrl) { - authentication(userName: sonatypeUsername, password: sonatypePassword) + repository(url: mavenRepositoryUrl) { + authentication(userName: mavenRepositoryUsername, password: mavenRepositoryPassword) } pom.project { @@ -175,6 +175,6 @@ uploadArchives { } } } - } else { mavenLocal() } + } } }
\ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index de9c813..8053160 100755 --- a/core/build.gradle +++ b/core/build.gradle @@ -3,6 +3,8 @@ apply plugin: 'maven' apply plugin: 'scala' apply plugin: 'signing' +def isMavenDeployable = hasProperty('mavenRepositoryUrl') && hasProperty('mavenRepositoryUsername') && hasProperty('mavenRepositoryPassword') + compileScala { compileScala.scalaCompileOptions.additionalParameters = ['-optimise', '–Xdisable-assertions'] } @@ -19,10 +21,6 @@ dependencies { testCompile 'org.scalatest:scalatest_2.9.2:1.8' } -signing { - sign configurations.archives -} - sourceSets { benchmark { output.resourcesDir "${project.buildDir}/classes/benchmark" @@ -65,32 +63,34 @@ sourceSets { } } -task scaladocJar(type: Jar, dependsOn: scaladoc) { - classifier = 'javadoc' - from "${project.buildDir}/docs/scaladoc" -} +if (isMavenDeployable) { + signing { + sign configurations.archives + } -task sourceJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} + task scaladocJar(type: Jar, dependsOn: scaladoc) { + classifier = 'javadoc' + from "${project.buildDir}/docs/scaladoc" + } -artifacts { - archives jar - archives scaladocJar - archives sourceJar -} + task sourceJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } -def isDeployable = hasProperty('sonatypeRepositoryUrl') && hasProperty('sonatypeUsername') && hasProperty('sonatypePassword') + artifacts { + archives jar + archives scaladocJar + archives sourceJar + } -uploadArchives { - repositories { - if(isDeployable) { + uploadArchives { + repositories { mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - repository(url: sonatypeRepositoryUrl) { - authentication(userName: sonatypeUsername, password: sonatypePassword) + repository(url: mavenRepositoryUrl) { + authentication(userName: mavenRepositoryUsername, password: mavenRepositoryPassword) } pom.project { @@ -122,6 +122,6 @@ uploadArchives { } } } - } else { mavenLocal() } + } } }
\ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ebf7df6..06b28c5 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1 @@ -org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m - -signing.keyId= -signing.password= -signing.secretKeyRingFile= - -sonatypePassword= -sonatypeRepositoryUrl= -sonatypeUsername=
\ No newline at end of file +org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m
\ No newline at end of file |