Skip to content

Commit

Permalink
Add experimental support for wasmJs & wasmWasi (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm authored Mar 11, 2024
1 parent 647b1bc commit b894692
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
![badge-platform-jvm]
![badge-platform-js]
![badge-platform-js-node]
![badge-platform-wasm]
![badge-platform-linux]
![badge-platform-macos]
![badge-platform-ios]
Expand Down
13 changes: 13 additions & 0 deletions build-logic/src/main/kotlin/-KmpConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension
import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl
import org.gradle.api.Action
import org.gradle.api.JavaVersion
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

fun KmpConfigurationExtension.configureShared(
java9ModuleName: String? = null,
Expand All @@ -35,6 +36,18 @@ fun KmpConfigurationExtension.configureShared(
}

js()
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
target {
nodejs()
}
}
@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
target {
nodejs()
}
}

androidNativeAll()
iosAll()
Expand Down
14 changes: 14 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension

Expand All @@ -39,6 +42,17 @@ plugins.withType<YarnPlugin> {
the<YarnRootExtension>().lockFileDirectory = rootDir.resolve(".kotlin-js-store")
}

plugins.withType<NodeJsRootPlugin> {
the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

tasks.withType<KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}
}

apiValidation {
if ((findProperty("CHECK_PUBLICATION") as? String) != null) {
ignoredProjects.add("check-publication")
Expand Down

0 comments on commit b894692

Please sign in to comment.