Skip to content

Commit

Permalink
Add release scripts for jcenter
Browse files Browse the repository at this point in the history
  • Loading branch information
hzalaz committed Nov 23, 2016
1 parent eafb9e6 commit 4c534de
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 5 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}

allprojects {
group = 'com.auth0.android'

repositories {
jcenter()
}
Expand Down
6 changes: 4 additions & 2 deletions guardian/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'jacoco-android'
apply from: '../scripts/version.gradle'

android {
compileSdkVersion 25
Expand All @@ -9,7 +10,7 @@ android {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "0.1.0"
versionName project.version
}
buildTypes {
release {
Expand Down Expand Up @@ -52,4 +53,5 @@ dependencies {
testCompile 'junit:junit:4.12'
}

apply from: '../version.gradle'
apply from: '../scripts/maven.gradle'
apply from: '../scripts/bintray.gradle'
32 changes: 32 additions & 0 deletions scripts/bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
if (hasProperty('bintray.user') && hasProperty('bintray.key') && hasProperty('bintray.gpg.password')) {
def bintrayUser = getProperty('bintray.user')
def bintrayApiKey = getProperty('bintray.key')
def bintrayPassphrase = getProperty('bintray.gpg.password')
apply plugin: 'com.jfrog.bintray'
bintray {
user = bintrayUser
key = bintrayApiKey
configurations = ['archives']
dryRun = project.version.endsWith("-SNAPSHOT")
publish = false
pkg {
repo = 'android'
name = 'Guardian.Android'
desc = 'Android toolkit for Auth0 Guardian API'
websiteUrl = 'https://github.com/auth0/guardian.android'
vcsUrl = 'scm:[email protected]:auth0/guardian.android.git'
licenses = ["MIT"]
userOrg = 'auth0'
publish = false
version {
gpg {
sign = true
passphrase = bintrayPassphrase
}
vcsTag = project.version
name = project.version
released = new Date()
}
}
}
}
64 changes: 64 additions & 0 deletions scripts/maven.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apply plugin: 'com.github.dcendents.android-maven'

install {
repositories.mavenInstaller {
pom {
project {
packaging 'aar'
artifactId 'guardian'

name 'Guardian-Android'
description 'Android toolkit for Auth0 Guardian API'
url 'https://github.com/auth0/Guardian.Android'

licenses {
license {
name 'The MIT License (MIT)'
url 'https://raw.githubusercontent.com/auth0/guardian.android/master/LICENSE'
distribution 'repo'
}
}
developers {
developer {
id 'hzalaz'
name 'Hernan Zalazar'
email '[email protected]'
}
}
scm {
connection 'scm:[email protected]:auth0/Guardian.Android.git'
developerConnection 'scm:[email protected]:auth0/guardian.android.git'
url 'https://github.com/auth0/guardian.android'

}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
exclude '**/BuildConfig.java'
exclude '**/R.java'
failOnError false
}

afterEvaluate {
javadoc.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}
2 changes: 2 additions & 0 deletions version.gradle → scripts/version.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ def describeGit(boolean snapshot, String defaultValue = null) {
def arguments = ['describe', '--tags']
arguments.add(snapshot ? '--abbrev=0' : '--exact-match')
def stdout = new ByteArrayOutputStream()
def errout = new ByteArrayOutputStream()
def string = defaultValue
try {
def result = project.exec {
executable = 'git'
args = arguments
standardOutput = stdout
errorOutput = errout
}

result.assertNormalExitValue()
Expand Down

0 comments on commit 4c534de

Please sign in to comment.