-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Introduce wasmJsBrowserDistribution task #5375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...lugins/compose/src/main/kotlin/org/jetbrains/compose/web/internal/configureWebApplication.kt
Outdated
Show resolved
Hide resolved
...lugins/compose/src/main/kotlin/org/jetbrains/compose/web/internal/configureWebApplication.kt
Outdated
Show resolved
Hide resolved
Just in case, if it is not already planned, please, fix the PR description before merging (better also before review, if not agreed beforehand):
|
Unfortunately, without contracts onlyIf is not enough
val jsTargetModuleName = jsDistTask.outputModuleName | ||
val wasmTargetModuleName = wasmDistTask.outputModuleName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do both outputModuleName
have some default value when a user doesn't explicitly specify it in the DSL?
When would this be false
?
onlyIf {
jsTargetModuleName != null && wasmTargetModuleName != null
}
} | ||
} | ||
|
||
private fun Project.introduceComposeWebCompatibilityTask(targets: Collection<KotlinJsIrTarget>) { |
There was a problem hiding this comment.
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)
...ins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt
Outdated
Show resolved
Hide resolved
...ins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt
Outdated
Show resolved
Hide resolved
...lugins/compose/src/main/kotlin/org/jetbrains/compose/web/internal/configureWebApplication.kt
Outdated
Show resolved
Hide resolved
...lugins/compose/src/main/kotlin/org/jetbrains/compose/web/internal/configureWebApplication.kt
Outdated
Show resolved
Hide resolved
...lugins/compose/src/main/kotlin/org/jetbrains/compose/web/internal/configureWebApplication.kt
Outdated
Show resolved
Hide resolved
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/web/tasks/WebCompatibilityTask.kt
Outdated
Show resolved
Hide resolved
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/web/tasks/WebCompatibilityTask.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Oleksandr Karpovich <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a test with a custom target name wasmJs("myStrangeTarget")
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/web/tasks/WebCompatibilityTask.kt
Outdated
Show resolved
Hide resolved
wasmDistFiles = tasks.named("wasmJsBrowserDistribution").get().outputs.files | ||
} | ||
|
||
internal fun Project.configureWebCompatibility() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a description what's going here
...ins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt
Outdated
Show resolved
Hide resolved
} | ||
|
||
kotlin { | ||
js(IR) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I know, we already don't need IR
here
|
||
kotlin { | ||
js(IR) { | ||
outputModuleName.set("composeApp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to test a custom name here, then you need a different name, because "composeApp" is a name of the module already
|
||
@OptIn(ExperimentalWasmDsl::class) | ||
wasmJs { | ||
outputModuleName.set("composeApp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what will happen if there is a different name?
Testing
Clone https://github.com/Schahen/ComposeWebApp and run
Release Notes
Features - Web
composeCompatibilityBrowserDistribution
task. This task combines two prod distributions - for js and for wasm in such way so that if modern required features are not supported by the consumer browser, application switch to js mode.