mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Better variant support.
This commit is contained in:
parent
354668b6a3
commit
e16892dbdb
10 changed files with 194 additions and 60 deletions
43
src/test/kotlin/com/beust/kobalt/VariantTest.kt
Normal file
43
src/test/kotlin/com/beust/kobalt/VariantTest.kt
Normal file
|
@ -0,0 +1,43 @@
|
|||
package com.beust.kobalt
|
||||
|
||||
import com.beust.kobalt.api.buildType
|
||||
import com.beust.kobalt.api.productFlavor
|
||||
import com.beust.kobalt.plugin.java.JavaProject
|
||||
import org.testng.Assert
|
||||
import org.testng.annotations.DataProvider
|
||||
import org.testng.annotations.Test
|
||||
import java.util.*
|
||||
|
||||
class VariantTest : KobaltTest() {
|
||||
|
||||
@DataProvider(name = "projectVariants")
|
||||
fun projectVariants() = arrayOf(
|
||||
arrayOf(emptySet<String>(), JavaProject().apply {
|
||||
}),
|
||||
arrayOf(hashSetOf("compileDev"), JavaProject().apply {
|
||||
productFlavor("dev") {}
|
||||
}),
|
||||
arrayOf(hashSetOf("compileDev", "compileProd"), JavaProject().apply {
|
||||
productFlavor("dev") {}
|
||||
productFlavor("prod") {}
|
||||
}),
|
||||
arrayOf(hashSetOf("compileDevDebug"), JavaProject().apply {
|
||||
productFlavor("dev") {}
|
||||
buildType("debug") {}
|
||||
}),
|
||||
arrayOf(hashSetOf("compileDevRelease", "compileDevDebug", "compileProdDebug", "compileProdRelease"),
|
||||
JavaProject().apply {
|
||||
productFlavor("dev") {}
|
||||
productFlavor("prod") {}
|
||||
buildType("debug") {}
|
||||
buildType("release") {}
|
||||
})
|
||||
)
|
||||
|
||||
@Test(dataProvider = "projectVariants", description =
|
||||
"Make sure we generate the correct dynamic tasks based on the product flavor and build types.")
|
||||
fun taskNamesShouldWork(expected: Set<String>, project: JavaProject) {
|
||||
val variantNames = HashSet(Variant.allVariants(project).map { it.toTask("compile") })
|
||||
Assert.assertEquals(variantNames, expected)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue