Disable Android pre dexing on CI builds
In Android builds, pre dexing helps to speed up the build for incremental builds. On a CI server, where you usually run a clean build, pre dexing is only adding extra time to the build without any added value. There’s already a tip on the Tools site on this, but how do you disable pre dex for all project on your build server?
13 plus ones
Shared publicly•View activity
- I like to have this in my standard `build.gradle` file for each new project I create, rather than relying on every Jenkins build slave having a global init script in place.
I then let Gradle dynamically disable pre-dexing if it detects that it's running under Jenkins:
`preDexLibraries = System.env.BUILD_NUMBER == null`Mar 10, 2015
- That makes sense. In my case I only have one Jenkins instance and therefore I prefer to keep my build.gradle clean and override settings on Jenkins.Mar 10, 2015
- I think keeping build.gradles clean makes sense. And there are tools out there to automate deploying scripts to all slaves, so I like your approach more, Hugo :)
However, I'm curious why did you choose to write if (A) else if (B) when both branches to exactly the same. Why haven't you just used if (A || B) ?Mar 23, 2015
- Only reason for being more explicit in the post. (a || b) would also work of course.Mar 23, 2015
- How does that know whether it is running on Jenkins?Nov 14, 2016
- When you said in your post: ~"check if the plugin class name matches any of the known Android plugins". How does that decide whether it is running on CI or not?Nov 14, 2016
- The BUILD_NUMBER environment variable exists during a Jenkins build. But in any case, nowadays I prefer to leave pre-dexing enabled, so that the dex cache can be used.Nov 14, 2016
Add a comment...