Skip to content

Commit

Permalink
Enable JS IR backend
Browse files Browse the repository at this point in the history
  • Loading branch information
skuzmich committed Feb 27, 2020
1 parent 21bb6fb commit b26e921
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ robolectric_version=4.0.2
baksmali_version=2.2.7

# JS
kotlin.js.compiler=both
gradle_node_version=1.2.0
node_version=8.9.3
npm_version=5.7.1
Expand All @@ -43,3 +44,6 @@ kotlin.native.ignoreDisabledTargets=true

# Site deneration
jekyll_version=4.0

# JS IR baceknd sometimes crashes with out-of-memory
org.gradle.jvmargs=-Xmx2g
24 changes: 16 additions & 8 deletions gradle/compile-js-multiplatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ apply from: rootProject.file('gradle/node-js.gradle')

kotlin {
targets {
fromPreset(presets.js, 'js')
fromPreset(presets.js, 'js') {
browser()
nodejs()
}
}

sourceSets {
jsMain.dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
api "org.jetbrains.kotlinx:atomicfu-js:$atomicfu_version"
}

jsTest.dependencies {
Expand All @@ -27,26 +31,30 @@ compileKotlinJs {
kotlinOptions.metaInfo = true
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = 'umd'

kotlinOptions {
// drop -js suffix from outputFile
def baseName = project.name - "-js"
outputFile = new File(outputFile.parent, baseName + ".js")
}
}

compileTestKotlinJs {
kotlinOptions.metaInfo = true
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = 'umd'
kotlinOptions.freeCompilerArgs += "-XXLanguage:-NewInference"
}

if (project.tasks.findByName('compileKotlinJsIr')) {
compileKotlinJsIr {
kotlinOptions.freeCompilerArgs += "-XXLanguage:-NewInference"
}
}

task populateNodeModules(type: Copy, dependsOn: compileTestKotlinJs) {
// 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
def configuration = configurations.hasProperty("legacyjsTestRuntimeClasspath")
? configurations.legacyjsTestRuntimeClasspath
: configurations.jsTestRuntimeClasspath

from(files {
configuration.collect { File file ->
file.name.endsWith(".jar") ?
Expand Down
4 changes: 2 additions & 2 deletions gradle/publish-bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ publishing {
break
}

// disable metadata everywhere, but in native modules
if (type == 'maven' || type == 'metadata' || type == 'jvm' || type == 'js') {
// disable metadata everywhere, but in native and js modules
if (type == 'maven' || type == 'metadata' || type == 'jvm') {
moduleDescriptorGenerator = null
}
}
Expand Down
2 changes: 0 additions & 2 deletions gradle/test-mocha-js.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ task testMochaNode(type: NodeTask, dependsOn: [compileTestKotlinJs, installDepen
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
}

jsTest.dependsOn testMochaNode

// -- Testing with Mocha under headless Chrome

Expand Down Expand Up @@ -89,5 +88,4 @@ task testMochaJsdom(type: NodeTask, dependsOn: [compileTestKotlinJs, installDepe
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
}

jsTest.dependsOn testMochaJsdom

0 comments on commit b26e921

Please sign in to comment.