Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove redundant project. accessors
  • Loading branch information
Schahen committed Jul 24, 2025
commit 09ecd32b53a119339d31bad55278f2e4f52b7817
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ internal fun Project.configureWeb(
}

private fun Project.introduceComposeWebCompatibilityTask(targets: Collection<KotlinJsIrTarget>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some gradle plugin tests in the project.

Would you like to add some tests?
For example:

  • a task is created when the condition match and it's not created otherwise
  • Run the task and check the output directory exists. And the output directory contains the must-have files (index.html, .js file, wasm file, etc)

val webProductionDist = project.layout.buildDirectory.dir("dist/web/productionExecutable")
val webProductionDist = layout.buildDirectory.dir("dist/web/productionExecutable")

val jsAppRenamed = "__jsApp.js"
val wasmAppRenamed = "__wasmApp.js"

project.registerTask<Copy>("composeWebCompatibilityDist") {
registerTask<Copy>("composeWebCompatibilityDist") {
val jsTarget = targets.firstOrNull { it.name == "js" }?.outputModuleName
val wasmTarget = targets.firstOrNull { it.name == "wasmJs" }?.outputModuleName

Expand All @@ -74,10 +74,10 @@ private fun Project.introduceComposeWebCompatibilityTask(targets: Collection<Kot
}

into(webProductionDist)
with(project.copySpec { spec ->
with(copySpec { spec ->
val jsTarget = targets.firstOrNull { it.name == "js" }?.outputModuleName
spec.apply {
from( project.tasks.named("jsBrowserDistribution")) {
from( tasks.named("jsBrowserDistribution")) {
rename { name ->
val moduleName = jsTarget?.get()
when (name) {
Expand All @@ -88,10 +88,10 @@ private fun Project.introduceComposeWebCompatibilityTask(targets: Collection<Kot
}
}
}
}, project.copySpec { spec ->
}, copySpec { spec ->
val wasmTarget = targets.firstOrNull { it.name == "wasmJs" }?.outputModuleName
spec.apply {
from( project.tasks.named("wasmJsBrowserDistribution")) {
from( tasks.named("wasmJsBrowserDistribution")) {
rename { name ->
val moduleName = wasmTarget?.get()
when (name) {
Expand Down