Test expected js target resources publication bahavior

^KT-65540
This commit is contained in:
Timofey Solonin
2024-03-05 17:20:35 +01:00
committed by Space Team
parent b765cf3f99
commit 76814a8bbe
26 changed files with 104 additions and 5 deletions
@@ -38,6 +38,7 @@ class KotlinTargetVariantResourcesPublicationTests {
{ linuxX64() },
{ wasmWasi() },
{ wasmJs() },
{ js() },
)
)
}
@@ -52,6 +53,7 @@ class KotlinTargetVariantResourcesPublicationTests {
{ linuxX64() },
{ wasmWasi() },
{ wasmJs() },
{ js() },
)
)
}
@@ -68,6 +70,7 @@ class KotlinTargetVariantResourcesPublicationTests {
{ linuxX64() },
{ wasmWasi() },
{ wasmJs() },
{ js() },
)
)
}
@@ -81,10 +81,11 @@ class KotlinTargetVariantResourcesResolutionTests {
}
@Test
fun `test direct dependency - for wasmJs and wasmWasi targets - when using artifact view`() {
fun `test direct dependency - for wasmJs, wasmWasi, js targets - when using artifact view`() {
listOf<TargetProvider>(
{ wasmJs() },
{ wasmWasi() },
{ js() },
).forEach { target ->
testDirectDependencyOnResourcesProducer(
producerTarget = { target() },
@@ -141,6 +142,25 @@ class KotlinTargetVariantResourcesResolutionTests {
)
}
@Test
fun `test direct dependency - for js - when using resources configuration`() {
testDirectDependencyOnResourcesProducer(
producerTarget = { js() },
consumerTarget = { js() },
resolutionStrategy = KotlinTargetResourcesResolutionStrategy.ResourcesConfiguration,
filterResolvedFiles = {
it.filterNot {
it.path.contains("kotlin-stdlib-js") || it.path.contains("kotlin-dom-api-compat")
}.toSet()
},
expectedResult = { _, producer ->
hashSetOf(
producer.buildFile("kotlin-multiplatform-resources/zip-for-publication/js/producer.kotlin_resources.zip"),
)
},
)
}
@Test
fun `test transitive dependency - without resources in middle project - with configuration`() {
testTransitiveDependencyOnResourcesProducer(
@@ -198,6 +218,44 @@ class KotlinTargetVariantResourcesResolutionTests {
}
}
@Test
fun `test transitive dependency - without resources in middle project in js - with configuration`() {
dependencyScopesWithResources().forEach { dependencyScope ->
testTransitiveDependencyOnResourcesProducer(
targetProvider = { js() },
resolutionStrategy = KotlinTargetResourcesResolutionStrategy.VariantReselection,
dependencyScope = dependencyScope,
filterResolvedFiles = {
it.filterNot {
it.path.contains("kotlin-stdlib-js") || it.path.contains("kotlin-dom-api-compat")
}.toSet()
},
expectedResult = { _, _, producer ->
setOf(
producer.buildFile("kotlin-multiplatform-resources/zip-for-publication/js/producer.kotlin_resources.zip"),
)
}
)
}
}
@Test
fun `test transitive dependency - without resources in middle project in js - with artifact view`() {
dependencyScopesWithResources().forEach { dependencyScope ->
testTransitiveDependencyOnResourcesProducer(
targetProvider = { js() },
resolutionStrategy = KotlinTargetResourcesResolutionStrategy.VariantReselection,
dependencyScope = dependencyScope,
filterResolvedFiles = { it },
expectedResult = { _, _, producer ->
setOf(
producer.buildFile("kotlin-multiplatform-resources/zip-for-publication/js/producer.kotlin_resources.zip"),
)
}
)
}
}
@Test
fun `test transitive dependency - without resources in middle project - with artifact view`() {
testTransitiveDependencyOnResourcesProducer(
@@ -280,6 +338,7 @@ class KotlinTargetVariantResourcesResolutionTests {
val targetsToTest = listOf<TargetProvider>(
{ wasmJs() },
{ wasmWasi() },
{ js() },
{ linuxX64() },
{ iosArm64() },
)
@@ -304,9 +363,6 @@ class KotlinTargetVariantResourcesResolutionTests {
return listOf(
{ this::implementation },
{ this::api },
// What are these supposed to mean for resources?
// { this::compileOnly }, ?
// { this::runtimeOnly }, ?
)
}
@@ -537,7 +593,6 @@ class KotlinTargetVariantResourcesResolutionTests {
projectBuilder = projectBuilder,
preApplyCode = preApplyCode,
) {
enableDependencyVerification(false)
enableDefaultStdlibDependency(true)
repositories.mavenLocal()
repositories.mavenCentralCacheRedirector()