| /* |
| * Copyright 2016-2017 JetBrains s.r.o. |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| apply plugin: 'kotlin-dce-js' |
| apply from: rootProject.file('gradle/node-js.gradle') |
| |
| dependencies { |
| compile "org.jetbrains.kotlinx:kotlinx-html-js:$html_version" |
| } |
| |
| compileKotlin2Js { |
| kotlinOptions { |
| main = "call" |
| } |
| } |
| |
| task bundle(type: NpmTask, dependsOn: [npmInstall, runDceKotlinJs]) { |
| inputs.files(fileTree("$buildDir/kotlin-js-min/main")) |
| inputs.files(fileTree(file("src/main/web"))) |
| inputs.file("webpack.config.js") |
| outputs.dir("$buildDir/dist") |
| args = ["run", "bundle"] |
| } |
| |
| task start(type: NpmTask, dependsOn: bundle) { |
| args = ["run", "start"] |
| } |
| |
| // we have not tests but kotlin-dce-js still tries to work with them and crashed. |
| // todo: Remove when KT-22028 is fixed |
| afterEvaluate { |
| if (tasks.findByName('unpackDependenciesTestKotlinJs')) { |
| tasks.unpackDependenciesTestKotlinJs.enabled = false |
| } |
| } |