11apply plugin : ' com.android.library'
2- apply plugin : ' com.github.dcendents.android- maven'
3- apply plugin : ' com.jfrog.bintray '
2+ apply plugin : ' maven-publish '
3+ apply plugin : ' signing '
44
5- // https://github.com/bintray/gradle-bintray-plugin/issues/74#issuecomment-168367341
6- // https://github.com/dcendents/android-maven-gradle-plugin/issues/9
75ext {
86
97 GROUP = ' com.codepath.libraries'
10- BASE_VERSION = " 2.1 "
11- VERSION_NAME = " 2.1.4 "
8+ BASE_VERSION = " 2.3 "
9+ VERSION_NAME = " 2.3.0 "
1210 POM_PACKAGING = " aar"
1311 POM_DESCRIPTION = " CodePath OAuth Handler"
1412
@@ -54,26 +52,65 @@ android {
5452 }
5553}
5654
57- bintray {
58- user = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
59- key = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
60-
61- configurations = [' archives' ] // needs apply plugin 'com.jfrog.bintray' to work
62-
63- pkg {
64- repo = ' maven'
65- name = ' android-oauth-handler'
66- userOrg = ' codepath'
67- licenses = [' Apache-2.0' ]
68- vcsUrl = ' https://github.com/codepath/android-oauth-handler.git'
69- version {
70- name = BASE_VERSION
71- desc = POM_NAME
72- released = new Date ()
73- vcsTag = VERSION_NAME
55+ afterEvaluate {
56+ publishing {
57+ publications {
58+ // Creates a Maven publication called "release".
59+ release(MavenPublication ) {
60+ // Applies the component for the release build variant.
61+ from components. release
62+
63+ // You can then customize attributes of the publication as shown below.
64+ groupId = GROUP
65+ artifactId = POM_ARTIFACT_ID
66+ version = VERSION_NAME
67+
68+ pom {
69+ name = POM_NAME
70+ url = POM_URL
71+ description = POM_DESCRIPTION
72+ licenses {
73+ license {
74+ name = POM_LICENCE_NAME
75+ url = POM_LICENCE_URL
76+ }
77+ }
78+ developers {
79+ developer {
80+ id = POM_DEVELOPER_ID
81+ name = POM_DEVELOPER_NAME
82+ }
83+ }
84+ scm {
85+ url = POM_SCM_URL
86+ }
87+ }
88+ }
89+ }
90+ repositories {
91+ maven {
92+ name = " Sonatype"
93+ credentials {
94+ username = System . getenv(' NEXUS_USERNAME' )
95+ password = System . getenv(' NEXUS_PASSWORD' )
96+ }
97+ def releasesRepoUrl = ' https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
98+ def snapshotsRepoUrl = ' https://s01.oss.sonatype.org/content/repositories/snapshots/'
99+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
100+ setUrl(url)
101+ }
74102 }
75103 }
104+ }
76105
106+ signing {
107+ // gpg on MacOS is the same as gpg2
108+ // ln -s /usr/local/bin/gpg /usr/local/bin/gpg2
109+ // Make sure to populate the variables in gradle.properties
110+ // signing.gnupg.keyName=XXX
111+ // signing.gnupg.passpharse
112+ useGpgCmd()
113+ sign(publishing. publications)
77114}
78115
79116task sourcesJar (type : Jar ) {
@@ -86,7 +123,7 @@ artifacts {
86123}
87124
88125ext {
89- supportVersion = ' 28.0.0'
126+ supportVersion = ' 28.0.0'
90127}
91128
92129dependencies {
0 commit comments