Skip to content

Commit

Permalink
Release to maven central.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecialCyCi committed Jan 7, 2015
1 parent 8b7eff3 commit e776c59
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ proguard/
.idea/

.gradle/
gradle/
gradlew
gradlew.bat
build/
.DS_Store
6 changes: 3 additions & 3 deletions ResideMenu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ repositories {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
useOldManifestMerger true
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
Expand All @@ -30,4 +28,6 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
}

apply from: '../maven_push.gradle'
3 changes: 3 additions & 0 deletions ResideMenu/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=AndroidResideMenu
POM_ARTIFACT_ID=residemenu
POM_PACKAGING=aar
1 change: 0 additions & 1 deletion ResideMenuDemo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dependencies {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
useOldManifestMerger true

dexOptions {
jumboMode = true
Expand Down
14 changes: 14 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
VERSION_NAME=1.6
VERSION_CODE=8
POM_GROUP_ID=com.specyci
POM_DESCRIPTION=The idea of ResideMenu is from Dribbble 1 and 2. It has come true and run in iOS devices. iOS ResideMenu This project is the RefsideMenu Android version. The visual effect is partly referred to iOS version of ResideMenu. And thanks to the authors for the above idea and contribution.
POM_URL=https://github.com/SpecialCyCi/AndroidResideMenu
POM_SCM_URL=https://github.com/SpecialCyCi/AndroidResideMenu
POM_SCM_CONNECTION=scm:[email protected]:survivingwithandroid/weatherlib.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:SpecialCyCi/AndroidResideMenu.git
POM_LICENCE_NAME=The MIT License (MIT)
POM_LICENCE_URL=https://raw.githubusercontent.com/SpecialCyCi/AndroidResideMenu/master/LICENSE
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=specialcyci
POM_DEVELOPER_NAME=Special Leung
POM_INCEPTION_YEAR=2013
106 changes: 106 additions & 0 deletions maven_push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
apply plugin: 'maven'
apply plugin: 'signing'

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

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/"

}

def getRepositoryUsername() {
return hasProperty('nexusUsername') ? nexusUsername : ""
}

def getRepositoryPassword() {
return hasProperty('nexusPassword') ? nexusPassword : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.artifactId = POM_ARTIFACT_ID

repository(url: sonatypeRepositoryUrl) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

pom.project {
name POM_NAME
groupId POM_GROUP_ID
version VERSION_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
inceptionYear POM_INCEPTION_YEAR

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

task androidJavadocs(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.source
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
}
classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
//basename = artifact_id
from androidJavadocs.destinationDir
}

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

artifacts {
//archives packageReleaseJar
archives androidSourcesJar
archives androidJavadocsJar
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ if (!System.properties['buildToolsVersion']) {
}

if (!System.properties['androidGradlePluginVersion']) {
System.properties['androidGradlePluginVersion'] = "0.12.+"
System.properties['androidGradlePluginVersion'] = "1.0.+"
}

0 comments on commit e776c59

Please sign in to comment.