Skip to content

Commit

Permalink
JS: Test and publish JS files that were transformed by atomicfu
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Apr 24, 2019
1 parent 390c722 commit 504c876
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions gradle/compile-js-multiplatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ kotlin {

sourceSets {
jsMain.dependencies {
api group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-js', version: kotlin_version
api "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
}

jsTest.dependencies {
Expand Down Expand Up @@ -42,7 +42,8 @@ compileTestKotlinJs {
}

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

def configuration = configurations.jsTestRuntimeClasspath
Expand Down
11 changes: 3 additions & 8 deletions gradle/node-js.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ node {

task prepareNodePackage(type: Copy) {
from("npm") {
include 'package.json'
/*
* Postpone expansion of package.json until we configure version property in build.gradle
*/
// Postpone expansion of package.json until we configure version property in build.gradle
def copySpec = it
afterEvaluate {
expand(project.properties + [kotlinDependency: ""])
copySpec.expand(project.properties + [kotlinDependency: ""])
}
}
from("npm") {
exclude 'package.json'
}
into "$node.nodeModulesDir"
}

Expand Down
9 changes: 7 additions & 2 deletions gradle/publish-npm-js.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ def dryRun = prop("dryRun", "false")
// Note: publish transformed files using dependency on sourceSets.main.output
task preparePublishNpm(type: Copy) {
from(npmTemplateDir) {
expand (project.properties + [kotlinDependency: "\"kotlin\": \"$kotlin_version\""])
// Postpone expansion of package.json until we configure version property in build.gradle
def copySpec = it
afterEvaluate {
copySpec.expand(project.properties + [kotlinDependency: "\"kotlin\": \"$kotlin_version\""])
}
}
from(compileKotlinJs.destinationDir)
// we must publish output that is transformed by atomicfu
from(kotlin.targets.js.compilations.main.output.allOutputs)
into npmDeployDir
}

Expand Down

0 comments on commit 504c876

Please sign in to comment.