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