1apply plugin: 'maven' 2apply plugin: 'signing' 3 4def isReleaseBuild() { 5 return version.contains("SNAPSHOT") == false 6} 7 8def getMavenRepositoryUrl() { 9 return hasProperty('repositoryUrl') ? property('repositoryUrl') : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 10} 11 12def getMavenRepositoryUsername() { 13 return hasProperty('sonatypeUsername') ? property('sonatypeUsername') : "" 14} 15 16def getMavenRepositoryPassword() { 17 return hasProperty('sonatypePassword') ? property('sonatypePassword') : "" 18} 19 20afterEvaluate { project -> 21 22 signing { 23 required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 24 sign configurations.archives 25 } 26 27 uploadArchives { 28 configuration = configurations.archives 29 repositories.mavenDeployer { 30 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 31 32 repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { 33 authentication(userName: getMavenRepositoryUsername(), password: getMavenRepositoryPassword()) 34 } 35 36 pom.project { 37 name 'SubsamplingScaleImageView' 38 packaging 'aar' 39 description 'Custom image views for Android with pinch to zoom, panning, rotation and animation support, with easy extension so you can add your own overlays and touch event detection.' 40 url 'https://github.com/davemorrissey/subsampling-scale-image-view' 41 42 scm { 43 url 'scm:git@github.com:davemorrissey/subsampling-scale-image-view.git' 44 connection 'scm:git@github.com:davemorrissey/subsampling-scale-image-view.git' 45 developerConnection 'scm:git@github.com:davemorrissey/subsampling-scale-image-view.git' 46 } 47 48 licenses { 49 license { 50 name 'The Apache Software License, Version 2.0' 51 url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 52 distribution 'repo' 53 } 54 } 55 56 developers { 57 developer { 58 id 'davemorrissey' 59 name 'Dave Morrissey' 60 } 61 } 62 } 63 } 64 } 65 66} 67