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