diff options
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | build.gradle | 79 | ||||
-rw-r--r-- | gradle.properties | 3 | ||||
-rw-r--r-- | integration/volley/build.gradle | 2 | ||||
-rw-r--r-- | integration/volley/gradle.properties | 3 | ||||
-rw-r--r-- | library/build.gradle | 5 | ||||
-rw-r--r-- | scripts/upload.gradle | 160 | ||||
m--------- | third_party/disklrucache | 0 | ||||
-rw-r--r-- | third_party/gif_decoder/build.gradle | 2 | ||||
-rw-r--r-- | third_party/gif_decoder/gradle.properties | 3 |
10 files changed, 212 insertions, 56 deletions
@@ -22,7 +22,11 @@ repositories { } dependencies { - compile group: 'com.github.bumptech.glide', name:'glide', version:'3.3.0-SNAPSHOT', changing: true + compile('com.github.bumptech.glide:library:3.3.0a-SNAPSHOT:@aar') { + transitive = true + changing = true + } + compile 'com.android.support:support-v4:19.0.0' } ``` @@ -47,6 +51,11 @@ In your module: <version>3.3.0-SNAPSHOT</version> <type>aar</type> </dependency> +<dependency> + <groupId>com.google.android</groupId> + <artifactId>support-v4</artifactId> + <version>r7</version> +</dependency> ``` Volley diff --git a/build.gradle b/build.gradle index 9300cb65..5f7ba167 100644 --- a/build.gradle +++ b/build.gradle @@ -43,8 +43,8 @@ task wrapper(type: Wrapper) { gradleVersion = '1.12' } -evaluationDependsOn(":integration:volley") evaluationDependsOn(":third_party:gif_decoder") +evaluationDependsOn(":third_party:disklrucache") evaluationDependsOn(":library") def getAndroidSdkDirectory() { @@ -66,6 +66,16 @@ def getAndroidLibraryVariants() { }.sum().unique{ it.name } } +// Currently the only excluded project is the :integration:volley project. +def androidProjects = [':third_party:gif_decoder', ':library'].collect { project(it) } +def javaProjects = [':third_party:disklrucache'].collect { project(it) } +def allProjects = androidProjects + javaProjects +def releaseVariantAndroidProjects = androidProjects.collect { + it.android.libraryVariants.findAll { variant -> + variant.buildType.name.equalsIgnoreCase("release") + } +} + // Generate javadocs containing batched documentation for all android library subprojects. getAndroidLibraryVariants().each { variant -> def androidJar = "${getAndroidSdkDirectory()}/platforms/${getAndroidCompileSdkVersion()}/android.jar" @@ -75,7 +85,8 @@ getAndroidLibraryVariants().each { variant -> delete destinationDirPath } - task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { + def javadocTask = task("${variant.name}Javadoc", type: Javadoc) { + classifier = 'javadoc' // Get the variant from each subproject that matches our current variant's name. def childEquivalentChildVariants = getAndroidChildren().collect { project -> @@ -83,7 +94,11 @@ getAndroidLibraryVariants().each { variant -> }.sum() source = childEquivalentChildVariants.collect { it.javaCompile.source } - classpath = files(childEquivalentChildVariants.collect { files(it.javaCompile.classpath.files, androidJar) }) + source += javaProjects.collect { it.sourceSets.main.allJava } + classpath = files(childEquivalentChildVariants.collect { + files(it.javaCompile.classpath.files, androidJar) + }) + classpath += javaProjects.collect { files(it.configurations.compile) } options { links("http://docs.oracle.com/javase/7/docs/api/") @@ -94,55 +109,37 @@ getAndroidLibraryVariants().each { variant -> exclude '**/R.java' destinationDir = new File(destinationDirPath) - - dependsOn("clean${variant.name.capitalize()}Javadoc") - } -} - -task addChildJarTasks { - configure(getAndroidChildren()) { project -> - def copyTask = task("makeJar", type: Copy) { - from("${project.buildDir}/intermediates/bundles/release/") - into("${project.buildDir}/lib") - include('classes.jar') - rename('classes.jar', "${project.name}.jar") - } - copyTask.dependsOn project.build - } -} - -task childJars(type: Copy) { - destinationDir = file("${buildDir}/lib") - - into("${buildDir}/lib") { - getAndroidChildren().each { p -> - from(p.tasks.getByName("makeJar")*.outputs) - } } + javadocTask.dependsOn("clean${variant.name.capitalize()}Javadoc") } -task cleanChildJars(type: Delete) { - delete "${buildDir}/lib" -} - -childJars.dependsOn(addChildJarTasks, cleanChildJars) - -def binDirName = "bin" +/** Build a fat jar of all internal dependencies */ +def releaseJarOut = 'bin' task releaseJar(type: Jar) { - from(file("${buildDir}/lib").listFiles().collect { zipTree(it)}) - into("${buildDir}/lib") - destinationDir = file(binDirName) + from files( + releaseVariantAndroidProjects.collect { variant -> + variant.javaCompile.destinationDir + } + ) + exclude "**/R.class" + exclude "**/BuildConfig.class" + from files(javaProjects.collect { it.sourceSets.main.output }) + + destinationDir = file(releaseJarOut) baseName = "glide-${VERSION_NAME}" } -task cleanJar(type: Delete) { - delete binDirName +task cleanReleaseJar(type: Delete) { + delete releaseJarOut } +releaseJar.dependsOn(cleanReleaseJar) -releaseJar.dependsOn(cleanJar, childJars) +allProjects.each { project -> + releaseJar.dependsOn(project.tasks.getByName("checkstyle")) + releaseJar.dependsOn(project.build) +} artifacts { archives releaseJar } - diff --git a/gradle.properties b/gradle.properties index fe9a96fe..5253a2b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,9 +11,6 @@ POM_URL=https://github.com/bumptech/glide POM_SCM_URL=https://github.com/bumptech/glide POM_SCM_CONNECTION=scm:git@github.com:bumptech/glide.git POM_SCM_DEV_CONNECTION=scm:git@github.com:bumptech/glide.git -POM_LICENCE_NAME=Simplified BSD License -POM_LICENCE_URL=http://www.opensource.org/licenses/bsd-license -POM_LICENCE_DIST=repo POM_DEVELOPER_ID=sjudd POM_DEVELOPER_NAME=Sam Judd POM_DEVELOPER_EMAIL=judds@google.com diff --git a/integration/volley/build.gradle b/integration/volley/build.gradle index 2d62ba18..f9d86954 100644 --- a/integration/volley/build.gradle +++ b/integration/volley/build.gradle @@ -21,4 +21,4 @@ android { } } -apply from: "https://raw.githubusercontent.com/mcxiaoke/gradle-mvn-push/master/gradle-mvn-push.gradle" +apply from: "$rootProject.projectDir/scripts/upload.gradle" diff --git a/integration/volley/gradle.properties b/integration/volley/gradle.properties index 0f9e81b5..5a27d7f3 100644 --- a/integration/volley/gradle.properties +++ b/integration/volley/gradle.properties @@ -1,6 +1,3 @@ POM_NAME=Glide Volley Integration POM_ARTIFACT_ID=glide-volley-integration POM_PACKAGING=aar -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 diff --git a/library/build.gradle b/library/build.gradle index bd60c4ba..a22f85d2 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -37,16 +37,15 @@ android { } } -apply from: "https://raw.githubusercontent.com/mcxiaoke/gradle-mvn-push/master/gradle-mvn-push.gradle" +apply from: "$rootProject.projectDir/scripts/upload.gradle" // All dependencies are written to the pom file with the default type (.jar). Since we're uploading the gif decoder // as an aar we need to change the type in the pom file to match or maven/gradle wont' be able to find the transitive // dependency. afterEvaluate { - def installer = install.repositories.mavenInstaller def deployer = uploadArchives.repositories.mavenDeployer - [installer, deployer]*.pom*.whenConfigured { pom -> + [deployer]*.pom*.whenConfigured { pom -> pom.dependencies.find { dep -> dep.groupId == 'com.github.bumptech.glide' && dep.artifactId == 'glide-gif-decoder' }.type = "aar" diff --git a/scripts/upload.gradle b/scripts/upload.gradle new file mode 100644 index 00000000..fc3a47ff --- /dev/null +++ b/scripts/upload.gradle @@ -0,0 +1,160 @@ +/* + * 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. + * + * + * Based on: https://github.com/mcxiaoke/gradle-mvn-push/blob/master/gradle-mvn-push.gradle. + */ + +apply plugin: 'maven' +apply plugin: 'signing' + +version = VERSION_NAME +group = GROUP + +def isReleaseBuild() { + return VERSION_NAME.contains("SNAPSHOT") == false +} + +def getReleaseRepositoryUrl() { + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +} + +def getSnapshotRepositoryUrl() { + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" +} + +def getRepositoryUsername() { + return hasProperty('USERNAME') ? USERNAME : (hasProperty('NEXUS_USERNAME')?NEXUS_USERNAME:"") +} + +def getRepositoryPassword() { + return hasProperty('PASSWORD') ? PASSWORD : (hasProperty('NEXUS_PASSWORD')?NEXUS_PASSWORD:"") +} + +afterEvaluate { project -> + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + pom.groupId = GROUP + pom.artifactId = POM_ARTIFACT_ID + pom.version = VERSION_NAME + + repository(url: getReleaseRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + snapshotRepository(url: getSnapshotRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + + pom.project { + name POM_NAME + packaging POM_PACKAGING + description POM_DESCRIPTION + url POM_URL + + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + + licenses { + license { + name "Simplified BSD License" + url "http://www.opensource.org/licenses/bsd-license" + distribution = "repo" + } + license { + name "The Apache Software License, Version 2.0" + url "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution = "repo" + } + } + + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + email POM_DEVELOPER_EMAIL + } + } + } + } + } + } + + signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives + } + + if (project.getPlugins().hasPlugin('android') || project.getPlugins().hasPlugin('android-library')) { + def releaseVariants = project.android.libraryVariants.findAll { variant -> + variant.buildType.name.equalsIgnoreCase("release") + } + + def androidSdkDirectory = project.android.sdkDirectory + + task androidJavadocs(type: Javadoc) { + classifier = 'javadoc' + + source = releaseVariants.collect { it.javaCompile.source } + classpath = files(releaseVariants.collect { files(it.javaCompile.classpath.files, + project.android.bootClasspath) }) + + options { + links("http://docs.oracle.com/javase/7/docs/api/") + linksOffline("http://d.android.com/reference", "${androidSdkDirectory}/docs/reference") + } + + exclude '**/BuildConfig.java' + exclude '**/R.java' + } + + task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { + classifier = 'javadoc' + from androidJavadocs.destinationDir + } + + task androidSourcesJar(type: Jar) { + classifier = 'sources' + from project.android.sourceSets.main.java.source + } + } else { + task sourcesJar(type: Jar, dependsOn:classes) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn:javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + } + + artifacts { + if (project.getPlugins().hasPlugin('android') || project.getPlugins().hasPlugin('android-library')) { + archives androidSourcesJar + archives androidJavadocsJar + } else { + archives sourcesJar + archives javadocJar + } + } +} diff --git a/third_party/disklrucache b/third_party/disklrucache -Subproject 12127d36d2cf2347aef148da3bebc9350e95b18 +Subproject a5e54a90ce3c097108f6dd43cd3aab398c3ebfc diff --git a/third_party/gif_decoder/build.gradle b/third_party/gif_decoder/build.gradle index 29184a80..70e8c43f 100644 --- a/third_party/gif_decoder/build.gradle +++ b/third_party/gif_decoder/build.gradle @@ -11,4 +11,4 @@ android { } } -apply from: "https://raw.githubusercontent.com/mcxiaoke/gradle-mvn-push/master/gradle-mvn-push.gradle" +apply from: "$rootProject.projectDir/scripts/upload.gradle" diff --git a/third_party/gif_decoder/gradle.properties b/third_party/gif_decoder/gradle.properties index 6c3197ee..b22ee21e 100644 --- a/third_party/gif_decoder/gradle.properties +++ b/third_party/gif_decoder/gradle.properties @@ -1,6 +1,3 @@ POM_NAME=Glide Gif Decoder POM_ARTIFACT_ID=glide-gif-decoder POM_PACKAGING=aar -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 |