Skip to content

Commit

Permalink
Don't publish :glide as anything to Maven repos
Browse files Browse the repository at this point in the history
Build :glide as 'glide-full' to have a flat jar to be published on GitHub/releases
Publish :library as 'group:glide' as AAR and JAR to Maven repos
Make :third_party:gif_decoder and :third_party:disklrucache first-class published gradle dependencies
Remove duplicated repositories, JAR_PREFIX, JAR_POSTFIX declarations (pull constants up to :integration and :third_party level)
Fix JavaDoc generation (Error reading file: ${androidSdkDirectory}\docs\reference\package-list)
Move JAR generation to upload.gradle (from integration/build.gradle) so it's used by :library as well
Add javadoc and sources JAR generation to upload.gradle for non-android projects as well
  • Loading branch information
TWiStErRob committed Jan 11, 2016
1 parent 734c54c commit c898281
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 83 deletions.
4 changes: 2 additions & 2 deletions glide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def getAndroidJar() {
"${getAndroidSdkDirectory()}/platforms/${getAndroidCompileSdkVersion()}/android.jar"
}

project.archivesBaseName = "${POM_ARTIFACT_ID}-${VERSION_NAME}"

// Generate javadocs and sources containing batched documentation and sources for all internal projects.
['release', 'debug'].each { variantName ->

Expand Down Expand Up @@ -102,5 +104,3 @@ artifacts {
classifier 'sources'
}
}

apply from: "$rootProject.projectDir/scripts/upload.gradle"
5 changes: 2 additions & 3 deletions glide/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
POM_NAME=Glide
POM_ARTIFACT_ID=glide
POM_NAME=Glide Full
POM_ARTIFACT_ID=glide-full
POM_PACKAGING=jar

16 changes: 1 addition & 15 deletions integration/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
evaluationDependsOnChildren()

import com.android.build.gradle.api.BaseVariant
subprojects {
android.libraryVariants.all { BaseVariant variant ->
def jarTask = project.tasks.create(name: "jar${variant.name.capitalize()}", type: Jar) {
from variant.javaCompile.destinationDir
exclude "**/R.class"
exclude "**/BuildConfig.class"
baseName "glide-${project.name}-integration"
}
jarTask.dependsOn variant.javaCompile
artifacts.add('archives', jarTask);
}
}
// keep an empty file to make sure Gradle recognizes the properties
8 changes: 2 additions & 6 deletions integration/gifencoder/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
apply plugin: 'com.android.library'
apply plugin: 'org.robolectric'

repositories {
mavenCentral()
}

dependencies {
compile project(':glide')
compile project(':library')

testCompile project(":testutil")
testCompile "com.google.truth:truth:${TRUTH_VERSION}"
Expand Down Expand Up @@ -40,4 +36,4 @@ android {
}
}

apply from: "$rootProject.projectDir/scripts/upload.gradle"
apply from: "${rootProject.projectDir}/scripts/upload.gradle"
4 changes: 0 additions & 4 deletions integration/gifencoder/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ VERSION_PATCH=0
VERSION_CODE=8

POM_DESCRIPTION=An integration library allowing users to re-encode or create animated GIFs

# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=-integration
3 changes: 3 additions & 0 deletions integration/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=-integration
8 changes: 2 additions & 6 deletions integration/okhttp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
apply plugin: 'com.android.library'

repositories {
mavenCentral()
}

dependencies {
compile project(':glide')
compile project(':library')

compile "com.squareup.okhttp:okhttp:2.7.1"
}
Expand All @@ -28,4 +24,4 @@ android {
}
}

apply from: "$rootProject.projectDir/scripts/upload.gradle"
apply from: "${rootProject.projectDir}/scripts/upload.gradle"
4 changes: 0 additions & 4 deletions integration/okhttp/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ VERSION_PATCH=0
VERSION_CODE=8

POM_DESCRIPTION=An integration library to use OkHttp 2.x to fetch data over http/https in Glide

# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=-integration
8 changes: 2 additions & 6 deletions integration/okhttp3/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
apply plugin: 'com.android.library'

repositories {
mavenCentral()
}

dependencies {
compile project(':glide')
compile project(':library')

compile "com.squareup.okhttp3:okhttp:${OK_HTTP_VERSION}"
}
Expand All @@ -28,4 +24,4 @@ android {
}
}

apply from: "$rootProject.projectDir/scripts/upload.gradle"
apply from: "${rootProject.projectDir}/scripts/upload.gradle"
4 changes: 0 additions & 4 deletions integration/okhttp3/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ VERSION_PATCH=0
VERSION_CODE=8

POM_DESCRIPTION=An integration library to use OkHttp 3.x to fetch data over http/https in Glide

# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=-integration
8 changes: 2 additions & 6 deletions integration/recyclerview/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
apply plugin: 'com.android.library'

repositories {
mavenCentral()
}

dependencies {
compile project(':glide')
compile project(':library')
compile "com.android.support:recyclerview-v7:${SUPPORT_V7_VERSION}"
compile "com.android.support:support-v4:${SUPPORT_V4_VERSION}"
}
Expand All @@ -28,4 +24,4 @@ android {
}
}

apply from: "$rootProject.projectDir/scripts/upload.gradle"
apply from: "${rootProject.projectDir}/scripts/upload.gradle"
4 changes: 0 additions & 4 deletions integration/recyclerview/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ VERSION_PATCH=0
VERSION_CODE=8

POM_DESCRIPTION=An integration library to display images in RecyclerView.

# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=-integration
8 changes: 2 additions & 6 deletions integration/volley/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
apply plugin: 'com.android.library'
apply plugin: 'org.robolectric'

repositories {
mavenCentral()
}

dependencies {
compile project(':glide')
compile project(':library')
compile "com.mcxiaoke.volley:library:${VOLLEY_VERSION}"

testCompile project(":testutil")
Expand Down Expand Up @@ -35,4 +31,4 @@ android {
}
}

apply from: "$rootProject.projectDir/scripts/upload.gradle"
apply from: "${rootProject.projectDir}/scripts/upload.gradle"
4 changes: 0 additions & 4 deletions integration/volley/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ VERSION_PATCH=0
VERSION_CODE=8

POM_DESCRIPTION=An integration library to use Volley to fetch data over http/https in Glide

# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=-integration
2 changes: 2 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ afterEvaluate {
}
}
}

apply from: "${rootProject.projectDir}/scripts/upload.gradle"
8 changes: 6 additions & 2 deletions library/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
POM_NAME=Glide Library
POM_ARTIFACT_ID=library
POM_NAME=Glide
POM_ARTIFACT_ID=glide
POM_PACKAGING=aar

# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=
10 changes: 3 additions & 7 deletions samples/svg/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apply plugin: 'com.android.application'

repositories {
mavenCentral()
dependencies {
compile project(':library')
compile 'com.caverock:androidsvg:1.2.1'
}

android {
Expand All @@ -23,11 +24,6 @@ android {
}
}

dependencies {
compile project(':library')
compile 'com.caverock:androidsvg:1.2.1'
}

task run(type: Exec, dependsOn: 'installDebug') {
description 'Installs the APK and runs the main activity: "gradlew :samples:???:run"'
commandLine "${android.sdkDirectory}/platform-tools/adb", 'shell', 'am', 'start', '-n', 'com.bumptech.glide.samples.svg/.MainActivity'
Expand Down
33 changes: 30 additions & 3 deletions scripts/upload.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*
*
* Based on: https://github.com/mcxiaoke/gradle-mvn-push/blob/master/gradle-mvn-push.gradle.
* Local test with (..._REPOSITORY_URL properties must be full paths):
* gradlew clean buildArchives uploadArchives --stacktrace --info -PSNAPSHOT_REPOSITORY_URL=file://p:\projects\contrib\github-glide\repo-snapshot -PRELEASE_REPOSITORY_URL=file://p:\projects\contrib\github-glide\repo-release
* For faster runs add: -x check
*
*/

apply plugin: 'maven'
Expand Down Expand Up @@ -113,16 +117,14 @@ afterEvaluate { project ->
it.buildType.name.equalsIgnoreCase('release')
}

def androidSdkDirectory = project.android.sdkDirectory

task androidJavadocs(type: Javadoc, dependsOn: compileReleaseJava) {
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')
linksOffline('http://d.android.com/reference', "${android.sdkDirectory}/docs/reference")
}

exclude '**/BuildConfig.java'
Expand All @@ -141,9 +143,34 @@ afterEvaluate { project ->
baseName "${JAR_PREFIX}${project.name}${JAR_POSTFIX}"
}

task androidLibraryJar(type: Jar, dependsOn: compileReleaseJava /* == variant.javaCompile */) {
from compileReleaseJava.destinationDir
exclude '**/R.class'
exclude '**/BuildConfig.class'
baseName "${JAR_PREFIX}${project.name}${JAR_POSTFIX}"
}

artifacts {
archives androidLibraryJar
archives androidSourcesJar
archives androidJavadocsJar
}
} else if (project.plugins.hasPlugin('java')) {
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocsJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocsJar
}
}
logger.info("Published artifacts in ${configurations.archives}:")
configurations.archives.artifacts.files.files.each { logger.info("\t$it"); }
}
2 changes: 1 addition & 1 deletion third_party/disklrucache
2 changes: 2 additions & 0 deletions third_party/gif_decoder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ android {
targetSdkVersion TARGET_SDK_VERSION as int
}
}

apply from: "${rootProject.projectDir}/scripts/upload.gradle"
11 changes: 11 additions & 0 deletions third_party/gif_decoder/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
POM_NAME=Glide Gif Decoder Library
POM_ARTIFACT_ID=gifdecoder
POM_PACKAGING=aar

VERSION_NAME=1.0.0-SNAPSHOT
VERSION_MAJOR=1
VERSION_MINOR=0
VERSION_PATCH=0
VERSION_CODE=1

POM_DESCRIPTION=Implementation of GifDecoder that is more memory efficient to animate for Android devices.
3 changes: 3 additions & 0 deletions third_party/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Prefix and postfix for source and javadoc jars.
JAR_PREFIX=glide-
JAR_POSTFIX=-thirdparty

0 comments on commit c898281

Please sign in to comment.