Skip to content

Instantly share code, notes, and snippets.

@trevorrjohn
Created April 30, 2014 19:27
Show Gist options
  • Save trevorrjohn/d505c8281d80c26a0409 to your computer and use it in GitHub Desktop.
Save trevorrjohn/d505c8281d80c26a0409 to your computer and use it in GitHub Desktop.
Build on whitelisted flavors
{
// Preferences => Compiler => Gradle => VM Options. Add -DflavorWhitelist=flavor1,flavor2
// Omit -DflavorWhitelist for all flavors.
def flavorMap = [
flavor1: {
// flavor stuff
},
flavor2 : {
// flavor 2 stuff
}
]
def whitelist = flavorMap.keySet()
def whitelistProp = System.getProperty("flavorWhitelist")
if (whitelistProp != null) {
whitelist = whitelistProp.split(",")
}
whitelist.each { flavorName ->
"$flavorName" flavorMap.get(flavorName)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment