Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Dec 28, 2017
2 parents d2d42ea + db667eb commit ca83391
Show file tree
Hide file tree
Showing 169 changed files with 8,476 additions and 1,702 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/.idea
.idea
*.iml
.gradle
.gradletasknamecache
build
out
target
target
node_modules
package-lock.json
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change log for kotlinx.coroutines

## Version 0.21

* Migrated to Kotlin 1.2.10.
* Coroutines library for [Kotlin/JS](js/README.md) and [multiplatform projects](https://kotlinlang.org/docs/reference/multiplatform.html) (see #33):
* `launch` and `async` coroutine builders.
* `Job` and `Deferred` light-weight future with cancellation support.
* `delay` and `yield` top-level suspending functions.
* `await` extension for JS `Promise` and `asPromise`/`asDeferred` conversions.
* `promise` coroutine builder.
* `Job()` and `CompletableDeferred()` factories.
* Full support for parent-child coroutine hierarchies.
* `Window.awaitAnimationFrame` extension function.
* [Sample frontend Kotlin/JS application](js/example-frontend-js/README.md) with coroutine-driven animations.
* `run` is deprecated and renamed to `withContext` (see #134).
* `runBlocking` and `EventLoop` implementations optimized (see #190).

## Version 0.20

* Migrated to Kotlin 1.2.0.
Expand Down
38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@

[![official JetBrains project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=0.20) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/0.20)
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=0.21) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/0.21)

Library support for Kotlin coroutines.
This is a companion version for Kotlin 1.2.0 release.
Library support for Kotlin coroutines in
[Kotlin/JVM](core/README.md) and
[Kotlin/JS](js/README.md).
This is a companion version for Kotlin 1.2.10 release.

```kotlin
launch {
delay(1000)
println("Hello from Kotlin Coroutines!")
}
```

## Modules

* [core](core/README.md) -- core primitives to work with coroutines:
* `launch`, `async`, `produce`, `actor`, etc coroutine builders;
* [common](common/README.md) - common coroutines across all backends:
* `launch` and `async` coroutine builders;
* `Job` and `Deferred` light-weight future with cancellation support;
* `CommonPool` and other coroutine contexts;
* `delay` and `yield` top-level suspending functions.
* [js](js/README.md) - Kotlin/JS implementation of common coroutines with `Promise` support.
* [core](core/README.md) -- Kotlin/JVM implementation of common coroutines with additional features:
* `CommonPool` coroutine context (default on JVM);
* `Channel` and `Mutex` communication and synchronization primitives;
* `delay`, `yield`, etc top-level suspending functions;
* `produce` and `actor` coroutine builders;
* `select` expression support and more.
* [reactive](reactive/README.md) -- modules that provide builders and iteration support for various reactive streams libraries:
* Reactive Streams, RxJava 1.x and 2.x and Project Reactor.
Expand Down Expand Up @@ -52,15 +64,15 @@ Add dependencies (you can also add other modules that you need):
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>0.20</version>
<version>0.21</version>
</dependency>
```

And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.2.0</kotlin.version>
<kotlin.version>1.2.10</kotlin.version>
</properties>
```

Expand All @@ -69,17 +81,21 @@ And make sure that you use the latest Kotlin version:
Add dependencies (you can also add other modules that you need):

```groovy
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.20'
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.21'
```

And make sure that you use the latest Kotlin version:

```groovy
buildscript {
ext.kotlin_version = '1.2.0'
ext.kotlin_version = '1.2.10'
}
```

### Kotlin/JS

Use `kotlinx-coroutines-core-js` artifact in your dependencies.

### ProGuard

In obfuscated code, fields with different types can have the same names,
Expand Down
206 changes: 87 additions & 119 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,67 @@ allprojects {

buildscript {
if (System.properties['kotlinSnapshot'] != null) {
ext.kotlin_version = '1.1-SNAPSHOT'
ext.kotlin_version = '1.2-SNAPSHOT'
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
repositories {
jcenter()
maven { url "http://kotlin.bintray.com/kotlinx" }
maven { url "http://kotlin.bintray.com/kotlin-dev" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFU_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version"
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
}
}

// --------------- pom configuration ---------------
// --------------- Configure sub-projects with Kotlin sources ---------------

def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers {
developer {
id "JetBrains"
name "JetBrains Team"
organization "JetBrains"
organizationUrl "http://www.jetbrains.com"
}
}
def sourceless = ['site']

scm {
url "https://github.com/Kotlin/kotlinx.coroutines"
}
static def platformOf(project) {
if (project.name.endsWith("-common")) return "common"
if (project.name.endsWith("-js")) return "js"
return "jvm"
}

// --------------- Configure sub-projects with Kotlin sources ---------------

def sourceless = ['site']
static def platformLib(base, platform) {
if (platform == "jvm") return base
return "$base-$platform"
}

configure(subprojects.findAll { !sourceless.contains(it.name) }) {
apply plugin: 'kotlin'
def platform = platformOf(it)
apply plugin: "kotlin-platform-$platform"

sourceCompatibility = 1.6
targetCompatibility = 1.6

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
if (platform == "jvm") {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}

kotlin.experimental.coroutines "enable"

if (platform == "js") {
tasks.withType(compileKotlin2Js.getClass()) {
kotlinOptions {
moduleKind = "umd"
sourceMap = true
metaInfo = true
}
}
}

tasks.withType(Test) {
testLogging.showStandardStreams = true
testLogging {
showStandardStreams = true
events "passed", "failed"
}
def stressTest = project.properties['stressTest']
if (stressTest != null) systemProperties['stressTest'] = stressTest
}
Expand All @@ -75,17 +77,34 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) {
maven { url "https://dl.bintray.com/devexperts/Maven/" }
}

def kotlin_stdlib = platformLib("kotlin-stdlib", platform)
def kotlin_test = platformLib("kotlin-test", platform)

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile "junit:junit:$junit_version"
compile "org.jetbrains.kotlin:$kotlin_stdlib:$kotlin_version"
testCompile "org.jetbrains.kotlin:$kotlin_test:$kotlin_version"
}

if (platform == "common") {
dependencies {
testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
}
}

if (platform == "jvm") {
dependencies {
testCompile "junit:junit:$junit_version"
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
}
}

// --------------- Configure sub-projects that are part of the library ---------------

def internal = sourceless + ['benchmarks', 'knit']
def internal = sourceless + ['benchmarks', 'knit', 'js-stub']

configure(subprojects.findAll { !internal.contains(it.name) }) {
// configure atomicfu for JVM modules
configure(subprojects.findAll { !internal.contains(it.name) && platformOf(it) == "jvm" }) {
apply plugin: 'kotlinx-atomicfu'

dependencies {
Expand All @@ -110,104 +129,53 @@ configure(subprojects.findAll { !internal.contains(it.name) }) {
}
}

configure(subprojects.findAll { !internal.contains(it.name) && it.name != 'kotlinx-coroutines-core'}) {
dependencies {
compile project(':kotlinx-coroutines-core')
//the only way IDEA can resolve test classes
testCompile project(':kotlinx-coroutines-core').sourceSets.test.output
// configure dependencies on core
configure(subprojects.findAll { !internal.contains(it.name) && it.name != 'kotlinx-coroutines-core-common'}) {
def platform = platformOf(it)
def coroutines_core = platformLib("kotlinx-coroutines-core", platform)

if (it.name == coroutines_core) {
dependencies {
expectedBy project(':kotlinx-coroutines-core-common')
}
} else {
dependencies {
compile project(":$coroutines_core")
//the only way IDEA can resolve test classes
testCompile project(":$coroutines_core").sourceSets.test.output
}
}
}

// --------------- Configure sub-projects that are published ---------------

def unpublished = internal + 'kotlinx-coroutines-rx-example'
def unpublished = internal + ['kotlinx-coroutines-rx-example', 'example-frontend-js']

def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/"
def core_docs_file = "$projectDir/core/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list"

configure(subprojects.findAll { !unpublished.contains(it.name) }) {
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'com.jfrog.bintray'

dokka {
outputFormat = 'kotlin-website'
}

task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}

tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) {
jdkVersion = 8
includes = ['README.md']
linkMapping {
def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
dir = "$projectDir/src/main/kotlin"
url = "http://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src/main/kotlin"
suffix = "#L"
}
}

task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier = 'javadoc'
from "$buildDir/javadoc"
}
apply from: rootProject.file('gradle/dokka.gradle')
apply from: rootProject.file('gradle/publish-bintray.gradle')
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
configure(subprojects.findAll { !unpublished.contains(it.name) }) {
def platform = platformOf(it)
def coroutines_core = platformLib("kotlinx-coroutines-core", platform)

publishing {
publications {
maven(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar
pom.withXml {
def root = asNode()
root.appendNode('name', project.name)
root.appendNode('description', 'Coroutines support libraries for Kotlin')
root.appendNode('url', 'https://github.com/Kotlin/kotlinx.coroutines')
root.children().last() + pomConfig
}
}
}
}
if (it.name != coroutines_core) {
dokka.dependsOn project(":$coroutines_core").dokka

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['maven']
pkg {
userOrg = 'kotlin'
repo = 'kotlinx'
name = 'kotlinx.coroutines'
version {
name = project.version
vcsTag = project.version
released = new Date()
tasks.withType(dokka.getClass()) {
externalDocumentationLink {
url = new URL(core_docs_url)
packageListUrl = new URL("file://$core_docs_file")
}
}
}

bintrayUpload.doLast {
println("Uploaded $project.name version $project.version")
}
}

configure(subprojects.findAll { !unpublished.contains(it.name) && it.name != 'kotlinx-coroutines-core' }) {
dokka.dependsOn project(':kotlinx-coroutines-core').dokka
dokkaJavadoc.dependsOn project(':kotlinx-coroutines-core').dokka

tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) {
externalDocumentationLink {
url = new URL(core_docs_url)
packageListUrl = new URL("file://$core_docs_file")
}

if (platform == "jvm") {
dokkaJavadoc.dependsOn project(":$coroutines_core").dokka
}
}

Expand Down
Loading

0 comments on commit ca83391

Please sign in to comment.