diff options
-rw-r--r-- | builder/build.gradle | 27 | ||||
-rw-r--r-- | gradle/build.gradle | 24 |
2 files changed, 41 insertions, 10 deletions
diff --git a/builder/build.gradle b/builder/build.gradle index 0cde7da..ca95dc7 100644 --- a/builder/build.gradle +++ b/builder/build.gradle @@ -33,15 +33,32 @@ configure(install.repositories.mavenInstaller) { pom.scopeMappings.mappings.clear() } +task publishLocal(type: Upload) { + configuration = configurations.archives + repositories { + mavenDeployer { + repository(url: uri("$rootDir/repo")) + + // Discard all the dependencies from the POM, as they are packaged in the JAR. + pom.scopeMappings.mappings.clear() + } + } +} + uploadArchives { repositories { mavenDeployer { - //beforeDeployment { MavenDeployment deployment -> signPom(deployment) } + beforeDeployment { MavenDeployment deployment -> + if (!project.has("release")) { + throw new StopExecutionException("uploadArchives must be called with the release.gradle init script") + } - //repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - // authentication(userName: sonatypeUsername, password: sonatypePassword) - //} - repository(url: uri("$rootDir/repo")) + signing.signPom(deployment) + } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: sonatypeUsername, password: sonatypePassword) + } // Discard all the dependencies from the POM, as they are packaged in the JAR. pom.scopeMappings.mappings.clear() diff --git a/gradle/build.gradle b/gradle/build.gradle index 1a95340..ca7bc41 100644 --- a/gradle/build.gradle +++ b/gradle/build.gradle @@ -26,16 +26,30 @@ def getVersion() { version = getVersion() archivesBaseName = 'gradle' +task publishLocal(type: Upload) { + configuration = configurations.archives + repositories { + mavenDeployer { + repository(url: uri("$rootDir/repo")) + + } + } +} uploadArchives { repositories { mavenDeployer { - //beforeDeployment { MavenDeployment deployment -> signPom(deployment) } + beforeDeployment { MavenDeployment deployment -> + if (!project.has("release")) { + throw new StopExecutionException("uploadArchives must be called with the release.gradle init script") + } - //repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - // authentication(userName: sonatypeUsername, password: sonatypePassword) - //} - repository(url: uri("$rootDir/repo")) + signing.signPom(deployment) + } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: sonatypeUsername, password: sonatypePassword) + } pom.project { name 'Gradle Plug-in for Android' |