Skip to content

Commit 6f9fdf0

Browse files
committed
Add JS target to the MPP test.
Add kotlinx-atomicfu-runtime dependency in MPP configuration
1 parent f5ac44c commit 6f9fdf0

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ private fun Project.configureDependencies() {
105105
getAtomicfuDependencyNotation(Platform.JS, version)
106106
)
107107
dependencies.add(TEST_IMPLEMENTATION_CONFIGURATION, getAtomicfuDependencyNotation(Platform.JS, version))
108-
addCompilerPluginDependency()
108+
addJsCompilerPluginRuntimeDependency()
109109
}
110110
withPluginWhenEvaluatedDependencies("kotlin-multiplatform") { version ->
111+
addJsCompilerPluginRuntimeDependency()
111112
configureMultiplatformPluginDependencies(version)
112113
}
113114
}
@@ -178,7 +179,9 @@ private fun Project.isTransformationDisabled(target: KotlinTarget): Boolean {
178179
!config.transformJs && platformType == KotlinPlatformType.js
179180
}
180181

181-
private fun Project.addCompilerPluginDependency() {
182+
// Adds kotlinx-atomicfu-runtime as an implementation dependency to the JS IR target:
183+
// it provides inline methods that replace atomic methods from the library and is needed at runtime.
184+
private fun Project.addJsCompilerPluginRuntimeDependency() {
182185
if (isCompilerPluginAvailable()) {
183186
withKotlinTargets { target ->
184187
if (target.isJsIrTarget()) {

integration-testing/examples/mpp-sample/build.gradle.kts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ repositories {
2828

2929
kotlin {
3030
jvm()
31+
js {
32+
nodejs()
33+
}
3134

3235
val hostOs = System.getProperty("os.name")
3336
val isArm64 = System.getProperty("os.arch") == "aarch64"
@@ -42,8 +45,12 @@ kotlin {
4245
}
4346

4447
sourceSets {
45-
val commonMain by getting
46-
val commonTest by getting {
48+
commonMain {
49+
dependencies {
50+
implementation(kotlin("stdlib"))
51+
}
52+
}
53+
commonTest {
4754
dependencies {
4855
implementation(kotlin("test"))
4956
}

0 commit comments

Comments
 (0)