Skip to content

Publish to Sonatype instead of Bintray #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,13 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.android.tools.build:gradle:4.0.1'
}
}

plugins {
id "com.jfrog.bintray" version "1.8.4"
}

plugins {
id "com.github.dcendents.android-maven" version "2.1"
}

bintray {
publications = []
configurations = []
}

allprojects {
repositories {
google()
Expand Down
20 changes: 20 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
85 changes: 61 additions & 24 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
apply plugin: 'signing'

// https://github.com/bintray/gradle-bintray-plugin/issues/74#issuecomment-168367341
// https://github.com/dcendents/android-maven-gradle-plugin/issues/9
ext {

GROUP = 'com.codepath.libraries'
BASE_VERSION = "2.1"
VERSION_NAME = "2.1.4"
BASE_VERSION = "2.3"
VERSION_NAME = "2.3.0"
POM_PACKAGING = "aar"
POM_DESCRIPTION = "CodePath OAuth Handler"

Expand Down Expand Up @@ -54,26 +52,65 @@ android {
}
}

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')

configurations = ['archives'] // needs apply plugin 'com.jfrog.bintray' to work

pkg {
repo = 'maven'
name = 'android-oauth-handler'
userOrg = 'codepath'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/codepath/android-oauth-handler.git'
version {
name = BASE_VERSION
desc = POM_NAME
released = new Date()
vcsTag = VERSION_NAME
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release

// You can then customize attributes of the publication as shown below.
groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME

pom {
name = POM_NAME
url = POM_URL
description = POM_DESCRIPTION
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
scm {
url = POM_SCM_URL
}
}
}
}
repositories {
maven {
name = "Sonatype"
credentials {
username = System.getenv('NEXUS_USERNAME')
password = System.getenv('NEXUS_PASSWORD')
}
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
setUrl(url)
}
}
}
}

signing {
// gpg on MacOS is the same as gpg2
// ln -s /usr/local/bin/gpg /usr/local/bin/gpg2
// Make sure to populate the variables in gradle.properties
// signing.gnupg.keyName=XXX
// signing.gnupg.passpharse
useGpgCmd()
sign(publishing.publications)
}

task sourcesJar(type: Jar) {
Expand All @@ -86,7 +123,7 @@ artifacts {
}

ext {
supportVersion = '28.0.0'
supportVersion = '28.0.0'
}

dependencies {
Expand Down