blob: 928efc526d74402eaacfff3d4775a8b4f016e2b8 [file] [log] [blame]
Roman Elizarovdecbc832017-12-26 23:05:20 +03001/*
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
17apply plugin: 'kotlin-dce-js'
Roman Elizarov94fb2a32018-03-05 17:32:59 +030018apply from: rootProject.file('gradle/node-js.gradle')
Roman Elizarovdecbc832017-12-26 23:05:20 +030019
20dependencies {
21 compile "org.jetbrains.kotlinx:kotlinx-html-js:$html_version"
22}
23
24compileKotlin2Js {
25 kotlinOptions {
26 main = "call"
27 }
28}
29
Roman Elizarovdecbc832017-12-26 23:05:20 +030030task bundle(type: NpmTask, dependsOn: [npmInstall, runDceKotlinJs]) {
Roman Elizarov9fcb24f2018-03-06 11:25:09 +030031 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 Elizarovdecbc832017-12-26 23:05:20 +030035 args = ["run", "bundle"]
36}
37
38task start(type: NpmTask, dependsOn: bundle) {
39 args = ["run", "start"]
Roman Elizarov2b62f6d2017-12-27 17:43:08 +030040}
Roman Elizarovf0a55f32018-01-11 11:03:34 +030041
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
44afterEvaluate {
Roman Elizarov8fca5d32018-01-17 10:21:43 +030045 if (tasks.findByName('unpackDependenciesTestKotlinJs')) {
46 tasks.unpackDependenciesTestKotlinJs.enabled = false
47 }
Roman Elizarovf0a55f32018-01-11 11:03:34 +030048}