Skip to content

Commit

Permalink
Another experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
isuPatches committed Oct 29, 2016
1 parent 52fa359 commit 9e00962
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ before_script:
- chmod +x ./wait_for_emulator.sh
- ./wait_for_emulator.sh
- adb devices
- adb shell input keyevent 82 &
- adb shell input keyevent 82 &

script:
- ./gradlew clean check connectedCheck -x library:signArchives -PdisablePreDex
10 changes: 0 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,7 @@ dexcount {
verbose = false
}

ext {
travisBuild = System.getenv("TRAVIS") == "true"
// allows for -Dpre-dex=false to be set
preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
}

android {
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
}

testOptions {
// Allows Android code to be called from unit tests without causing a crash.
Expand Down
18 changes: 18 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,21 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

/**
* 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 (rootProject.ext.has('preDexLibs')) {
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
}
}
}
}

0 comments on commit 9e00962

Please sign in to comment.