1
0
mirror of https://github.com/mik3y/usb-serial-for-android synced 2025-06-07 16:06:10 +00:00

Add Maven Central uploadArchives target.

Issue #70.
This commit is contained in:
mike wakerly 2014-09-08 10:41:08 -07:00
parent c842a1d5f6
commit 06582e68ad
2 changed files with 82 additions and 1 deletions

View File

@ -1,4 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level gradle script.
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()

View File

@ -1,4 +1,6 @@
apply plugin: 'android-library' apply plugin: 'android-library'
apply plugin: 'maven'
apply plugin: 'signing'
android { android {
compileSdkVersion 19 compileSdkVersion 19
@ -16,3 +18,81 @@ android {
} }
} }
} }
group = "com.hoho"
version = "0.2.0-SNAPSHOT"
configurations {
archives {
extendsFrom configurations.default
}
}
signing {
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
def getRepositoryUsername() {
return hasProperty('sonatypeUsername') ? sonatypeUsername : ""
}
def getRepositoryPassword() {
return hasProperty('sonatypePassword') ? sonatypePassword : ""
}
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
uploadArchives {
def sonatypeRepositoryUrl
if (isReleaseBuild()) {
println 'RELEASE BUILD'
sonatypeRepositoryUrl = hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
} else {
println 'SNAPSHOT BUILD'
sonatypeRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}
configuration = configurations.archives
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: sonatypeRepositoryUrl) {
authentication(userName: getRepositoryUsername(),
password: getRepositoryPassword())
}
pom.project {
name 'usb-serial-for-android'
packaging 'aar'
description 'USB Serial Driver Library for Android'
url 'https://github.com/mik3y/usb-serial-for-android'
scm {
url 'scm:git@github.com:mik3y/usb-serial-for-android.git'
connection 'scm:git@github.com:mik3y/usb-serial-for-android.git'
developerConnection 'scm:git@github.com:mik3y/usb-serial-for-android.git'
}
licenses {
license {
name 'GNU LGPL v2.1'
url 'http://www.gnu.org/licenses/lgpl-2.1.txt'
distribution 'repo'
}
}
developers {
developer {
id 'mik3y'
name 'mik3y'
email 'opensource@hoho.com'
}
}
}
}
}