Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 1 | allprojects { |
Roman Elizarov | ba5e5da | 2017-10-27 14:02:55 +0300 | [diff] [blame] | 2 | def deployVersion = properties['DeployVersion'] |
| 3 | if (deployVersion != null) version = deployVersion |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 4 | } |
| 5 | |
| 6 | buildscript { |
Roman Elizarov | 8fca5d3 | 2018-01-17 10:21:43 +0300 | [diff] [blame] | 7 | if (rootProject.properties['kotlinSnapshot'] != null) { |
Roman Elizarov | dadd50c | 2017-12-21 17:34:12 +0300 | [diff] [blame] | 8 | ext.kotlin_version = '1.2-SNAPSHOT' |
Roman Elizarov | 1f6b44d | 2017-10-26 17:51:52 +0300 | [diff] [blame] | 9 | repositories { |
| 10 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 11 | } |
| 12 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 13 | repositories { |
| 14 | jcenter() |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame^] | 15 | maven { url "https://kotlin.bintray.com/kotlinx" } |
| 16 | maven { url "https://kotlin.bintray.com/kotlin-dev" } |
| 17 | maven { url "https://jetbrains.bintray.com/kotlin-native-dependencies" } |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 18 | maven { url "https://plugins.gradle.org/m2/" } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 19 | } |
| 20 | dependencies { |
| 21 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame^] | 22 | classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$kotlin_native_version" |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 23 | classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" |
| 24 | classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFU_version" |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 25 | classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version" |
| 26 | classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version" |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 27 | } |
| 28 | } |
| 29 | |
Roman Elizarov | 38b6fd3 | 2018-01-17 10:12:23 +0300 | [diff] [blame] | 30 | // Report Kotlin compiler version when building project |
| 31 | println("Using Kotlin compiler version: $org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION") |
| 32 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 33 | // --------------- Configure sub-projects with Kotlin sources --------------- |
| 34 | |
| 35 | def sourceless = ['site'] |
| 36 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 37 | static def platformOf(project) { |
| 38 | if (project.name.endsWith("-common")) return "common" |
| 39 | if (project.name.endsWith("-js")) return "js" |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame^] | 40 | if (project.name.endsWith("-native")) return "native" |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 41 | return "jvm" |
| 42 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 43 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 44 | static def platformLib(base, platform) { |
| 45 | if (platform == "jvm") return base |
| 46 | return "$base-$platform" |
| 47 | } |
| 48 | |
| 49 | configure(subprojects.findAll { !sourceless.contains(it.name) }) { |
| 50 | def platform = platformOf(it) |
Roman Elizarov | e1a5652 | 2018-04-04 10:31:08 +0300 | [diff] [blame] | 51 | apply from: rootProject.file("gradle/compile-${platform}.gradle") |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | // --------------- Configure sub-projects that are part of the library --------------- |
| 55 | |
Roman Elizarov | a964799 | 2017-12-26 13:09:43 +0300 | [diff] [blame] | 56 | def internal = sourceless + ['benchmarks', 'knit', 'js-stub'] |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 57 | |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame^] | 58 | // configure atomicfu |
| 59 | configure(subprojects.findAll { !internal.contains(it.name) }) { |
| 60 | def platform = platformOf(it) |
| 61 | apply from: rootProject.file("gradle/atomicfu-${platform}.gradle") |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 62 | } |
| 63 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 64 | // configure dependencies on core |
| 65 | configure(subprojects.findAll { !internal.contains(it.name) && it.name != 'kotlinx-coroutines-core-common'}) { |
| 66 | def platform = platformOf(it) |
| 67 | def coroutines_core = platformLib("kotlinx-coroutines-core", platform) |
| 68 | |
| 69 | if (it.name == coroutines_core) { |
| 70 | dependencies { |
| 71 | expectedBy project(':kotlinx-coroutines-core-common') |
| 72 | } |
| 73 | } else { |
| 74 | dependencies { |
| 75 | compile project(":$coroutines_core") |
| 76 | //the only way IDEA can resolve test classes |
| 77 | testCompile project(":$coroutines_core").sourceSets.test.output |
| 78 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 79 | } |
| 80 | } |
| 81 | |
| 82 | // --------------- Configure sub-projects that are published --------------- |
| 83 | |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame^] | 84 | // todo: native is not published yet |
| 85 | def unpublished = internal + ['kotlinx-coroutines-rx-example', 'example-frontend-js', 'kotlinx-coroutines-core-native'] |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 86 | |
| 87 | def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/" |
| 88 | def core_docs_file = "$projectDir/core/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list" |
| 89 | |
| 90 | configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 91 | apply from: rootProject.file('gradle/dokka.gradle') |
| 92 | apply from: rootProject.file('gradle/publish-bintray.gradle') |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 93 | } |
| 94 | |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 95 | configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 96 | def platform = platformOf(it) |
| 97 | def coroutines_core = platformLib("kotlinx-coroutines-core", platform) |
| 98 | |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 99 | if (it.name != coroutines_core) { |
| 100 | dokka.dependsOn project(":$coroutines_core").dokka |
| 101 | |
| 102 | tasks.withType(dokka.getClass()) { |
| 103 | externalDocumentationLink { |
| 104 | url = new URL(core_docs_url) |
| 105 | packageListUrl = new URL("file://$core_docs_file") |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 110 | if (platform == "jvm") { |
| 111 | dokkaJavadoc.dependsOn project(":$coroutines_core").dokka |
| 112 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 113 | } |
| 114 | |
Roman Elizarov | 94fb2a3 | 2018-03-05 17:32:59 +0300 | [diff] [blame] | 115 | // main deployment task |
| 116 | task deploy(dependsOn: getTasksByName("bintrayUpload", true) + getTasksByName("publishNpm", true)) |
| 117 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 118 | apply plugin: 'base' |
| 119 | |
| 120 | clean.dependsOn gradle.includedBuilds.collect { it.task(':clean') } |