diff --git a/.travis.yml b/.travis.yml index 516e7ca93..58111bb5c 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,3 @@ -branches: - only: - - master language: - java jdk: @@ -16,15 +13,15 @@ before_install: # for gradle output style - export TERM=dumb # newer version of gradle - - wget http://services.gradle.org/distributions/gradle-1.11-bin.zip - - unzip -qq gradle-1.11-bin.zip - - export GRADLE_HOME=$PWD/gradle-1.11 + - wget http://services.gradle.org/distributions/gradle-1.12-bin.zip + - unzip -qq gradle-1.12-bin.zip + - export GRADLE_HOME=$PWD/gradle-1.12 - export PATH=$GRADLE_HOME/bin:$PATH # just to test gradle version, against our provided one - gradle -v - # newest android SDK 22.6.1 - - wget http://dl.google.com/android/android-sdk_r22.6.1-linux.tgz - - tar -zxf android-sdk_r22.6.1-linux.tgz + # newest android SDK 22.6.3 + - wget http://dl.google.com/android/android-sdk_r22.6.3-linux.tgz + - tar -zxf android-sdk_r22.6.3-linux.tgz - export ANDROID_HOME=`pwd`/android-sdk-linux - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools # manually set sdk.dir variable, according to local paths diff --git a/gradle.properties b/gradle.properties index faf4d9555..01f4bd2c2 100755 --- a/gradle.properties +++ b/gradle.properties @@ -10,3 +10,7 @@ POM_SCM_DEV_CONNECTION=scm:git@github.com:loopj/android-async-http.git POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo + +POM_DEVELOPER_ID=jamessmith +POM_DEVELOPER_NAME=James Smith + diff --git a/library/build.gradle b/library/build.gradle index 3ac2b0a64..3fc50c7e6 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -21,26 +21,4 @@ android { } } -android.libraryVariants.all { variant -> - def name = variant.buildType.name - if (name.equals(BuilderConstants.DEBUG)) { - return; // Skip debug builds. - } - def task = project.tasks.create "android${name.capitalize()}Jar", Jar - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - artifacts.add('archives', task); -} - -android.libraryVariants.all { variant -> - - task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { - description "Generates Javadoc for $variant.name." - source = variant.javaCompile.source - ext.androidJar = "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) - } - -} - apply from: '../maven_push.gradle' diff --git a/maven_push.gradle b/maven_push.gradle index 6fc6fb30f..07ac60edb 100755 --- a/maven_push.gradle +++ b/maven_push.gradle @@ -1,33 +1,42 @@ +/* + * Copyright 2013 Chris Banes + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + apply plugin: 'maven' apply plugin: 'signing' -configurations { - archives { - extendsFrom configurations.default - } +def isReleaseBuild() { + return VERSION_NAME.contains("SNAPSHOT") == false } -def sonatypeRepositoryUrl -if (isReleaseBuild()) { - println 'RELEASE BUILD' - sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} else { - println 'DEBUG BUILD' - sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/" +def getReleaseRepositoryUrl() { + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" } -if (ext.properties.containsKey('signing.keyId') && !ext.properties.containsKey('signing.password')) { - if (System.console()) - ext.set('signing.password', System.console().readPassword("\n\$ Type in GPG key password: ")) - else - ext.set('signing.password', 'dummy') +def getSnapshotRepositoryUrl() { + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" } -if (System.env.TERM != 'dumb' && !ext.properties.containsKey('nexusPassword')) { - if (System.console()) - ext.set('nexusPassword', new String(System.console().readPassword("\n\$ Type in password for Sonatype nexus account ${nexusUsername}: "))) - else - ext.set('nexusPassword', 'dummy') +def getRepositoryUsername() { + return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" +} + +def getRepositoryPassword() { + return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" } afterEvaluate { project -> @@ -36,10 +45,15 @@ afterEvaluate { project -> mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + pom.groupId = GROUP pom.artifactId = POM_ARTIFACT_ID + pom.version = VERSION_NAME - repository(url: sonatypeRepositoryUrl) { - authentication(userName: nexusUsername, password: nexusPassword) + repository(url: getReleaseRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + snapshotRepository(url: getSnapshotRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) } pom.project { @@ -64,12 +78,8 @@ afterEvaluate { project -> developers { developer { - id "loopj" - name "James Smith" - } - developer { - id "smarek" - name "Marek Sebera" + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME } } } @@ -82,9 +92,14 @@ afterEvaluate { project -> sign configurations.archives } - task androidJavadocsJar(type: Jar, dependsOn: generateReleaseJavadoc) { + task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.allJava + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + } + + task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { classifier = 'javadoc' - from generateReleaseJavadoc.destinationDir + from androidJavadocs.destinationDir } task androidSourcesJar(type: Jar) { @@ -93,7 +108,6 @@ afterEvaluate { project -> } artifacts { - archives androidReleaseJar archives androidSourcesJar archives androidJavadocsJar }