From 3968ccbc8815409165cec630f28bb44ce350b30a Mon Sep 17 00:00:00 2001 From: Sam Judd Date: Sun, 31 Dec 2017 13:58:49 -0800 Subject: [PATCH] Disable all release variants in Glide. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There’s no difference whatsoever in any of our configurations between the two variants. As a result we’ve been building all of our code and running all of our tests twice, which is slow and doesn’t add any value. It’s a little weird to see that the jars we upload to maven are based on ‘debug’ variants, but that should be fine since we do nothing different for release vs debug builds. We can’t default to the release build only because AndroidStudio and other dev tools assume that the debug variant will be present. --- build.gradle | 8 +++++++- glide/build.gradle | 20 ++++++++++---------- scripts/travis_unit.sh | 2 +- scripts/upload.gradle | 16 ++++++++-------- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index 9b8145722b..58f0505ac2 100644 --- a/build.gradle +++ b/build.gradle @@ -69,6 +69,12 @@ subprojects { project -> abortOnError false } } + + android.variantFilter { variant -> + if(variant.buildType.name == 'release') { + variant.setIgnore(true) + } + } } } } @@ -113,7 +119,7 @@ subprojects { project -> diffMaxViolations = 0 // Formats are listed here: https://github.com/tomasbjerre/violations-lib - def dir = projectDir.absolutePath; + def dir = projectDir.absolutePath violations = [ ["FINDBUGS", dir, ".*/findbugs/.*\\.xml\$", "Findbugs"], ["PMD", dir, ".*/pmd/.*\\.xml\$", "PMD"], diff --git a/glide/build.gradle b/glide/build.gradle index bb7a98b701..ac0ec536a3 100644 --- a/glide/build.gradle +++ b/glide/build.gradle @@ -61,8 +61,8 @@ def getInternalJavaProjectsForJavadoc() { asProjects(getJavaPathsForJavadoc()) } -def getReleaseVariantAndroidProjectsForJar() { - getAndroidLibraryVariantsForJar('release') +def getAndroidProjectsForJar() { + getAndroidLibraryVariantsForJar('debug') } def getAndroidLibraryVariantsForJar(variantName) { @@ -102,7 +102,7 @@ project.archivesBaseName = "${POM_ARTIFACT_ID}-${VERSION_NAME}" // Generate javadocs and sources containing batched documentation and sources for all internal // projects. -['release'].each { variantName -> +['debug'].each { variantName -> task("${variantName}SourceJar", type: Jar) { from getSourceFilesForVariantJar(variantName) @@ -131,7 +131,7 @@ project.archivesBaseName = "${POM_ARTIFACT_ID}-${VERSION_NAME}" // Finds dependencies of Android packages that would otherwise be // ignored (Volley in particular) getInternalAndroidProjectsForJavadoc().collect { Project project -> - project.file('build/intermediates/classes/release') + project.file('build/intermediates/classes/debug') } ) } @@ -161,7 +161,7 @@ project.archivesBaseName = "${POM_ARTIFACT_ID}-${VERSION_NAME}" jar { from files( - getReleaseVariantAndroidProjectsForJar().collect { LibraryVariant variant -> + getAndroidProjectsForJar().collect { LibraryVariant variant -> variant.getJavaCompiler().destinationDir } ) @@ -174,21 +174,21 @@ jar { (getInternalAndroidProjectsForJar() + getInternalAndroidProjectsForJavadoc()).each { project -> - releaseJavadoc.dependsOn(project.tasks.compileReleaseSources) - jar.dependsOn(project.tasks.compileReleaseSources) + debugJavadoc.dependsOn(project.tasks.compileDebugSources) + jar.dependsOn(project.tasks.compileDebugSources) } (getInternalJavaProjectsForJar() + getInternalJavaProjectsForJavadoc()).each { project -> - releaseJavadoc.dependsOn(project.tasks.compileJava) + debugJavadoc.dependsOn(project.tasks.compileJava) jar.dependsOn(project.tasks.compileJava) } artifacts { - archives releaseJavadocJar { + archives debugJavadocJar { classifier 'javadoc' } - archives releaseSourceJar { + archives debugSourceJar { classifier 'sources' } } diff --git a/scripts/travis_unit.sh b/scripts/travis_unit.sh index bc2f576d3d..ec19192f60 100755 --- a/scripts/travis_unit.sh +++ b/scripts/travis_unit.sh @@ -9,4 +9,4 @@ set -e -x :samples:gallery:build \ -x :samples:imgur:build \ -x :samples:svg:build \ - -x testReleaseUnitTest --parallel + --parallel diff --git a/scripts/upload.gradle b/scripts/upload.gradle index 2d5c30073d..b6922c9698 100644 --- a/scripts/upload.gradle +++ b/scripts/upload.gradle @@ -130,22 +130,22 @@ afterEvaluate { project -> def isAndroidProject = project.plugins.hasPlugin('com.android.application') || project.plugins.hasPlugin('com.android.library') if (isAndroidProject) { - def releaseVariants = project.android.libraryVariants.findAll { - it.buildType.name.equalsIgnoreCase('release') + def variants = project.android.libraryVariants.findAll { + it.buildType.name.equalsIgnoreCase('debug') } def getAndroidSdkDirectory = project.android.sdkDirectory def getAndroidJar = "${getAndroidSdkDirectory}/platforms/${project.android.compileSdkVersion}/android.jar" - task androidJavadocs(type: Javadoc, dependsOn: assembleRelease) { - source = releaseVariants.collect { it.javaCompile.source } + task androidJavadocs(type: Javadoc, dependsOn: assembleDebug) { + source = variants.collect { it.javaCompile.source } classpath = files( getAndroidJar, - project.file("build/intermediates/classes/release") + project.file("build/intermediates/classes/debug") ) doFirst { - classpath += files(releaseVariants.collect { it.javaCompile.classpath.files }) + classpath += files(variants.collect { it.javaCompile.classpath.files }) } options { links("http://docs.oracle.com/javase/7/docs/api/") @@ -174,8 +174,8 @@ afterEvaluate { project -> baseName "${JAR_PREFIX}${project.name}${JAR_POSTFIX}" } - task androidLibraryJar(type: Jar, dependsOn: compileReleaseJavaWithJavac /* == variant.javaCompile */) { - from compileReleaseJavaWithJavac.destinationDir + task androidLibraryJar(type: Jar, dependsOn: compileDebugJavaWithJavac /* == variant.javaCompile */) { + from compileDebugJavaWithJavac.destinationDir exclude '**/R.class' exclude '**/BuildConfig.class' exclude '**/R$*.class'