Skip to content

Commit 5cb0b83

Browse files
committed
Move from Bintray to Sonatype
1 parent f0da467 commit 5cb0b83

File tree

2 files changed

+60
-35
lines changed

2 files changed

+60
-35
lines changed

build.gradle

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
buildscript {
44
repositories {
55
google()
6-
jcenter()
7-
6+
mavenCentral()
87
}
98
dependencies {
109
classpath 'com.android.tools.build:gradle:4.0.2'
@@ -13,15 +12,10 @@ buildscript {
1312
}
1413
}
1514

16-
plugins {
17-
id "com.jfrog.bintray" version "1.8.5"
18-
}
19-
2015
allprojects {
2116
repositories {
2217
google()
23-
jcenter()
24-
18+
mavenCentral()
2519
}
2620
}
2721

library/build.gradle

+58-27
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'maven-publish'
3-
apply plugin: 'com.jfrog.bintray'
4-
apply plugin: 'maven-publish'
3+
apply plugin: 'signing'
54

65
group='com.codepath.libraries'
76

87
ext {
9-
ARTIFACT = "asynchttpclient"
8+
POM_ARTIFACT_ID = "asynchttpclient"
109
POM_NAME = "CodePath Async Http Client"
11-
POM_DESC = "Async Http Client wrapper using OkHttp"
12-
POM_SCM_URL = 'https://github.com/codepath/AsyncHttpClient'
10+
POM_DESCRIPTION = "Async Http Client wrapper using OkHttp"
1311
BASE_VERSION = 2
14-
VERSION_NAME = "2.1.1"
12+
VERSION_NAME = "2.2.0"
13+
GROUP = 'com.codepath.libraries'
14+
15+
POM_URL = "https://github.com/codepath/android-oauth-handler/"
16+
POM_SCM_URL = 'https://github.com/codepath/AsyncHttpClient'
17+
18+
POM_LICENCE_NAME = "The Apache Software License, Version 2.0"
19+
POM_LICENCE_URL = "http://www.apache.org/licenses/LICENSE-2.0.txt"
20+
21+
POM_DEVELOPER_ID = "codepath"
22+
POM_DEVELOPER_NAME = "CodePath, Inc."
1523
}
1624

1725
version = VERSION_NAME
18-
archivesBaseName = ARTIFACT
1926

2027
android {
2128
compileSdkVersion 30
@@ -68,30 +75,54 @@ afterEvaluate {
6875
artifact androidSourcesJar
6976

7077
// You can then customize attributes of the publication as shown below.
71-
groupId = group
72-
artifactId = ARTIFACT
78+
groupId = GROUP
79+
artifactId = POM_ARTIFACT_ID
7380
version = VERSION_NAME
81+
82+
pom {
83+
name = POM_NAME
84+
url = POM_URL
85+
description = POM_DESCRIPTION
86+
licenses {
87+
license {
88+
name = POM_LICENCE_NAME
89+
url = POM_LICENCE_URL
90+
}
91+
}
92+
developers {
93+
developer {
94+
id = POM_DEVELOPER_ID
95+
name = POM_DEVELOPER_NAME
96+
}
97+
}
98+
scm {
99+
url = POM_SCM_URL
100+
}
101+
}
74102
}
75103
}
76-
}
77-
}
78-
79-
bintray {
80-
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
81-
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
82-
publications = ['release']
83-
84-
pkg {
85-
repo = 'maven'
86-
name = 'asynchttpclient'
87-
userOrg = 'codepath'
88-
licenses = ['Apache-2.0']
89-
vcsUrl = POM_SCM_URL
90-
version {
91-
name = BASE_VERSION
92-
desc = POM_NAME
93-
released = new Date()
104+
repositories {
105+
maven {
106+
name = "Sonatype"
107+
credentials {
108+
username = System.getenv('NEXUS_USERNAME')
109+
password = System.getenv('NEXUS_PASSWORD')
110+
}
111+
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
112+
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
113+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
114+
setUrl(url)
115+
}
94116
}
95117
}
118+
}
96119

120+
signing {
121+
// gpg on MacOS is the same as gpg2
122+
// ln -s /usr/local/bin/gpg /usr/local/bin/gpg2
123+
// Make sure to populate the variables in gradle.properties
124+
// signing.gnupg.keyName=XXX
125+
// signing.gnupg.passpharse
126+
useGpgCmd()
127+
sign(publishing.publications)
97128
}

0 commit comments

Comments
 (0)