blob: 4a772a51843a656b68b1fe92fb37138b0591ffd3 [file] [log] [blame]
Kirill Timofeeva5186962017-10-25 14:25:47 +03001allprojects {
2 group = 'org.jetbrains.kotlinx'
Roman Elizarovba5e5da2017-10-27 14:02:55 +03003 def deployVersion = properties['DeployVersion']
4 if (deployVersion != null) version = deployVersion
Kirill Timofeeva5186962017-10-25 14:25:47 +03005}
6
7buildscript {
Roman Elizarov1f6b44d2017-10-26 17:51:52 +03008 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 Timofeeva5186962017-10-25 14:25:47 +030014 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
27def 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
51def sourceless = ['site']
52
53configure(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 Elizarov94c31682017-10-27 12:20:39 +030067 def stressTest = project.properties['stressTest']
Roman Elizarov6f5bd3f2017-10-26 18:15:00 +030068 if (stressTest != null) systemProperties['stressTest'] = stressTest
Kirill Timofeeva5186962017-10-25 14:25:47 +030069 }
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
86def internal = sourceless + ['benchmarks', 'knit']
87
88configure(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
113configure(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
123def unpublished = internal + 'kotlinx-coroutines-rx-example'
124
125def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/"
126def core_docs_file = "$projectDir/core/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list"
127
128configure(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 Elizarov8fc00752017-10-27 13:35:36 +0300147 def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
Kirill Timofeeva5186962017-10-25 14:25:47 +0300148 dir = "$projectDir/src/main/kotlin"
Roman Elizarov8fc00752017-10-27 13:35:36 +0300149 url = "http://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src/main/kotlin"
Kirill Timofeeva5186962017-10-25 14:25:47 +0300150 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 Elizaroveb98bc82017-10-27 14:57:08 +0300167 from components.java
Kirill Timofeeva5186962017-10-25 14:25:47 +0300168 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 Elizarovba5e5da2017-10-27 14:02:55 +0300196
197 bintrayUpload.doLast {
198 println("Uploaded $project.name version $project.version")
199 }
Kirill Timofeeva5186962017-10-25 14:25:47 +0300200}
201
202configure(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
214apply plugin: 'base'
215
216clean.dependsOn gradle.includedBuilds.collect { it.task(':clean') }