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) { |
| 9 | ext.kotlin_version = '1.1-SNAPSHOT' |
| 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() |
| 16 | } |
| 17 | dependencies { |
| 18 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| 19 | classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" |
| 20 | classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFU_version" |
| 21 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | // --------------- pom configuration --------------- |
| 26 | |
| 27 | def pomConfig = { |
| 28 | licenses { |
| 29 | license { |
| 30 | name "The Apache Software License, Version 2.0" |
| 31 | url "http://www.apache.org/licenses/LICENSE-2.0.txt" |
| 32 | distribution "repo" |
| 33 | } |
| 34 | } |
| 35 | developers { |
| 36 | developer { |
| 37 | id "JetBrains" |
| 38 | name "JetBrains Team" |
| 39 | organization "JetBrains" |
| 40 | organizationUrl "http://www.jetbrains.com" |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | scm { |
| 45 | url "https://github.com/Kotlin/kotlinx.coroutines" |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // --------------- Configure sub-projects with Kotlin sources --------------- |
| 50 | |
| 51 | def sourceless = ['site'] |
| 52 | |
| 53 | configure(subprojects.findAll { !sourceless.contains(it.name) }) { |
| 54 | apply plugin: 'kotlin' |
| 55 | |
| 56 | sourceCompatibility = 1.6 |
| 57 | targetCompatibility = 1.6 |
| 58 | |
| 59 | tasks.withType(JavaCompile) { |
| 60 | options.encoding = 'UTF-8' |
| 61 | } |
| 62 | |
| 63 | kotlin.experimental.coroutines "enable" |
| 64 | |
| 65 | tasks.withType(Test) { |
| 66 | testLogging.showStandardStreams = true |
Roman Elizarov | 94c3168 | 2017-10-27 12:20:39 +0300 | [diff] [blame] | 67 | def stressTest = project.properties['stressTest'] |
Roman Elizarov | 6f5bd3f | 2017-10-26 18:15:00 +0300 | [diff] [blame] | 68 | if (stressTest != null) systemProperties['stressTest'] = stressTest |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | repositories { |
| 72 | jcenter() |
| 73 | maven { url "http://jcenter.bintray.com" } |
| 74 | maven { url "http://kotlin.bintray.com/kotlinx" } |
| 75 | maven { url "https://dl.bintray.com/devexperts/Maven/" } |
| 76 | } |
| 77 | |
| 78 | dependencies { |
| 79 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |
| 80 | testCompile "junit:junit:$junit_version" |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | // --------------- Configure sub-projects that are part of the library --------------- |
| 85 | |
| 86 | def internal = sourceless + ['benchmarks', 'knit'] |
| 87 | |
| 88 | configure(subprojects.findAll { !internal.contains(it.name) }) { |
| 89 | apply plugin: 'kotlinx-atomicfu' |
| 90 | |
| 91 | dependencies { |
| 92 | compileOnly "org.jetbrains.kotlinx:atomicfu:$atomicFU_version" |
| 93 | testCompile "org.jetbrains.kotlinx:atomicfu:$atomicFU_version" |
| 94 | } |
| 95 | |
| 96 | atomicFU { |
| 97 | inputFiles = sourceSets.main.output.classesDirs |
| 98 | outputDir = file("$buildDir/classes-atomicfu/main") |
| 99 | classPath = sourceSets.main.runtimeClasspath |
| 100 | } |
| 101 | |
| 102 | jar { |
| 103 | mainSpec.sourcePaths.clear() // hack to clear existing paths |
| 104 | from files(atomicFU.outputs, sourceSets.main.output.resourcesDir) |
| 105 | } |
| 106 | |
| 107 | test { |
| 108 | classpath = files(configurations.testRuntime, atomicFU.outputs, sourceSets.test.output.classesDirs, |
| 109 | sourceSets.main.output.resourcesDir) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | configure(subprojects.findAll { !internal.contains(it.name) && it.name != 'kotlinx-coroutines-core'}) { |
| 114 | dependencies { |
| 115 | compile project(':kotlinx-coroutines-core') |
| 116 | //the only way IDEA can resolve test classes |
| 117 | testCompile project(':kotlinx-coroutines-core').sourceSets.test.output |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | // --------------- Configure sub-projects that are published --------------- |
| 122 | |
| 123 | def unpublished = internal + 'kotlinx-coroutines-rx-example' |
| 124 | |
| 125 | def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/" |
| 126 | def core_docs_file = "$projectDir/core/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list" |
| 127 | |
| 128 | configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
| 129 | apply plugin: 'maven' |
| 130 | apply plugin: 'maven-publish' |
| 131 | apply plugin: 'org.jetbrains.dokka' |
| 132 | apply plugin: 'com.jfrog.bintray' |
| 133 | |
| 134 | dokka { |
| 135 | outputFormat = 'kotlin-website' |
| 136 | } |
| 137 | |
| 138 | task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) { |
| 139 | outputFormat = 'javadoc' |
| 140 | outputDirectory = "$buildDir/javadoc" |
| 141 | } |
| 142 | |
| 143 | tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) { |
| 144 | jdkVersion = 8 |
| 145 | includes = ['README.md'] |
| 146 | linkMapping { |
Roman Elizarov | 8fc0075 | 2017-10-27 13:35:36 +0300 | [diff] [blame] | 147 | def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 148 | dir = "$projectDir/src/main/kotlin" |
Roman Elizarov | 8fc0075 | 2017-10-27 13:35:36 +0300 | [diff] [blame] | 149 | url = "http://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src/main/kotlin" |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 150 | suffix = "#L" |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { |
| 155 | classifier = 'javadoc' |
| 156 | from "$buildDir/javadoc" |
| 157 | } |
| 158 | |
| 159 | task sourcesJar(type: Jar, dependsOn: classes) { |
| 160 | classifier = 'sources' |
| 161 | from sourceSets.main.allSource |
| 162 | } |
| 163 | |
| 164 | publishing { |
| 165 | publications { |
| 166 | maven(MavenPublication) { |
Roman Elizarov | eb98bc8 | 2017-10-27 14:57:08 +0300 | [diff] [blame] | 167 | from components.java |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 168 | artifact javadocJar |
| 169 | artifact sourcesJar |
| 170 | pom.withXml { |
| 171 | def root = asNode() |
| 172 | root.appendNode('name', project.name) |
| 173 | root.appendNode('description', 'Coroutines support libraries for Kotlin') |
| 174 | root.appendNode('url', 'https://github.com/Kotlin/kotlinx.coroutines') |
| 175 | root.children().last() + pomConfig |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | bintray { |
| 182 | user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') |
| 183 | key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') |
| 184 | publications = ['maven'] |
| 185 | pkg { |
| 186 | userOrg = 'kotlin' |
| 187 | repo = 'kotlinx' |
| 188 | name = 'kotlinx.coroutines' |
| 189 | version { |
| 190 | name = project.version |
| 191 | vcsTag = project.version |
| 192 | released = new Date() |
| 193 | } |
| 194 | } |
| 195 | } |
Roman Elizarov | ba5e5da | 2017-10-27 14:02:55 +0300 | [diff] [blame] | 196 | |
| 197 | bintrayUpload.doLast { |
| 198 | println("Uploaded $project.name version $project.version") |
| 199 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | configure(subprojects.findAll { !unpublished.contains(it.name) && it.name != 'kotlinx-coroutines-core' }) { |
| 203 | dokka.dependsOn project(':kotlinx-coroutines-core').dokka |
| 204 | dokkaJavadoc.dependsOn project(':kotlinx-coroutines-core').dokka |
| 205 | |
| 206 | tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) { |
| 207 | externalDocumentationLink { |
| 208 | url = new URL(core_docs_url) |
| 209 | packageListUrl = new URL("file://$core_docs_file") |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | apply plugin: 'base' |
| 215 | |
| 216 | clean.dependsOn gradle.includedBuilds.collect { it.task(':clean') } |