From c7b576e450f9878a1f916ef48dcec141665d002f Mon Sep 17 00:00:00 2001 From: Rocky Madden Date: Mon, 10 Dec 2012 20:18:23 -0700 Subject: Added Maven Central integration. --- cli/build.gradle | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/build.gradle b/cli/build.gradle index 8491e97..397468d 100755 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -1,12 +1,14 @@ apply plugin: 'eclipse' +apply plugin: 'maven' apply plugin: 'scala' +apply plugin: 'signing' + +evaluationDependsOn(':stringmetric-core') compileScala { compileScala.scalaCompileOptions.additionalParameters = ['-optimise', '–Xdisable-assertions'] } -evaluationDependsOn(':stringmetric-core') - dependencies { compile project(':stringmetric-core') compile 'org.scala-lang:scala-compiler:2.9.2' @@ -20,6 +22,10 @@ dependencies { testCompile 'org.scalatest:scalatest_2.9.2:1.8' } +signing { + sign configurations.archives +} + sourceSets { main { output.resourcesDir "${project.buildDir}/classes/main" @@ -49,6 +55,16 @@ 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}" @@ -110,4 +126,55 @@ task tar(description: 'Assembles a compressed tar archive of source files.', dep tarfileset(dir: workingPath, fileMode: 755, prefix: project.name) } } +} + +artifacts { + archives jar + archives scaladocJar + archives sourceJar +} + +def isDeployable = hasProperty('sonatypeRepositoryUrl') && hasProperty('sonatypeUsername') && hasProperty('sonatypePassword') + +uploadArchives { + repositories { + if(isDeployable) { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: sonatypeRepositoryUrl) { + authentication(userName: sonatypeUsername, password: sonatypePassword) + } + + pom.project { + description "${parent.project.description}" + groupId "${parent.project.group}" + name "${project.name}" + packaging 'jar' + url "${parent.project.url}" + version "${parent.project.version}" + + developers { + developer { + id 'rockymadden' + name 'Rocky Madden' + } + } + + licenses { + license { + name 'Apache License v2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + + scm { + url "${parent.project.scm}" + connection "${parent.project.scm}" + } + } + } + } else { mavenLocal() } + } } \ No newline at end of file -- cgit v1.2.3