When you configure a set of variant dimensions (platforms/buildTypes/flavors) you’re configuring the entire possible set of binary variants that can be built.
There are a couple of ways of restricting the set that will be built:
- Allow Gradle to choose what should be built by building the top-level executable/libraries required, with Gradle building the required library dependencies.
- Target a component at a restricted subset of variant dimensions: http ://www.gradle.org/docs/nightly/userguide/nativeBinaries.html#N15EFE
- Only calling the tasks for the binaries you want to build (or creating a task that depends on these binaries)
- Setting the ‘buildable’ flag to false for any binary you don’t want built
binaries.all {
if (platform.operatingSystem.macOsX) {
if (buildType == buildTypes.release) {
if (flavor.name != “export”) {
buildable = false
}
}
}
} task buildAll {dependsOn binaries.matching {
it.buildable
} }