Skip to content

Commit 29a62c1

Browse files
committed
OSS Sonatype release via Gradle
1 parent 47c849b commit 29a62c1

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ buildscript {
88
}
99
}
1010

11+
def isReleaseBuild() {
12+
return version.contains("SNAPSHOT") == false
13+
}
14+
1115
allprojects {
1216
group = 'com.loopj.android'
1317
version = '1.4.4-SNAPSHOT'
@@ -20,3 +24,5 @@ allprojects {
2024
options.encoding = "UTF-8"
2125
}
2226
}
27+
28+
apply plugin: 'android-reporting'

gradle.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
VERSION_NAME=1.4.4-SNAPSHOT
2+
VERSION_CODE=2
3+
GROUP=com.loopj.android
4+
5+
POM_DESCRIPTION=An Asynchronous HTTP Library for Android
6+
POM_URL=loopj.com/android-async-http/
7+
POM_SCM_URL=https://github.com/loopj/android-async-http
8+
POM_SCM_CONNECTION=scm:[email protected]:loopj/android-async-http.git
9+
POM_SCM_DEV_CONNECTION=scm:[email protected]:loopj/android-async-http.git
10+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
11+
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
12+
POM_LICENCE_DIST=repo

library/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ android {
1616
}
1717
}
1818
}
19+
20+
apply from: '../maven_push.gradle'

library/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POM_NAME=ActionBar-PullToRefresh Library
2+
POM_ARTIFACT_ID=android-async-http
3+
POM_PACKAGING=jar

maven_push.gradle

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
apply plugin: 'maven'
2+
apply plugin: 'signing'
3+
4+
def sonatypeRepositoryUrl
5+
if (isReleaseBuild()) {
6+
println 'RELEASE BUILD'
7+
sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
8+
} else {
9+
println 'DEBUG BUILD'
10+
sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
11+
}
12+
13+
afterEvaluate { project ->
14+
uploadArchives {
15+
repositories {
16+
mavenDeployer {
17+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
18+
19+
pom.artifactId = POM_ARTIFACT_ID
20+
21+
repository(url: sonatypeRepositoryUrl) {
22+
authentication(userName: nexusUsername, password: nexusPassword)
23+
}
24+
25+
pom.project {
26+
name POM_NAME
27+
packaging POM_PACKAGING
28+
description POM_DESCRIPTION
29+
url POM_URL
30+
31+
scm {
32+
url POM_SCM_URL
33+
connection POM_SCM_CONNECTION
34+
developerConnection POM_SCM_DEV_CONNECTION
35+
}
36+
37+
licenses {
38+
license {
39+
name POM_LICENCE_NAME
40+
url POM_LICENCE_URL
41+
distribution POM_LICENCE_DIST
42+
}
43+
}
44+
45+
developers {
46+
developer {
47+
id "loopj"
48+
name "James Smith"
49+
}
50+
developer {
51+
id "smarek"
52+
name "Marek Sebera"
53+
}
54+
}
55+
}
56+
}
57+
}
58+
}
59+
60+
signing {
61+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
62+
sign configurations.archives
63+
}
64+
65+
task androidJavadocs(type: Javadoc) {
66+
source = android.sourceSets.main.allJava
67+
}
68+
69+
task androidJavadocsJar(type: Jar) {
70+
classifier = 'javadoc'
71+
//basename = artifact_id
72+
from androidJavadocs.destinationDir
73+
}
74+
75+
task androidSourcesJar(type: Jar) {
76+
classifier = 'sources'
77+
//basename = artifact_id
78+
from android.sourceSets.main.allSource
79+
}
80+
81+
artifacts {
82+
//archives packageReleaseJar
83+
archives androidSourcesJar
84+
archives androidJavadocsJar
85+
}
86+
}

0 commit comments

Comments
 (0)