@@ -6,65 +6,67 @@ allprojects {
6
6
7
7
buildscript {
8
8
if (System . properties[' kotlinSnapshot' ] != null ) {
9
- ext. kotlin_version = ' 1.1 -SNAPSHOT'
9
+ ext. kotlin_version = ' 1.2 -SNAPSHOT'
10
10
repositories {
11
11
maven { url " https://oss.sonatype.org/content/repositories/snapshots" }
12
12
}
13
13
}
14
14
repositories {
15
15
jcenter()
16
16
maven { url " http://kotlin.bintray.com/kotlinx" }
17
+ maven { url " http://kotlin.bintray.com/kotlin-dev" }
18
+ maven { url " https://plugins.gradle.org/m2/" }
17
19
}
18
20
dependencies {
19
21
classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
20
22
classpath " org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version "
21
23
classpath " org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFU_version "
22
- classpath ' com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
24
+ classpath " com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version "
25
+ classpath " com.moowork.gradle:gradle-node-plugin:$gradle_node_version "
23
26
}
24
27
}
25
28
26
- // --------------- pom configuration ---------------
29
+ // --------------- Configure sub-projects with Kotlin sources ---------------
27
30
28
- def pomConfig = {
29
- licenses {
30
- license {
31
- name " The Apache Software License, Version 2.0"
32
- url " http://www.apache.org/licenses/LICENSE-2.0.txt"
33
- distribution " repo"
34
- }
35
- }
36
- developers {
37
- developer {
38
- id " JetBrains"
39
- name " JetBrains Team"
40
- organization " JetBrains"
41
- organizationUrl " http://www.jetbrains.com"
42
- }
43
- }
31
+ def sourceless = [' site' ]
44
32
45
- scm {
46
- url " https://github.com/Kotlin/kotlinx.coroutines"
47
- }
33
+ static def platformOf (project ) {
34
+ if (project. name. endsWith(" -common" )) return " common"
35
+ if (project. name. endsWith(" -js" )) return " js"
36
+ return " jvm"
48
37
}
49
38
50
- // --------------- Configure sub-projects with Kotlin sources ---------------
51
-
52
- def sourceless = [' site' ]
39
+ static def platformLib (base , platform ) {
40
+ if (platform == " jvm" ) return base
41
+ return " $base -$platform "
42
+ }
53
43
54
44
configure(subprojects. findAll { ! sourceless. contains(it. name) }) {
55
- apply plugin : ' kotlin'
45
+ def platform = platformOf(it)
46
+ apply plugin : " kotlin-platform-$platform "
56
47
57
- sourceCompatibility = 1.6
58
- targetCompatibility = 1.6
59
-
60
- tasks. withType(JavaCompile ) {
61
- options. encoding = ' UTF-8'
48
+ if (platform == " jvm" ) {
49
+ sourceCompatibility = 1.6
50
+ targetCompatibility = 1.6
62
51
}
63
-
52
+
64
53
kotlin. experimental. coroutines " enable"
65
54
55
+ if (platform == " js" ) {
56
+ tasks. withType(compileKotlin2Js. getClass()) {
57
+ kotlinOptions {
58
+ moduleKind = " umd"
59
+ sourceMap = true
60
+ metaInfo = true
61
+ }
62
+ }
63
+ }
64
+
66
65
tasks. withType(Test ) {
67
- testLogging. showStandardStreams = true
66
+ testLogging {
67
+ showStandardStreams = true
68
+ events " passed" , " failed"
69
+ }
68
70
def stressTest = project. properties[' stressTest' ]
69
71
if (stressTest != null ) systemProperties[' stressTest' ] = stressTest
70
72
}
@@ -75,17 +77,34 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) {
75
77
maven { url " https://dl.bintray.com/devexperts/Maven/" }
76
78
}
77
79
80
+ def kotlin_stdlib = platformLib(" kotlin-stdlib" , platform)
81
+ def kotlin_test = platformLib(" kotlin-test" , platform)
82
+
78
83
dependencies {
79
- compile " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
80
- testCompile " junit:junit:$junit_version "
84
+ compile " org.jetbrains.kotlin:$kotlin_stdlib :$kotlin_version "
85
+ testCompile " org.jetbrains.kotlin:$kotlin_test :$kotlin_version "
86
+ }
87
+
88
+ if (platform == " common" ) {
89
+ dependencies {
90
+ testCompile " org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version "
91
+ }
92
+ }
93
+
94
+ if (platform == " jvm" ) {
95
+ dependencies {
96
+ testCompile " junit:junit:$junit_version "
97
+ testCompile " org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version "
98
+ }
81
99
}
82
100
}
83
101
84
102
// --------------- Configure sub-projects that are part of the library ---------------
85
103
86
- def internal = sourceless + [' benchmarks' , ' knit' ]
104
+ def internal = sourceless + [' benchmarks' , ' knit' , ' js-stub ' ]
87
105
88
- configure(subprojects. findAll { ! internal. contains(it. name) }) {
106
+ // configure atomicfu for JVM modules
107
+ configure(subprojects. findAll { ! internal. contains(it. name) && platformOf(it) == " jvm" }) {
89
108
apply plugin : ' kotlinx-atomicfu'
90
109
91
110
dependencies {
@@ -110,104 +129,53 @@ configure(subprojects.findAll { !internal.contains(it.name) }) {
110
129
}
111
130
}
112
131
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
132
+ // configure dependencies on core
133
+ configure(subprojects. findAll { ! internal. contains(it. name) && it. name != ' kotlinx-coroutines-core-common' }) {
134
+ def platform = platformOf(it)
135
+ def coroutines_core = platformLib(" kotlinx-coroutines-core" , platform)
136
+
137
+ if (it. name == coroutines_core) {
138
+ dependencies {
139
+ expectedBy project(' :kotlinx-coroutines-core-common' )
140
+ }
141
+ } else {
142
+ dependencies {
143
+ compile project(" :$coroutines_core " )
144
+ // the only way IDEA can resolve test classes
145
+ testCompile project(" :$coroutines_core " ). sourceSets. test. output
146
+ }
118
147
}
119
148
}
120
149
121
150
// --------------- Configure sub-projects that are published ---------------
122
151
123
- def unpublished = internal + ' kotlinx-coroutines-rx-example'
152
+ def unpublished = internal + [ ' kotlinx-coroutines-rx-example' , ' example-frontend-js ' ]
124
153
125
154
def core_docs_url = " https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/"
126
155
def core_docs_file = " $projectDir /core/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list"
127
156
128
157
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 {
147
- def relPath = rootProject. projectDir. toPath(). relativize(projectDir. toPath())
148
- dir = " $projectDir /src/main/kotlin"
149
- url = " http://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath /src/main/kotlin"
150
- suffix = " #L"
151
- }
152
- }
153
-
154
- task javadocJar(type : Jar , dependsOn : dokkaJavadoc) {
155
- classifier = ' javadoc'
156
- from " $buildDir /javadoc"
157
- }
158
+ apply from : rootProject. file(' gradle/dokka.gradle' )
159
+ apply from : rootProject. file(' gradle/publish-bintray.gradle' )
160
+ }
158
161
159
- task sourcesJar(type : Jar , dependsOn : classes) {
160
- classifier = ' sources'
161
- from sourceSets. main. allSource
162
- }
162
+ configure(subprojects. findAll { ! unpublished. contains(it. name) }) {
163
+ def platform = platformOf(it)
164
+ def coroutines_core = platformLib(" kotlinx-coroutines-core" , platform)
163
165
164
- publishing {
165
- publications {
166
- maven(MavenPublication ) {
167
- from components. java
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
- }
166
+ if (it. name != coroutines_core) {
167
+ dokka. dependsOn project(" :$coroutines_core " ). dokka
180
168
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 ()
169
+ tasks. withType(dokka. getClass()) {
170
+ externalDocumentationLink {
171
+ url = new URL (core_docs_url)
172
+ packageListUrl = new URL (" file://$core_docs_file " )
193
173
}
194
174
}
195
175
}
196
-
197
- bintrayUpload. doLast {
198
- println (" Uploaded $project . name version $project . version " )
199
- }
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
- }
176
+
177
+ if (platform == " jvm" ) {
178
+ dokkaJavadoc. dependsOn project(" :$coroutines_core " ). dokka
211
179
}
212
180
}
213
181
0 commit comments