1/*
2 * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4
5apply plugin: 'kotlin-dce-js'
6apply from: rootProject.file('gradle/node-js.gradle')
7
8dependencies {
9    compile "org.jetbrains.kotlinx:kotlinx-html-js:$html_version"
10}
11
12compileKotlin2Js {
13    kotlinOptions {
14        main = "call"
15    }
16}
17
18task bundle(type: NpmTask, dependsOn: [npmInstall, runDceKotlinJs]) {
19    inputs.files(fileTree("$buildDir/kotlin-js-min/main"))
20    inputs.files(fileTree(file("src/main/web")))
21    inputs.file("npm/webpack.config.js")
22    outputs.dir("$buildDir/dist")
23    args = ["run", "bundle"]
24}
25
26task start(type: NpmTask, dependsOn: bundle) {
27    args = ["run", "start"]
28}
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
32afterEvaluate {
33    if (tasks.findByName('unpackDependenciesTestKotlinJs')) {
34        tasks.unpackDependenciesTestKotlinJs.enabled = false
35    }
36}
37