Skip to content

Commit d474673

Browse files
committed
Updated build (both Travis and Gradle configuration)
1 parent e83f35d commit d474673

File tree

4 files changed

+56
-63
lines changed

4 files changed

+56
-63
lines changed

.travis.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
branches:
2-
only:
3-
- master
41
language:
52
- java
63
jdk:
@@ -16,15 +13,15 @@ before_install:
1613
# for gradle output style
1714
- export TERM=dumb
1815
# newer version of gradle
19-
- wget http://services.gradle.org/distributions/gradle-1.11-bin.zip
20-
- unzip -qq gradle-1.11-bin.zip
21-
- export GRADLE_HOME=$PWD/gradle-1.11
16+
- wget http://services.gradle.org/distributions/gradle-1.12-bin.zip
17+
- unzip -qq gradle-1.12-bin.zip
18+
- export GRADLE_HOME=$PWD/gradle-1.12
2219
- export PATH=$GRADLE_HOME/bin:$PATH
2320
# just to test gradle version, against our provided one
2421
- gradle -v
25-
# newest android SDK 22.6.1
26-
- wget http://dl.google.com/android/android-sdk_r22.6.1-linux.tgz
27-
- tar -zxf android-sdk_r22.6.1-linux.tgz
22+
# newest android SDK 22.6.3
23+
- wget http://dl.google.com/android/android-sdk_r22.6.3-linux.tgz
24+
- tar -zxf android-sdk_r22.6.3-linux.tgz
2825
- export ANDROID_HOME=`pwd`/android-sdk-linux
2926
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
3027
# manually set sdk.dir variable, according to local paths

gradle.properties

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ POM_SCM_DEV_CONNECTION=scm:git@github.com:loopj/android-async-http.git
1010
POM_LICENCE_NAME=The Apache Software License, Version 2.0
1111
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
1212
POM_LICENCE_DIST=repo
13+
14+
POM_DEVELOPER_ID=jamessmith
15+
POM_DEVELOPER_NAME=James Smith
16+

library/build.gradle

-22
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,4 @@ android {
2121
}
2222
}
2323

24-
android.libraryVariants.all { variant ->
25-
def name = variant.buildType.name
26-
if (name.equals(BuilderConstants.DEBUG)) {
27-
return; // Skip debug builds.
28-
}
29-
def task = project.tasks.create "android${name.capitalize()}Jar", Jar
30-
task.dependsOn variant.javaCompile
31-
task.from variant.javaCompile.destinationDir
32-
artifacts.add('archives', task);
33-
}
34-
35-
android.libraryVariants.all { variant ->
36-
37-
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
38-
description "Generates Javadoc for $variant.name."
39-
source = variant.javaCompile.source
40-
ext.androidJar = "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
41-
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
42-
}
43-
44-
}
45-
4624
apply from: '../maven_push.gradle'

maven_push.gradle

+46-32
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,42 @@
1+
/*
2+
* Copyright 2013 Chris Banes
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
apply plugin: 'maven'
218
apply plugin: 'signing'
319

4-
configurations {
5-
archives {
6-
extendsFrom configurations.default
7-
}
20+
def isReleaseBuild() {
21+
return VERSION_NAME.contains("SNAPSHOT") == false
822
}
923

10-
def sonatypeRepositoryUrl
11-
if (isReleaseBuild()) {
12-
println 'RELEASE BUILD'
13-
sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
14-
} else {
15-
println 'DEBUG BUILD'
16-
sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
24+
def getReleaseRepositoryUrl() {
25+
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
26+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
1727
}
1828

19-
if (ext.properties.containsKey('signing.keyId') && !ext.properties.containsKey('signing.password')) {
20-
if (System.console())
21-
ext.set('signing.password', System.console().readPassword("\n\$ Type in GPG key password: "))
22-
else
23-
ext.set('signing.password', 'dummy')
29+
def getSnapshotRepositoryUrl() {
30+
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
31+
: "https://oss.sonatype.org/content/repositories/snapshots/"
2432
}
2533

26-
if (System.env.TERM != 'dumb' && !ext.properties.containsKey('nexusPassword')) {
27-
if (System.console())
28-
ext.set('nexusPassword', new String(System.console().readPassword("\n\$ Type in password for Sonatype nexus account ${nexusUsername}: ")))
29-
else
30-
ext.set('nexusPassword', 'dummy')
34+
def getRepositoryUsername() {
35+
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
36+
}
37+
38+
def getRepositoryPassword() {
39+
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
3140
}
3241

3342
afterEvaluate { project ->
@@ -36,10 +45,15 @@ afterEvaluate { project ->
3645
mavenDeployer {
3746
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
3847

48+
pom.groupId = GROUP
3949
pom.artifactId = POM_ARTIFACT_ID
50+
pom.version = VERSION_NAME
4051

41-
repository(url: sonatypeRepositoryUrl) {
42-
authentication(userName: nexusUsername, password: nexusPassword)
52+
repository(url: getReleaseRepositoryUrl()) {
53+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
54+
}
55+
snapshotRepository(url: getSnapshotRepositoryUrl()) {
56+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
4357
}
4458

4559
pom.project {
@@ -64,12 +78,8 @@ afterEvaluate { project ->
6478

6579
developers {
6680
developer {
67-
id "loopj"
68-
name "James Smith"
69-
}
70-
developer {
71-
id "smarek"
72-
name "Marek Sebera"
81+
id POM_DEVELOPER_ID
82+
name POM_DEVELOPER_NAME
7383
}
7484
}
7585
}
@@ -82,9 +92,14 @@ afterEvaluate { project ->
8292
sign configurations.archives
8393
}
8494

85-
task androidJavadocsJar(type: Jar, dependsOn: generateReleaseJavadoc) {
95+
task androidJavadocs(type: Javadoc) {
96+
source = android.sourceSets.main.allJava
97+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
98+
}
99+
100+
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
86101
classifier = 'javadoc'
87-
from generateReleaseJavadoc.destinationDir
102+
from androidJavadocs.destinationDir
88103
}
89104

90105
task androidSourcesJar(type: Jar) {
@@ -93,7 +108,6 @@ afterEvaluate { project ->
93108
}
94109

95110
artifacts {
96-
archives androidReleaseJar
97111
archives androidSourcesJar
98112
archives androidJavadocsJar
99113
}

0 commit comments

Comments
 (0)