improve build server performance by allowing disabling of pre-dexing

It seems that Google is finally paying some attention to CI builds with the
emulator, they issued a recommendation:
http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance
This commit is contained in:
Hans-Christoph Steiner 2016-04-05 00:16:00 +02:00
parent aaf5bfe1db
commit 41b2e175c9
2 changed files with 20 additions and 4 deletions

View File

@ -17,7 +17,7 @@ gradle:
# always report on lint errors to the build log
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle
# 'build' means assemble and check
- ./gradlew build || {
- ./gradlew build -PdisablePreDex || {
for log in app/build/reports/*ests/*/*ml; do
echo "read $log here:"
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
@ -40,7 +40,7 @@ gradle:
- ./tools/wait-for-emulator
- adb shell input keyevent 82
- export EXITVALUE=0
- ADB_INSTALL_TIMEOUT=8 ./gradlew connectedCheck || {
- ADB_INSTALL_TIMEOUT=8 ./gradlew connectedCheck -PdisablePreDex || {
adb -e logcat -d '*:E';
echo "get the full logcat here:";
adb -e logcat -d | curl --silent -F 'clbin=<-' https://clbin.com;
@ -57,12 +57,12 @@ gradle:
pmd:
script:
- export GRADLE_USER_HOME=$PWD/.gradle
- ./gradlew pmd
- ./gradlew pmd -PdisablePreDex
checkstyle:
script:
- export GRADLE_USER_HOME=$PWD/.gradle
- ./gradlew checkstyle
- ./gradlew checkstyle -PdisablePreDex
tools:
script:

View File

@ -7,3 +7,19 @@ buildscript {
classpath files('libs/gradle-witness.jar')
}
}
/**
* Improve build server performance by allowing disabling of pre-dexing
* (see http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance.)
*/
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}