Skip to content

Commit 504c876

Browse files
committed
JS: Test and publish JS files that were transformed by atomicfu
1 parent 390c722 commit 504c876

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

gradle/compile-js-multiplatform.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ kotlin {
1111

1212
sourceSets {
1313
jsMain.dependencies {
14-
api group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-js', version: kotlin_version
14+
api "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
1515
}
1616

1717
jsTest.dependencies {
@@ -42,7 +42,8 @@ compileTestKotlinJs {
4242
}
4343

4444
task populateNodeModules(type: Copy, dependsOn: compileTestKotlinJs) {
45-
from compileKotlinJs.destinationDir
45+
// we must copy output that is transformed by atomicfu
46+
from(kotlin.targets.js.compilations.main.output.allOutputs)
4647
into "$node.nodeModulesDir/node_modules"
4748

4849
def configuration = configurations.jsTestRuntimeClasspath

gradle/node-js.gradle

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,12 @@ node {
1515

1616
task prepareNodePackage(type: Copy) {
1717
from("npm") {
18-
include 'package.json'
19-
/*
20-
* Postpone expansion of package.json until we configure version property in build.gradle
21-
*/
18+
// Postpone expansion of package.json until we configure version property in build.gradle
19+
def copySpec = it
2220
afterEvaluate {
23-
expand(project.properties + [kotlinDependency: ""])
21+
copySpec.expand(project.properties + [kotlinDependency: ""])
2422
}
2523
}
26-
from("npm") {
27-
exclude 'package.json'
28-
}
2924
into "$node.nodeModulesDir"
3025
}
3126

gradle/publish-npm-js.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ def dryRun = prop("dryRun", "false")
2323
// Note: publish transformed files using dependency on sourceSets.main.output
2424
task preparePublishNpm(type: Copy) {
2525
from(npmTemplateDir) {
26-
expand (project.properties + [kotlinDependency: "\"kotlin\": \"$kotlin_version\""])
26+
// Postpone expansion of package.json until we configure version property in build.gradle
27+
def copySpec = it
28+
afterEvaluate {
29+
copySpec.expand(project.properties + [kotlinDependency: "\"kotlin\": \"$kotlin_version\""])
30+
}
2731
}
28-
from(compileKotlinJs.destinationDir)
32+
// we must publish output that is transformed by atomicfu
33+
from(kotlin.targets.js.compilations.main.output.allOutputs)
2934
into npmDeployDir
3035
}
3136

0 commit comments

Comments
 (0)