Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 1 | allprojects { |
| 2 | group = 'org.jetbrains.kotlinx' |
Roman Elizarov | ba5e5da | 2017-10-27 14:02:55 +0300 | [diff] [blame] | 3 | def deployVersion = properties['DeployVersion'] |
| 4 | if (deployVersion != null) version = deployVersion |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 5 | } |
| 6 | |
| 7 | buildscript { |
Roman Elizarov | 1f6b44d | 2017-10-26 17:51:52 +0300 | [diff] [blame] | 8 | if (System.properties['kotlinSnapshot'] != null) { |
Roman Elizarov | dadd50c | 2017-12-21 17:34:12 +0300 | [diff] [blame] | 9 | ext.kotlin_version = '1.2-SNAPSHOT' |
Roman Elizarov | 1f6b44d | 2017-10-26 17:51:52 +0300 | [diff] [blame] | 10 | repositories { |
| 11 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 12 | } |
| 13 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 14 | repositories { |
| 15 | jcenter() |
Roman Elizarov | 4d84a78 | 2017-11-30 13:23:40 +0300 | [diff] [blame] | 16 | maven { url "http://kotlin.bintray.com/kotlinx" } |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame^] | 17 | maven { url "https://plugins.gradle.org/m2/" } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 18 | } |
| 19 | dependencies { |
| 20 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| 21 | classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" |
| 22 | classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFU_version" |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame^] | 23 | classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version" |
| 24 | classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version" |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 25 | } |
| 26 | } |
| 27 | |
| 28 | // --------------- pom configuration --------------- |
| 29 | |
| 30 | def pomConfig = { |
| 31 | licenses { |
| 32 | license { |
| 33 | name "The Apache Software License, Version 2.0" |
| 34 | url "http://www.apache.org/licenses/LICENSE-2.0.txt" |
| 35 | distribution "repo" |
| 36 | } |
| 37 | } |
| 38 | developers { |
| 39 | developer { |
| 40 | id "JetBrains" |
| 41 | name "JetBrains Team" |
| 42 | organization "JetBrains" |
| 43 | organizationUrl "http://www.jetbrains.com" |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | scm { |
| 48 | url "https://github.com/Kotlin/kotlinx.coroutines" |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // --------------- Configure sub-projects with Kotlin sources --------------- |
| 53 | |
| 54 | def sourceless = ['site'] |
| 55 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 56 | static def platformOf(project) { |
| 57 | if (project.name.endsWith("-common")) return "common" |
| 58 | if (project.name.endsWith("-js")) return "js" |
| 59 | return "jvm" |
| 60 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 61 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 62 | static def platformLib(base, platform) { |
| 63 | if (platform == "jvm") return base |
| 64 | return "$base-$platform" |
| 65 | } |
| 66 | |
| 67 | configure(subprojects.findAll { !sourceless.contains(it.name) }) { |
| 68 | def platform = platformOf(it) |
| 69 | apply plugin: "kotlin-platform-$platform" |
| 70 | |
| 71 | if (platform == "jvm") { |
| 72 | sourceCompatibility = 1.6 |
| 73 | targetCompatibility = 1.6 |
| 74 | |
| 75 | tasks.withType(JavaCompile) { |
| 76 | options.encoding = 'UTF-8' |
| 77 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 78 | } |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 79 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 80 | kotlin.experimental.coroutines "enable" |
| 81 | |
| 82 | tasks.withType(Test) { |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame^] | 83 | testLogging { |
| 84 | showStandardStreams = true |
| 85 | events "passed", "failed" |
| 86 | } |
Roman Elizarov | 94c3168 | 2017-10-27 12:20:39 +0300 | [diff] [blame] | 87 | def stressTest = project.properties['stressTest'] |
Roman Elizarov | 6f5bd3f | 2017-10-26 18:15:00 +0300 | [diff] [blame] | 88 | if (stressTest != null) systemProperties['stressTest'] = stressTest |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | repositories { |
| 92 | jcenter() |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 93 | maven { url "http://kotlin.bintray.com/kotlinx" } |
| 94 | maven { url "https://dl.bintray.com/devexperts/Maven/" } |
| 95 | } |
| 96 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 97 | def kotlin_stdlib = platformLib("kotlin-stdlib", platform) |
Roman Elizarov | 8bff72b | 2017-12-20 12:55:38 +0300 | [diff] [blame] | 98 | def kotlin_test = platformLib("kotlin-test", platform) |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 99 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 100 | dependencies { |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 101 | compile "org.jetbrains.kotlin:$kotlin_stdlib:$kotlin_version" |
Roman Elizarov | 8bff72b | 2017-12-20 12:55:38 +0300 | [diff] [blame] | 102 | testCompile "org.jetbrains.kotlin:$kotlin_test:$kotlin_version" |
| 103 | } |
| 104 | |
| 105 | if (platform == "common") { |
| 106 | dependencies { |
| 107 | testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version" |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | if (platform == "jvm") { |
| 112 | dependencies { |
| 113 | testCompile "junit:junit:$junit_version" |
| 114 | testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" |
| 115 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 116 | } |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame^] | 117 | |
| 118 | if (platform == "js") { |
| 119 | apply from: rootProject.file('gradle/test-js.gradle') |
| 120 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | // --------------- Configure sub-projects that are part of the library --------------- |
| 124 | |
| 125 | def internal = sourceless + ['benchmarks', 'knit'] |
| 126 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 127 | // configure atomicfu for JVM modules |
| 128 | configure(subprojects.findAll { !internal.contains(it.name) && platformOf(it) == "jvm" }) { |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 129 | apply plugin: 'kotlinx-atomicfu' |
| 130 | |
| 131 | dependencies { |
| 132 | compileOnly "org.jetbrains.kotlinx:atomicfu:$atomicFU_version" |
| 133 | testCompile "org.jetbrains.kotlinx:atomicfu:$atomicFU_version" |
| 134 | } |
| 135 | |
| 136 | atomicFU { |
| 137 | inputFiles = sourceSets.main.output.classesDirs |
| 138 | outputDir = file("$buildDir/classes-atomicfu/main") |
| 139 | classPath = sourceSets.main.runtimeClasspath |
| 140 | } |
| 141 | |
| 142 | jar { |
| 143 | mainSpec.sourcePaths.clear() // hack to clear existing paths |
| 144 | from files(atomicFU.outputs, sourceSets.main.output.resourcesDir) |
| 145 | } |
| 146 | |
| 147 | test { |
| 148 | classpath = files(configurations.testRuntime, atomicFU.outputs, sourceSets.test.output.classesDirs, |
| 149 | sourceSets.main.output.resourcesDir) |
| 150 | } |
| 151 | } |
| 152 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 153 | // configure dependencies on core |
| 154 | configure(subprojects.findAll { !internal.contains(it.name) && it.name != 'kotlinx-coroutines-core-common'}) { |
| 155 | def platform = platformOf(it) |
| 156 | def coroutines_core = platformLib("kotlinx-coroutines-core", platform) |
| 157 | |
| 158 | if (it.name == coroutines_core) { |
| 159 | dependencies { |
| 160 | expectedBy project(':kotlinx-coroutines-core-common') |
| 161 | } |
| 162 | } else { |
| 163 | dependencies { |
| 164 | compile project(":$coroutines_core") |
| 165 | //the only way IDEA can resolve test classes |
| 166 | testCompile project(":$coroutines_core").sourceSets.test.output |
| 167 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 168 | } |
| 169 | } |
| 170 | |
| 171 | // --------------- Configure sub-projects that are published --------------- |
| 172 | |
| 173 | def unpublished = internal + 'kotlinx-coroutines-rx-example' |
| 174 | |
| 175 | def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/" |
| 176 | def core_docs_file = "$projectDir/core/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list" |
| 177 | |
| 178 | configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame^] | 179 | apply from: rootProject.file('gradle/dokka.gradle') |
| 180 | apply from: rootProject.file('gradle/publish-bintray.gradle') |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 181 | } |
| 182 | |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame^] | 183 | configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 184 | def platform = platformOf(it) |
| 185 | def coroutines_core = platformLib("kotlinx-coroutines-core", platform) |
| 186 | |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame^] | 187 | if (it.name != coroutines_core) { |
| 188 | dokka.dependsOn project(":$coroutines_core").dokka |
| 189 | |
| 190 | tasks.withType(dokka.getClass()) { |
| 191 | externalDocumentationLink { |
| 192 | url = new URL(core_docs_url) |
| 193 | packageListUrl = new URL("file://$core_docs_file") |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
Roman Elizarov | e1c0b65 | 2017-12-01 14:02:57 +0300 | [diff] [blame] | 198 | if (platform == "jvm") { |
| 199 | dokkaJavadoc.dependsOn project(":$coroutines_core").dokka |
| 200 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | apply plugin: 'base' |
| 204 | |
| 205 | clean.dependsOn gradle.includedBuilds.collect { it.task(':clean') } |