[Gradle/MPP] Replace android -> androidTarget in functionalTests
This commit is contained in:
committed by
Space Team
parent
70c9d6dc44
commit
5eaa6696f4
+2
-2
@@ -36,14 +36,14 @@ class IdeAndroidDependencyResolutionTest {
|
|||||||
repositories.mavenCentralCacheRedirector()
|
repositories.mavenCentralCacheRedirector()
|
||||||
|
|
||||||
multiplatformExtension.apply {
|
multiplatformExtension.apply {
|
||||||
android()
|
androidTarget()
|
||||||
sourceSets.getByName("commonMain").dependencies {
|
sourceSets.getByName("commonMain").dependencies {
|
||||||
implementation("com.arkivanov.mvikotlin:mvikotlin:3.0.2")
|
implementation("com.arkivanov.mvikotlin:mvikotlin:3.0.2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.evaluate()
|
}.evaluate()
|
||||||
|
|
||||||
private val androidSourceSets = project.multiplatformExtension.android().compilations.flatMap { it.kotlinSourceSets }
|
private val androidSourceSets = project.multiplatformExtension.androidTarget().compilations.flatMap { it.kotlinSourceSets }
|
||||||
.ifEmpty { fail("Expected at least one Android SourceSet") }
|
.ifEmpty { fail("Expected at least one Android SourceSet") }
|
||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
|
|||||||
+1
-1
@@ -99,7 +99,7 @@ class IdeBinaryDependencyResolverTest {
|
|||||||
/* Setup android target and add MVIKotlin dependency */
|
/* Setup android target and add MVIKotlin dependency */
|
||||||
val kotlin = project.multiplatformExtension
|
val kotlin = project.multiplatformExtension
|
||||||
kotlin.targetHierarchy.default()
|
kotlin.targetHierarchy.default()
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
val commonMain = kotlin.sourceSets.getByName("commonMain")
|
val commonMain = kotlin.sourceSets.getByName("commonMain")
|
||||||
commonMain.dependencies {
|
commonMain.dependencies {
|
||||||
implementation("com.arkivanov.mvikotlin:mvikotlin:3.0.2")
|
implementation("com.arkivanov.mvikotlin:mvikotlin:3.0.2")
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ class IdeJvmAndAndroidDependencyResolutionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
project.multiplatformExtension.jvm()
|
project.multiplatformExtension.jvm()
|
||||||
project.multiplatformExtension.android()
|
project.multiplatformExtension.androidTarget()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ class IdeSourceDependencyResolutionTest {
|
|||||||
linuxX64()
|
linuxX64()
|
||||||
linuxArm64()
|
linuxArm64()
|
||||||
jvm()
|
jvm()
|
||||||
android()
|
androidTarget()
|
||||||
|
|
||||||
sourceSets.getByName("commonMain").let { commonMain ->
|
sourceSets.getByName("commonMain").let { commonMain ->
|
||||||
sourceSets.create("jvmAndAndroidMain").let { jvmAndAndroidMain ->
|
sourceSets.create("jvmAndAndroidMain").let { jvmAndAndroidMain ->
|
||||||
|
|||||||
+1
-1
@@ -121,7 +121,7 @@ class IdeSourceSetConstraintTest {
|
|||||||
val project = buildMppProjectWithAndroidPlugin()
|
val project = buildMppProjectWithAndroidPlugin()
|
||||||
val kotlin = project.multiplatformExtension
|
val kotlin = project.multiplatformExtension
|
||||||
kotlin.jvm()
|
kotlin.jvm()
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
val commonMain = kotlin.sourceSets.getByName("commonMain")
|
val commonMain = kotlin.sourceSets.getByName("commonMain")
|
||||||
val commonTest = kotlin.sourceSets.getByName("commonTest")
|
val commonTest = kotlin.sourceSets.getByName("commonTest")
|
||||||
|
|||||||
+1
-1
@@ -198,7 +198,7 @@ class IdeStdlibResolutionTest {
|
|||||||
val project = createProjectWithAndroidAndDefaultStdlibEnabled()
|
val project = createProjectWithAndroidAndDefaultStdlibEnabled()
|
||||||
|
|
||||||
val kotlin = project.multiplatformExtension
|
val kotlin = project.multiplatformExtension
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
kotlin.jvm()
|
kotlin.jvm()
|
||||||
|
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
|
|||||||
+1
-1
@@ -85,7 +85,7 @@ class IdeTransformedMetadataDependencyResolverTest {
|
|||||||
val kotlin = project.multiplatformExtension
|
val kotlin = project.multiplatformExtension
|
||||||
|
|
||||||
kotlin.jvm()
|
kotlin.jvm()
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
val commonMain = kotlin.sourceSets.getByName("commonMain")
|
val commonMain = kotlin.sourceSets.getByName("commonMain")
|
||||||
val commonTest = kotlin.sourceSets.getByName("commonTest")
|
val commonTest = kotlin.sourceSets.getByName("commonTest")
|
||||||
|
|||||||
+1
-1
@@ -269,7 +269,7 @@ class ConfigurationsTest : MultiplatformExtensionTest() {
|
|||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
js(BOTH)
|
js(BOTH)
|
||||||
linuxX64("linux")
|
linuxX64("linux")
|
||||||
android()
|
androidTarget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ class JvmAndAndroidIntermediateSourceSetTest {
|
|||||||
/* Kotlin Setup */
|
/* Kotlin Setup */
|
||||||
kotlin = project.multiplatformExtension
|
kotlin = project.multiplatformExtension
|
||||||
kotlin.jvm()
|
kotlin.jvm()
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
jvmAndAndroidMain = kotlin.sourceSets.create("jvmAndAndroidMain")
|
jvmAndAndroidMain = kotlin.sourceSets.create("jvmAndAndroidMain")
|
||||||
kotlin.sourceSets.run {
|
kotlin.sourceSets.run {
|
||||||
jvmAndAndroidMain.dependsOn(getByName("commonMain"))
|
jvmAndAndroidMain.dependsOn(getByName("commonMain"))
|
||||||
|
|||||||
+2
-2
@@ -30,7 +30,7 @@ class KT41641AbsentAndroidTarget : MultiplatformExtensionTest() {
|
|||||||
|
|
||||||
/* Previously failed with 'Collection is empty.' */
|
/* Previously failed with 'Collection is empty.' */
|
||||||
assertNull(project.findAndroidTarget())
|
assertNull(project.findAndroidTarget())
|
||||||
assertSame(kotlin.android(), project.findAndroidTarget())
|
assertSame(kotlin.androidTarget(), project.findAndroidTarget())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -50,7 +50,7 @@ class KT41641AbsentAndroidTarget : MultiplatformExtensionTest() {
|
|||||||
assertNotNull(warningMessage, "Expected warning message to be logged")
|
assertNotNull(warningMessage, "Expected warning message to be logged")
|
||||||
|
|
||||||
// Present android target -> expect no warning message anymore
|
// Present android target -> expect no warning message anymore
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
project.runMissingAndroidTargetProjectConfigurationHealthCheck(warningLogger = {
|
project.runMissingAndroidTargetProjectConfigurationHealthCheck(warningLogger = {
|
||||||
fail("Expected no warning message to be logged. Received: $it")
|
fail("Expected no warning message to be logged. Received: $it")
|
||||||
})
|
})
|
||||||
|
|||||||
+2
-2
@@ -81,7 +81,7 @@ class BuildKotlinToolingMetadataTest {
|
|||||||
val kotlin = multiplatformExtension
|
val kotlin = multiplatformExtension
|
||||||
|
|
||||||
android.compileSdkVersion(28)
|
android.compileSdkVersion(28)
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
kotlin.jvm()
|
kotlin.jvm()
|
||||||
kotlin.js {
|
kotlin.js {
|
||||||
nodejs()
|
nodejs()
|
||||||
@@ -125,7 +125,7 @@ class BuildKotlinToolingMetadataTest {
|
|||||||
val android = project.extensions.getByType(BaseExtension::class.java)
|
val android = project.extensions.getByType(BaseExtension::class.java)
|
||||||
val kotlin = multiplatformExtension
|
val kotlin = multiplatformExtension
|
||||||
android.compileSdkVersion(28)
|
android.compileSdkVersion(28)
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
android.compileOptions.setSourceCompatibility(JavaVersion.VERSION_1_6)
|
android.compileOptions.setSourceCompatibility(JavaVersion.VERSION_1_6)
|
||||||
android.compileOptions.setTargetCompatibility(JavaVersion.VERSION_1_8)
|
android.compileOptions.setTargetCompatibility(JavaVersion.VERSION_1_8)
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ class KotlinAndroidDependsOnEdgesTest {
|
|||||||
|
|
||||||
/* Minimal MPP setup */
|
/* Minimal MPP setup */
|
||||||
val kotlin = project.kotlinExtension as KotlinMultiplatformExtension
|
val kotlin = project.kotlinExtension as KotlinMultiplatformExtension
|
||||||
kotlin.android("android")
|
kotlin.androidTarget("android")
|
||||||
|
|
||||||
/* Force evaluation */
|
/* Force evaluation */
|
||||||
project as ProjectInternal
|
project as ProjectInternal
|
||||||
@@ -71,7 +71,7 @@ class KotlinAndroidDependsOnEdgesTest {
|
|||||||
|
|
||||||
/* Custom MPP setup */
|
/* Custom MPP setup */
|
||||||
val kotlin = project.kotlinExtension as KotlinMultiplatformExtension
|
val kotlin = project.kotlinExtension as KotlinMultiplatformExtension
|
||||||
kotlin.android("android")
|
kotlin.androidTarget("android")
|
||||||
kotlin.sourceSets.apply {
|
kotlin.sourceSets.apply {
|
||||||
val jvmMain = create("jvmMain") {
|
val jvmMain = create("jvmMain") {
|
||||||
it.dependsOn(getByName("commonMain"))
|
it.dependsOn(getByName("commonMain"))
|
||||||
|
|||||||
+2
-2
@@ -63,7 +63,7 @@ class KotlinAndroidTargetHierarchyDsl {
|
|||||||
|
|
||||||
val kotlin = project.multiplatformExtension
|
val kotlin = project.multiplatformExtension
|
||||||
project.runLifecycleAwareTest {
|
project.runLifecycleAwareTest {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
kotlin.targetHierarchy.android {
|
kotlin.targetHierarchy.android {
|
||||||
unitTest.sourceSetTree.set(KotlinTargetHierarchy.SourceSetTree.test)
|
unitTest.sourceSetTree.set(KotlinTargetHierarchy.SourceSetTree.test)
|
||||||
@@ -87,7 +87,7 @@ class KotlinAndroidTargetHierarchyDsl {
|
|||||||
|
|
||||||
val kotlin = project.multiplatformExtension
|
val kotlin = project.multiplatformExtension
|
||||||
project.runLifecycleAwareTest {
|
project.runLifecycleAwareTest {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
kotlin.targetHierarchy.android {
|
kotlin.targetHierarchy.android {
|
||||||
unitTest.sourceSetTree.set(KotlinTargetHierarchy.SourceSetTree("xxx"))
|
unitTest.sourceSetTree.set(KotlinTargetHierarchy.SourceSetTree("xxx"))
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ class KotlinMultiplatformAndroidGradlePluginCompatibilityHealthCheckTest {
|
|||||||
val project by lazy {
|
val project by lazy {
|
||||||
buildProjectWithMPP {
|
buildProjectWithMPP {
|
||||||
plugins.apply(LibraryPlugin::class.java)
|
plugins.apply(LibraryPlugin::class.java)
|
||||||
kotlin { android() }
|
kotlin { androidTarget() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -180,7 +180,7 @@ class KotlinTargetHierarchyDslTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
kotlin.jvm()
|
kotlin.jvm()
|
||||||
|
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
@@ -208,7 +208,7 @@ class KotlinTargetHierarchyDslTest {
|
|||||||
/* Check all source sets: All from jvm and android target + expected common source sets */
|
/* Check all source sets: All from jvm and android target + expected common source sets */
|
||||||
assertEquals(
|
assertEquals(
|
||||||
setOf("commonMain", "commonTest", "jvmAndAndroidMain", "jvmAndAndroidTest") +
|
setOf("commonMain", "commonTest", "jvmAndAndroidMain", "jvmAndAndroidTest") +
|
||||||
kotlin.android().compilations.flatMap { it.kotlinSourceSets }.map { it.name } +
|
kotlin.androidTarget().compilations.flatMap { it.kotlinSourceSets }.map { it.name } +
|
||||||
kotlin.jvm().compilations.flatMap { it.kotlinSourceSets }.map { it.name },
|
kotlin.jvm().compilations.flatMap { it.kotlinSourceSets }.map { it.name },
|
||||||
kotlin.sourceSets.map { it.name }.toStringSet()
|
kotlin.sourceSets.map { it.name }.toStringSet()
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ class WhenEvaluatedAndroidOrderingTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
project.applyAndroidLibraryPlugin()
|
project.applyAndroidLibraryPlugin()
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -47,7 +47,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `main source set with default settings`() {
|
fun `main source set with default settings`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
val kotlinAndroidMainSourceSet = kotlin.sourceSets.getByName("androidMain")
|
val kotlinAndroidMainSourceSet = kotlin.sourceSets.getByName("androidMain")
|
||||||
val androidMainSourceSet = android.sourceSets.getByName("main")
|
val androidMainSourceSet = android.sourceSets.getByName("main")
|
||||||
@@ -62,7 +62,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test source set with default settings`() {
|
fun `test source set with default settings`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
val kotlinAndroidTestSourceSet = kotlin.sourceSets.getByName("androidTest")
|
val kotlinAndroidTestSourceSet = kotlin.sourceSets.getByName("androidTest")
|
||||||
val testSourceSet = android.sourceSets.getByName("test")
|
val testSourceSet = android.sourceSets.getByName("test")
|
||||||
@@ -77,7 +77,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `androidTest source set with default settings`() {
|
fun `androidTest source set with default settings`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
val kotlinAndroidAndroidTestSourceSet = kotlin.sourceSets.getByName("androidAndroidTest")
|
val kotlinAndroidAndroidTestSourceSet = kotlin.sourceSets.getByName("androidAndroidTest")
|
||||||
val androidTestSourceSet = android.sourceSets.getByName("androidTest")
|
val androidTestSourceSet = android.sourceSets.getByName("androidTest")
|
||||||
@@ -104,7 +104,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
create("free").dimension = "pricing"
|
create("free").dimension = "pricing"
|
||||||
create("paid").dimension = "pricing"
|
create("paid").dimension = "pricing"
|
||||||
}
|
}
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
|
|
||||||
fun assertSourceSetsExist(androidName: String, kotlinName: String) {
|
fun assertSourceSetsExist(androidName: String, kotlinName: String) {
|
||||||
@@ -138,7 +138,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
it.create("paid").dimension = "pricing"
|
it.create("paid").dimension = "pricing"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
|
|
||||||
kotlin.sourceSets.toSet().generatePairs()
|
kotlin.sourceSets.toSet().generatePairs()
|
||||||
@@ -164,7 +164,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `sync includes user configuration`() {
|
fun `sync includes user configuration`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
val kotlinAndroidMain = kotlin.sourceSets.getByName("androidMain")
|
val kotlinAndroidMain = kotlin.sourceSets.getByName("androidMain")
|
||||||
val androidMain = android.sourceSets.getByName("main")
|
val androidMain = android.sourceSets.getByName("main")
|
||||||
@@ -182,7 +182,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `AndroidSourceSet#kotlinSourceSet convention`() {
|
fun `AndroidSourceSet#kotlinSourceSet convention`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
fun AndroidSourceSet.kotlinSourceSetByConvention(): KotlinSourceSet =
|
fun AndroidSourceSet.kotlinSourceSetByConvention(): KotlinSourceSet =
|
||||||
(this as HasConvention).convention.plugins["kotlin"] as KotlinSourceSet
|
(this as HasConvention).convention.plugins["kotlin"] as KotlinSourceSet
|
||||||
@@ -199,7 +199,7 @@ class MultiplatformAndroidSourceSetLayoutV1Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `AndroidSourceSet kotlin AndroidSourceDirectorySet`() {
|
fun `AndroidSourceSet kotlin AndroidSourceDirectorySet`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
android.libraryVariants.all { variant ->
|
android.libraryVariants.all { variant ->
|
||||||
val main = variant.sourceSets.first { it.name == "main" }
|
val main = variant.sourceSets.first { it.name == "main" }
|
||||||
|
|||||||
+2
-3
@@ -10,7 +10,6 @@ package org.jetbrains.kotlin.gradle.unitTests.sources.android
|
|||||||
import com.android.build.gradle.LibraryPlugin
|
import com.android.build.gradle.LibraryPlugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.internal.project.ProjectInternal
|
import org.gradle.api.internal.project.ProjectInternal
|
||||||
import org.jetbrains.kotlin.gradle.*
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.android.checker.MultiplatformLayoutV2AndroidStyleSourceDirUsageChecker.AndroidStyleSourceDirUsageDiagnostic
|
import org.jetbrains.kotlin.gradle.plugin.sources.android.checker.MultiplatformLayoutV2AndroidStyleSourceDirUsageChecker.AndroidStyleSourceDirUsageDiagnostic
|
||||||
@@ -33,7 +32,7 @@ class MultiplatformAndroidSourceSetLayoutV2DiagnosticsTest {
|
|||||||
compileSdk = 31
|
compileSdk = 31
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
android()
|
androidTarget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ class MultiplatformAndroidSourceSetLayoutV2DiagnosticsTest {
|
|||||||
val androidSourceSet = project.findAndroidSourceSet(kotlinSourceSet) ?: return@forEach
|
val androidSourceSet = project.findAndroidSourceSet(kotlinSourceSet) ?: return@forEach
|
||||||
multiplatformAndroidSourceSetLayoutV2.checker.checkCreatedSourceSet(
|
multiplatformAndroidSourceSetLayoutV2.checker.checkCreatedSourceSet(
|
||||||
diagnosticReporter = diagnosticsReporter,
|
diagnosticReporter = diagnosticsReporter,
|
||||||
target = project.multiplatformExtension.android(),
|
target = project.multiplatformExtension.androidTarget(),
|
||||||
layout = multiplatformAndroidSourceSetLayoutV2,
|
layout = multiplatformAndroidSourceSetLayoutV2,
|
||||||
kotlinSourceSet = kotlinSourceSet,
|
kotlinSourceSet = kotlinSourceSet,
|
||||||
androidSourceSet = androidSourceSet
|
androidSourceSet = androidSourceSet
|
||||||
|
|||||||
+23
-23
@@ -42,43 +42,43 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - main SourceSet - is called 'androidMain'`() {
|
fun `test - main SourceSet - is called 'androidMain'`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
assertEquals("androidMain", project.getKotlinSourceSetOrFail(android.sourceSets.main).name)
|
assertEquals("androidMain", project.getKotlinSourceSetOrFail(android.sourceSets.main).name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - main SourceSet name - with custom targetName`() {
|
fun `test - main SourceSet name - with custom targetName`() {
|
||||||
kotlin.android("foo")
|
kotlin.androidTarget("foo")
|
||||||
assertEquals("fooMain", project.getKotlinSourceSetOrFail(android.sourceSets.main).name)
|
assertEquals("fooMain", project.getKotlinSourceSetOrFail(android.sourceSets.main).name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - unitTest SourceSet - is called 'androidUnitTest'`() {
|
fun `test - unitTest SourceSet - is called 'androidUnitTest'`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
assertEquals("androidUnitTest", project.getKotlinSourceSetOrFail(android.sourceSets.test).name)
|
assertEquals("androidUnitTest", project.getKotlinSourceSetOrFail(android.sourceSets.test).name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - unitTest SourceSet name - with custom targetName`() {
|
fun `test - unitTest SourceSet name - with custom targetName`() {
|
||||||
kotlin.android("foo")
|
kotlin.androidTarget("foo")
|
||||||
assertEquals("fooUnitTest", project.getKotlinSourceSetOrFail(android.sourceSets.test).name)
|
assertEquals("fooUnitTest", project.getKotlinSourceSetOrFail(android.sourceSets.test).name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - instrumentedTest SourceSet - is called 'androidInstrumentedTest'`() {
|
fun `test - instrumentedTest SourceSet - is called 'androidInstrumentedTest'`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
assertEquals("androidInstrumentedTest", project.getKotlinSourceSetOrFail(android.sourceSets.androidTest).name)
|
assertEquals("androidInstrumentedTest", project.getKotlinSourceSetOrFail(android.sourceSets.androidTest).name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test instrumentedTest SourceSet - with custom targetName`() {
|
fun `test instrumentedTest SourceSet - with custom targetName`() {
|
||||||
kotlin.android("foo")
|
kotlin.androidTarget("foo")
|
||||||
assertEquals("fooInstrumentedTest", project.getKotlinSourceSetOrFail(android.sourceSets.androidTest).name)
|
assertEquals("fooInstrumentedTest", project.getKotlinSourceSetOrFail(android.sourceSets.androidTest).name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test SourceSet names - with two flavorDimensions`() {
|
fun `test SourceSet names - with two flavorDimensions`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
android.flavorDimensions.add("market")
|
android.flavorDimensions.add("market")
|
||||||
android.flavorDimensions.add("price")
|
android.flavorDimensions.add("price")
|
||||||
android.productFlavors.create("german").dimension = "market"
|
android.productFlavors.create("german").dimension = "market"
|
||||||
@@ -114,7 +114,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - all source directories - are disjoint in source sets`() {
|
fun `test - all source directories - are disjoint in source sets`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
android.flavorDimensions.add("market")
|
android.flavorDimensions.add("market")
|
||||||
android.flavorDimensions.add("price")
|
android.flavorDimensions.add("price")
|
||||||
android.productFlavors.create("german").dimension = "market"
|
android.productFlavors.create("german").dimension = "market"
|
||||||
@@ -147,7 +147,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - default dependsOn edges`() {
|
fun `test - default dependsOn edges`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
|
|
||||||
android.libraryVariants.all { libraryVariant ->
|
android.libraryVariants.all { libraryVariant ->
|
||||||
@@ -183,7 +183,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - kotlin source directories - are in sync between KotlinSourceSet and AndroidSourceSet`() {
|
fun `test - kotlin source directories - are in sync between KotlinSourceSet and AndroidSourceSet`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
project.forAllAndroidVariants { variant ->
|
project.forAllAndroidVariants { variant ->
|
||||||
variant.sourceSets.forEach { androidSourceSet ->
|
variant.sourceSets.forEach { androidSourceSet ->
|
||||||
@@ -211,7 +211,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - kotlin source directories - supports AGP default location`() {
|
fun `test - kotlin source directories - supports AGP default location`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
project.forAllAndroidVariants { variant ->
|
project.forAllAndroidVariants { variant ->
|
||||||
variant.sourceSets.forEach { androidSourceSet ->
|
variant.sourceSets.forEach { androidSourceSet ->
|
||||||
@@ -228,7 +228,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - main - default AndroidManifest location`() {
|
fun `test - main - default AndroidManifest location`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
project.file("src/androidMain/AndroidManifest.xml"),
|
project.file("src/androidMain/AndroidManifest.xml"),
|
||||||
@@ -250,7 +250,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
android.sourceSets.main.manifest.srcFile(customManifestFile)
|
android.sourceSets.main.manifest.srcFile(customManifestFile)
|
||||||
|
|
||||||
/* Then: Setup Kotlin/Android target */
|
/* Then: Setup Kotlin/Android target */
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
customManifestFile, android.sourceSets.main.manifest.srcFile,
|
customManifestFile, android.sourceSets.main.manifest.srcFile,
|
||||||
@@ -260,7 +260,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - defaultKotlinSourceSetName - is determined for all compilations`() {
|
fun `test - defaultKotlinSourceSetName - is determined for all compilations`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
android.flavorDimensions.add("market")
|
android.flavorDimensions.add("market")
|
||||||
android.flavorDimensions.add("price")
|
android.flavorDimensions.add("price")
|
||||||
android.productFlavors.create("german").dimension = "market"
|
android.productFlavors.create("german").dimension = "market"
|
||||||
@@ -269,9 +269,9 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
android.productFlavors.create("free").dimension = "price"
|
android.productFlavors.create("free").dimension = "price"
|
||||||
project.evaluate()
|
project.evaluate()
|
||||||
|
|
||||||
kotlin.android().compilations.all { compilation ->
|
kotlin.androidTarget().compilations.all { compilation ->
|
||||||
val defaultKotlinSourceSetName = multiplatformAndroidSourceSetLayoutV2.naming
|
val defaultKotlinSourceSetName = multiplatformAndroidSourceSetLayoutV2.naming
|
||||||
.defaultKotlinSourceSetName(kotlin.android(), compilation.androidVariant)
|
.defaultKotlinSourceSetName(kotlin.androidTarget(), compilation.androidVariant)
|
||||||
|
|
||||||
assertNotNull(
|
assertNotNull(
|
||||||
defaultKotlinSourceSetName,
|
defaultKotlinSourceSetName,
|
||||||
@@ -289,7 +289,7 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test - defaultKotlinSourceSetName`() {
|
fun `test - defaultKotlinSourceSetName`() {
|
||||||
kotlin.android()
|
kotlin.androidTarget()
|
||||||
android.flavorDimensions.add("market")
|
android.flavorDimensions.add("market")
|
||||||
android.flavorDimensions.add("price")
|
android.flavorDimensions.add("price")
|
||||||
android.productFlavors.create("german").dimension = "market"
|
android.productFlavors.create("german").dimension = "market"
|
||||||
@@ -300,32 +300,32 @@ class MultiplatformAndroidSourceSetLayoutV2Test {
|
|||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"androidGermanFreeDebug",
|
"androidGermanFreeDebug",
|
||||||
kotlin.android().compilations.getByName("germanFreeDebug").defaultSourceSet.name
|
kotlin.androidTarget().compilations.getByName("germanFreeDebug").defaultSourceSet.name
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"androidUsaFreeDebug",
|
"androidUsaFreeDebug",
|
||||||
kotlin.android().compilations.getByName("usaFreeDebug").defaultSourceSet.name
|
kotlin.androidTarget().compilations.getByName("usaFreeDebug").defaultSourceSet.name
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"androidGermanPaidRelease",
|
"androidGermanPaidRelease",
|
||||||
kotlin.android().compilations.getByName("germanPaidRelease").defaultSourceSet.name
|
kotlin.androidTarget().compilations.getByName("germanPaidRelease").defaultSourceSet.name
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"androidUsaPaidRelease",
|
"androidUsaPaidRelease",
|
||||||
kotlin.android().compilations.getByName("usaPaidRelease").defaultSourceSet.name
|
kotlin.androidTarget().compilations.getByName("usaPaidRelease").defaultSourceSet.name
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"androidUnitTestGermanFreeDebug",
|
"androidUnitTestGermanFreeDebug",
|
||||||
kotlin.android().compilations.getByName("germanFreeDebugUnitTest").defaultSourceSet.name
|
kotlin.androidTarget().compilations.getByName("germanFreeDebugUnitTest").defaultSourceSet.name
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"androidInstrumentedTestGermanFreeDebug",
|
"androidInstrumentedTestGermanFreeDebug",
|
||||||
kotlin.android().compilations.getByName("germanFreeDebugAndroidTest").defaultSourceSet.name
|
kotlin.androidTarget().compilations.getByName("germanFreeDebugAndroidTest").defaultSourceSet.name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user