Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
| 3 | */ |
Roman Elizarov | e1a5652 | 2018-04-04 10:31:08 +0300 | [diff] [blame] | 4 | |
| 5 | // Platform-specific configuration to compile JS modules |
| 6 | |
| 7 | apply plugin: 'kotlin-platform-js' |
| 8 | |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame] | 9 | kotlin.experimental.coroutines "enable" |
| 10 | |
| 11 | dependencies { |
| 12 | compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" |
| 13 | testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" |
| 14 | } |
| 15 | |
Roman Elizarov | e1a5652 | 2018-04-04 10:31:08 +0300 | [diff] [blame] | 16 | tasks.withType(compileKotlin2Js.getClass()) { |
| 17 | kotlinOptions { |
| 18 | moduleKind = "umd" |
| 19 | sourceMap = true |
| 20 | metaInfo = true |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame] | 21 | } |
| 22 | } |
| 23 | |
| 24 | compileKotlin2Js { |
| 25 | kotlinOptions { |
Roman Elizarov | e1a5652 | 2018-04-04 10:31:08 +0300 | [diff] [blame] | 26 | // drop -js suffix from outputFile |
| 27 | def baseName = project.name - "-js" |
| 28 | outputFile = new File(outputFile.parent, baseName + ".js") |
| 29 | } |
| 30 | } |
| 31 | |