@@ -9,6 +9,7 @@ import org.gradle.api.Project
99import org.gradle.api.artifacts.Configuration
1010import org.gradle.api.artifacts.ResolvedDependency
1111import org.gradle.api.artifacts.UnresolvedDependency
12+ import org.gradle.api.artifacts.component.ModuleComponentIdentifier
1213import org.gradle.api.provider.Provider
1314import org.jetbrains.compose.ComposeBuildConfig
1415import org.jetbrains.compose.ComposeExtension
@@ -27,20 +28,23 @@ internal fun Project.configureWeb(
2728 // here we check all dependencies (including transitive)
2829 // If there is compose.ui, then skiko is required!
2930 val shouldRunUnpackSkiko = project.provider {
30- var dependsOnComposeUi = false
31- project.configurations.matching { configuration ->
32- val isWasmOrJs = configuration.name.contains(" js" , true ) ||
33- configuration.name.contains(" wasm" , true )
34-
35- configuration.isCanBeResolved && isWasmOrJs
36- }.all { configuration ->
37- val match = configuration.incoming.artifacts.resolvedArtifacts.get().any { artifact ->
38- artifact.id.componentIdentifier.toString().contains(" org.jetbrains.compose.ui:ui:" )
31+ webExt.targetsToConfigure(project).any { target ->
32+ val compilation = target.compilations.getByName(" main" )
33+ val compileConfiguration = compilation.compileDependencyConfigurationName
34+ val runtimeConfiguration = compilation.runtimeDependencyConfigurationName
35+
36+ listOf (compileConfiguration, runtimeConfiguration).mapNotNull { name ->
37+ project.configurations.findByName(name)
38+ }.flatMap { configuration ->
39+ configuration.incoming.resolutionResult.allComponents.map { it.id }
40+ }.any { identifier ->
41+ if (identifier is ModuleComponentIdentifier ) {
42+ identifier.group == " org.jetbrains.compose.ui" && identifier.module == " ui"
43+ } else {
44+ false
45+ }
3946 }
40-
41- dependsOnComposeUi = dependsOnComposeUi || match
4247 }
43- dependsOnComposeUi
4448 }
4549
4650 // configure only if there is k/wasm or k/js target:
0 commit comments