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 | |
| 13 | repositories { |
| 14 | jcenter() |
| 15 | maven { url "https://kotlin.bintray.com/kotlinx" } |
| 16 | } |
| 17 | |
Roman Elizarov | e1a5652 | 2018-04-04 10:31:08 +0300 | [diff] [blame] | 18 | tasks.withType(compileKotlin2Js.getClass()) { |
| 19 | kotlinOptions { |
| 20 | moduleKind = "umd" |
| 21 | sourceMap = true |
| 22 | metaInfo = true |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame^] | 23 | } |
| 24 | } |
| 25 | |
| 26 | compileKotlin2Js { |
| 27 | kotlinOptions { |
Roman Elizarov | e1a5652 | 2018-04-04 10:31:08 +0300 | [diff] [blame] | 28 | // drop -js suffix from outputFile |
| 29 | def baseName = project.name - "-js" |
| 30 | outputFile = new File(outputFile.parent, baseName + ".js") |
| 31 | } |
| 32 | } |
| 33 | |