Skip to content

Commit

Permalink
Updated with gradle tasks to upload to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersuweijie committed Apr 5, 2021
1 parent 2232b66 commit 5631ee2
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 6 deletions.
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ buildscript {
google()
jcenter()
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'

classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -26,4 +27,6 @@ allprojects {

task clean(type: Delete) {
delete rootProject.buildDir
}
}

apply plugin: 'io.codearte.nexus-staging'
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true

android.useAndroidX=true
#android.enableJetifier=true
android.enableJetifier=true

signing.keyId=619A4A2B
signing.secretKeyRingFile=../secring.gpg
89 changes: 86 additions & 3 deletions xendit-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ext {
developerEmail = '[email protected]'

licenseName = 'MIT'
licenseUrl = ''
licenseUrl = 'https://opensource.org/licenses/MIT'
allLicenses = ["MIT"]
}

Expand Down Expand Up @@ -141,5 +141,88 @@ publishing {

tasks.withType(Javadoc).all { enabled = false }

apply from: 'https://raw.githubusercontent.com/xendit/xendit-sdk-android/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/xendit/xendit-sdk-android/master/bintrayv1.gradle'
apply plugin: 'maven'
apply plugin: 'signing'

if (project.hasProperty("android")) { // Android libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
} else { // Java libraries
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
}

artifacts {
archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
String ossrhUser = properties.getProperty('ossrh.username')
String ossrhPassword = properties.getProperty('ossrh.password')

signing {
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {

beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUser, password: ossrhPassword)
}

snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUser, password: ossrhPassword)
}

pom.project {
name bintrayName
packaging 'aar'
// optionally artifactId can be defined here
description libraryDescription
url siteUrl

scm {
connection gitUrl
developerConnection gitUrl
url gitUrl
}

licenses {
license {
name licenseName
url licenseUrl
}
}

developers {
developer {
id developerId
name developerName
email developerEmail
}
}
}
}
}
}

nexusStaging {
serverUrl = 'https://s01.oss.sonatype.org/service/local/'
username = ossrhUser
password = ossrhPassword
repositoryDescription = 'Closed and released using gradle script'
}

0 comments on commit 5631ee2

Please sign in to comment.