1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Preliminary support for product flavors and build types.

This commit is contained in:
Cedric Beust 2015-11-19 02:11:08 -08:00
parent 77ebee8670
commit 3b741d3a5d

View file

@ -94,6 +94,20 @@ open public class Project(
/** Used to disambiguate various name properties */
@Directive
val projectName: String get() = name
private val productFlavors = hashMapOf<String, ProductFlavorConfig>()
fun addProductFlavor(name: String, pf: ProductFlavorConfig) {
println("Adding ProductFlavor $name")
productFlavors.put(name, pf)
}
private val buildTypes = hashMapOf<String, BuildTypeConfig>()
fun addBuildType(name: String, bt: BuildTypeConfig) {
println("Adding BuildType $name")
buildTypes.put(name, bt)
}
}
public class Sources(val project: Project, val sources: HashSet<String>) {
@ -132,4 +146,23 @@ public class License(val name: String, val url: String) {
return result
}
}
}
class ProductFlavorConfig {
var description: String = ""
}
@Directive
fun Project.productFlavor(name: String, init: ProductFlavorConfig.() -> Unit) = ProductFlavorConfig().apply {
init()
addProductFlavor(name, this)
}
class BuildTypeConfig {
}
@Directive
fun Project.buildType(name: String, init: BuildTypeConfig.() -> Unit) = BuildTypeConfig().apply {
init()
addBuildType(name, this)
}