Skip to content

Commit b26e921

Browse files
committed
Enable JS IR backend
1 parent 21bb6fb commit b26e921

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

gradle.properties

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ robolectric_version=4.0.2
2929
baksmali_version=2.2.7
3030

3131
# JS
32+
kotlin.js.compiler=both
3233
gradle_node_version=1.2.0
3334
node_version=8.9.3
3435
npm_version=5.7.1
@@ -43,3 +44,6 @@ kotlin.native.ignoreDisabledTargets=true
4344

4445
# Site deneration
4546
jekyll_version=4.0
47+
48+
# JS IR baceknd sometimes crashes with out-of-memory
49+
org.gradle.jvmargs=-Xmx2g

gradle/compile-js-multiplatform.gradle

+16-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ apply from: rootProject.file('gradle/node-js.gradle')
66

77
kotlin {
88
targets {
9-
fromPreset(presets.js, 'js')
9+
fromPreset(presets.js, 'js') {
10+
browser()
11+
nodejs()
12+
}
1013
}
1114

1215
sourceSets {
1316
jsMain.dependencies {
1417
api "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
18+
api "org.jetbrains.kotlinx:atomicfu-js:$atomicfu_version"
1519
}
1620

1721
jsTest.dependencies {
@@ -27,26 +31,30 @@ compileKotlinJs {
2731
kotlinOptions.metaInfo = true
2832
kotlinOptions.sourceMap = true
2933
kotlinOptions.moduleKind = 'umd'
30-
31-
kotlinOptions {
32-
// drop -js suffix from outputFile
33-
def baseName = project.name - "-js"
34-
outputFile = new File(outputFile.parent, baseName + ".js")
35-
}
3634
}
3735

3836
compileTestKotlinJs {
3937
kotlinOptions.metaInfo = true
4038
kotlinOptions.sourceMap = true
4139
kotlinOptions.moduleKind = 'umd'
40+
kotlinOptions.freeCompilerArgs += "-XXLanguage:-NewInference"
41+
}
42+
43+
if (project.tasks.findByName('compileKotlinJsIr')) {
44+
compileKotlinJsIr {
45+
kotlinOptions.freeCompilerArgs += "-XXLanguage:-NewInference"
46+
}
4247
}
4348

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

49-
def configuration = configurations.jsTestRuntimeClasspath
54+
def configuration = configurations.hasProperty("legacyjsTestRuntimeClasspath")
55+
? configurations.legacyjsTestRuntimeClasspath
56+
: configurations.jsTestRuntimeClasspath
57+
5058
from(files {
5159
configuration.collect { File file ->
5260
file.name.endsWith(".jar") ?

gradle/publish-bintray.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ publishing {
8989
break
9090
}
9191

92-
// disable metadata everywhere, but in native modules
93-
if (type == 'maven' || type == 'metadata' || type == 'jvm' || type == 'js') {
92+
// disable metadata everywhere, but in native and js modules
93+
if (type == 'maven' || type == 'metadata' || type == 'jvm') {
9494
moduleDescriptorGenerator = null
9595
}
9696
}

gradle/test-mocha-js.gradle

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ task testMochaNode(type: NodeTask, dependsOn: [compileTestKotlinJs, installDepen
1919
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
2020
}
2121

22-
jsTest.dependsOn testMochaNode
2322

2423
// -- Testing with Mocha under headless Chrome
2524

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

92-
jsTest.dependsOn testMochaJsdom
9391

0 commit comments

Comments
 (0)