Last active
March 25, 2024 16:49
-
-
Save SelvinPL/0cf9e0ddce3b1778a9b8bd001f1ce53c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PropExtension extends Closure { | |
final map = [:] | |
PropExtension() { | |
super(null) | |
} | |
def methodMissing(String name, args) { | |
map[name] = args[0] | |
} | |
} | |
android { | |
productFlavors.configureEach { flavour -> | |
flavour.extensions.create("customProperties", PropExtension) | |
} | |
} | |
android.applicationVariants.configureEach { variant -> | |
var map = variant.productFlavors.find({ it.dimension == 'other' }).extensions.customProperties.map | |
//do something based on map | |
println map | |
} | |
android { | |
flavorDimensions = ['other'] | |
//.... | |
productFlavors { | |
flavorA { | |
dimension "other" | |
customProperties { | |
propertyB "property2" | |
} | |
} | |
flavorB { | |
dimension "other" | |
customProperties { | |
propertyA "property1bis" | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment