|
|
@ -9,6 +9,7 @@ import org.gradle.api.Project |
|
|
|
import org.gradle.api.artifacts.Configuration |
|
|
|
import org.gradle.api.artifacts.Configuration |
|
|
|
import org.gradle.api.artifacts.ResolvedDependency |
|
|
|
import org.gradle.api.artifacts.ResolvedDependency |
|
|
|
import org.gradle.api.artifacts.UnresolvedDependency |
|
|
|
import org.gradle.api.artifacts.UnresolvedDependency |
|
|
|
|
|
|
|
import org.gradle.api.artifacts.component.ModuleComponentIdentifier |
|
|
|
import org.gradle.api.provider.Provider |
|
|
|
import org.gradle.api.provider.Provider |
|
|
|
import org.jetbrains.compose.ComposeBuildConfig |
|
|
|
import org.jetbrains.compose.ComposeBuildConfig |
|
|
|
import org.jetbrains.compose.ComposeExtension |
|
|
|
import org.jetbrains.compose.ComposeExtension |
|
|
@ -27,20 +28,23 @@ internal fun Project.configureWeb( |
|
|
|
// here we check all dependencies (including transitive) |
|
|
|
// here we check all dependencies (including transitive) |
|
|
|
// If there is compose.ui, then skiko is required! |
|
|
|
// If there is compose.ui, then skiko is required! |
|
|
|
val shouldRunUnpackSkiko = project.provider { |
|
|
|
val shouldRunUnpackSkiko = project.provider { |
|
|
|
var dependsOnComposeUi = false |
|
|
|
webExt.targetsToConfigure(project).any { target -> |
|
|
|
project.configurations.matching { configuration -> |
|
|
|
val compilation = target.compilations.getByName("main") |
|
|
|
val isWasmOrJs = configuration.name.contains("js", true) || |
|
|
|
val compileConfiguration = compilation.compileDependencyConfigurationName |
|
|
|
configuration.name.contains("wasm", true) |
|
|
|
val runtimeConfiguration = compilation.runtimeDependencyConfigurationName |
|
|
|
|
|
|
|
|
|
|
|
configuration.isCanBeResolved && isWasmOrJs |
|
|
|
listOf(compileConfiguration, runtimeConfiguration).mapNotNull { name -> |
|
|
|
}.all { configuration -> |
|
|
|
project.configurations.findByName(name) |
|
|
|
val match = configuration.incoming.artifacts.resolvedArtifacts.get().any { artifact -> |
|
|
|
}.flatMap { configuration -> |
|
|
|
artifact.id.componentIdentifier.toString().contains("org.jetbrains.compose.ui:ui:") |
|
|
|
configuration.incoming.resolutionResult.allComponents.map { it.id } |
|
|
|
|
|
|
|
}.any { identifier -> |
|
|
|
|
|
|
|
if (identifier is ModuleComponentIdentifier) { |
|
|
|
|
|
|
|
identifier.group == "org.jetbrains.compose.ui" && identifier.module == "ui" |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dependsOnComposeUi = dependsOnComposeUi || match |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
dependsOnComposeUi |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// configure only if there is k/wasm or k/js target: |
|
|
|
// configure only if there is k/wasm or k/js target: |
|
|
|