Skip to content

Commit c6a1c4c

Browse files
authored
Merge pull request #45 from codepath/rogerh/sonatype
Publish to Sonatype instead of Bintray
2 parents ea65a2a + 3a7c3a5 commit c6a1c4c

File tree

4 files changed

+84
-40
lines changed

4 files changed

+84
-40
lines changed

build.gradle

+2-15
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,13 @@
22
buildscript {
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.4.2'
8+
classpath 'com.android.tools.build:gradle:4.0.1'
99
}
1010
}
1111

12-
plugins {
13-
id "com.jfrog.bintray" version "1.8.4"
14-
}
15-
16-
plugins {
17-
id "com.github.dcendents.android-maven" version "2.1"
18-
}
19-
20-
bintray {
21-
publications = []
22-
configurations = []
23-
}
24-
2512
allprojects {
2613
repositories {
2714
google()

gradle.properties

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx1536m
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app's APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Automatically convert third-party libraries to use AndroidX
19+
android.enableJetifier=true
20+

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

library/build.gradle

+61-24
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
apply 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
75
ext {
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

79116
task sourcesJar(type: Jar) {
@@ -86,7 +123,7 @@ artifacts {
86123
}
87124

88125
ext {
89-
supportVersion = '28.0.0'
126+
supportVersion = '28.0.0'
90127
}
91128

92129
dependencies {

0 commit comments

Comments
 (0)