[Gradle] Update tests to not have non-distinguishable targets
^KT-55751 Verification Pending
This commit is contained in:
committed by
Space Team
parent
b9f0ad0e58
commit
9804ea80c4
+6
@@ -1,3 +1,4 @@
|
||||
import org.gradle.api.attributes.Attribute
|
||||
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
|
||||
@@ -11,6 +12,8 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
val distinguishingAttribute = Attribute.of(String::class.java)
|
||||
|
||||
val platformTargetA = when {
|
||||
HostManager.hostIsMac -> macosX64("platformA")
|
||||
HostManager.hostIsMingw -> mingwX64("platformA")
|
||||
@@ -24,4 +27,7 @@ kotlin {
|
||||
HostManager.hostIsLinux -> linuxX64("platformB")
|
||||
else -> error("Unexpected host: ${HostManager.host}")
|
||||
}
|
||||
|
||||
platformTargetA.attributes { attribute(distinguishingAttribute, "A") }
|
||||
platformTargetB.attributes { attribute(distinguishingAttribute, "B") }
|
||||
}
|
||||
|
||||
+4
-2
@@ -11,6 +11,7 @@ import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.ModuleDependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.attributes.Attribute
|
||||
import org.gradle.api.attributes.AttributeContainer
|
||||
import org.gradle.api.attributes.Category
|
||||
import org.gradle.api.attributes.Usage
|
||||
@@ -155,8 +156,9 @@ class ConfigurationsTest : MultiplatformExtensionTest() {
|
||||
@Test
|
||||
fun `don't publish wasm targets with KotlinJsCompilerAttribute attribute`() {
|
||||
with(kotlin) {
|
||||
js("nodeJs", KotlinJsCompilerType.IR)
|
||||
js("browser", KotlinJsCompilerType.IR)
|
||||
val jsAttribute = Attribute.of(String::class.java)
|
||||
js("nodeJs", KotlinJsCompilerType.IR) { attributes { attribute(jsAttribute, "nodeJs") } }
|
||||
js("browser", KotlinJsCompilerType.IR) { attributes { attribute(jsAttribute, "browser") } }
|
||||
@OptIn(ExperimentalWasmDsl::class)
|
||||
wasm()
|
||||
|
||||
|
||||
+5
-3
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.gradle.unitTests
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.attributes.Attribute
|
||||
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.jetbrains.kotlin.gradle.plugin.*
|
||||
@@ -64,8 +65,9 @@ internal class CompilationSpecificPluginPath {
|
||||
fun `each compilation should have its own plugin classpath`() {
|
||||
val project = buildProjectWithMPP {
|
||||
kotlin {
|
||||
jvm("jvm1")
|
||||
jvm("jvm2")
|
||||
val jvmAttribute = Attribute.of(String::class.java)
|
||||
jvm("jvm1") { attributes { attribute(jvmAttribute, "jvm1") } }
|
||||
jvm("jvm2") { attributes { attribute(jvmAttribute, "jvm2") } }
|
||||
js("js") { browser() }
|
||||
}
|
||||
}
|
||||
@@ -234,7 +236,7 @@ internal class CompilationSpecificPluginPath {
|
||||
kotlin {
|
||||
jvm()
|
||||
linuxX64("linux")
|
||||
linuxX64("mac")
|
||||
macosX64("mac")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user