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