Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 1 | /* |
Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame^] | 2 | * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 3 | */ |
| 4 | |
| 5 | apply plugin: 'kotlin-dce-js' |
Roman Elizarov | 94fb2a3 | 2018-03-05 17:32:59 +0300 | [diff] [blame] | 6 | apply from: rootProject.file('gradle/node-js.gradle') |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 7 | |
| 8 | dependencies { |
| 9 | compile "org.jetbrains.kotlinx:kotlinx-html-js:$html_version" |
| 10 | } |
| 11 | |
| 12 | compileKotlin2Js { |
| 13 | kotlinOptions { |
| 14 | main = "call" |
| 15 | } |
| 16 | } |
| 17 | |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 18 | task bundle(type: NpmTask, dependsOn: [npmInstall, runDceKotlinJs]) { |
Roman Elizarov | 9fcb24f | 2018-03-06 11:25:09 +0300 | [diff] [blame] | 19 | inputs.files(fileTree("$buildDir/kotlin-js-min/main")) |
| 20 | inputs.files(fileTree(file("src/main/web"))) |
| 21 | inputs.file("webpack.config.js") |
| 22 | outputs.dir("$buildDir/dist") |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 23 | args = ["run", "bundle"] |
| 24 | } |
| 25 | |
| 26 | task start(type: NpmTask, dependsOn: bundle) { |
| 27 | args = ["run", "start"] |
Roman Elizarov | 2b62f6d | 2017-12-27 17:43:08 +0300 | [diff] [blame] | 28 | } |
Roman Elizarov | f0a55f3 | 2018-01-11 11:03:34 +0300 | [diff] [blame] | 29 | |
| 30 | // we have not tests but kotlin-dce-js still tries to work with them and crashed. |
| 31 | // todo: Remove when KT-22028 is fixed |
| 32 | afterEvaluate { |
Roman Elizarov | 8fca5d3 | 2018-01-17 10:21:43 +0300 | [diff] [blame] | 33 | if (tasks.findByName('unpackDependenciesTestKotlinJs')) { |
| 34 | tasks.unpackDependenciesTestKotlinJs.enabled = false |
| 35 | } |
Roman Elizarov | f0a55f3 | 2018-01-11 11:03:34 +0300 | [diff] [blame] | 36 | } |