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