Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-2017 JetBrains s.r.o. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | apply plugin: 'kotlin-dce-js' |
Roman Elizarov | 94fb2a3 | 2018-03-05 17:32:59 +0300 | [diff] [blame] | 18 | apply from: rootProject.file('gradle/node-js.gradle') |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 19 | |
| 20 | dependencies { |
| 21 | compile "org.jetbrains.kotlinx:kotlinx-html-js:$html_version" |
| 22 | } |
| 23 | |
| 24 | compileKotlin2Js { |
| 25 | kotlinOptions { |
| 26 | main = "call" |
| 27 | } |
| 28 | } |
| 29 | |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 30 | task bundle(type: NpmTask, dependsOn: [npmInstall, runDceKotlinJs]) { |
Roman Elizarov | 9fcb24f | 2018-03-06 11:25:09 +0300 | [diff] [blame] | 31 | inputs.files(fileTree("$buildDir/kotlin-js-min/main")) |
| 32 | inputs.files(fileTree(file("src/main/web"))) |
| 33 | inputs.file("webpack.config.js") |
| 34 | outputs.dir("$buildDir/dist") |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 35 | args = ["run", "bundle"] |
| 36 | } |
| 37 | |
| 38 | task start(type: NpmTask, dependsOn: bundle) { |
| 39 | args = ["run", "start"] |
Roman Elizarov | 2b62f6d | 2017-12-27 17:43:08 +0300 | [diff] [blame] | 40 | } |
Roman Elizarov | f0a55f3 | 2018-01-11 11:03:34 +0300 | [diff] [blame] | 41 | |
| 42 | // we have not tests but kotlin-dce-js still tries to work with them and crashed. |
| 43 | // todo: Remove when KT-22028 is fixed |
| 44 | afterEvaluate { |
Roman Elizarov | 8fca5d3 | 2018-01-17 10:21:43 +0300 | [diff] [blame] | 45 | if (tasks.findByName('unpackDependenciesTestKotlinJs')) { |
| 46 | tasks.unpackDependenciesTestKotlinJs.enabled = false |
| 47 | } |
Roman Elizarov | f0a55f3 | 2018-01-11 11:03:34 +0300 | [diff] [blame] | 48 | } |