Extract kotlin.coroutines.experimental API into compat artifact

Add public API dump for kotlin-coroutines-experimental-compat

#KT-36083
This commit is contained in:
Ilya Gorbunov
2020-01-18 04:54:46 +03:00
parent 075eea5a96
commit b5a0daabc3
15 changed files with 268 additions and 149 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ sourceSets {
}
coroutinesExperimental {
kotlin {
srcDir '../coroutines-experimental/src'
// srcDir '../coroutines-experimental/src'
}
}
}
@@ -0,0 +1,94 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
id("jps-compatible")
}
publish()
description = "Kotlin pre 1.3 experimental coroutines compatibility library"
jvmTarget = "1.6"
javaHome = rootProject.extra["JDK_16"] as String
sourceSets {
"main" {
java.srcDirs("src", "jvm/src")
}
"test" {
java.srcDirs("jvm/test")
}
"migrationTest" {
if(!kotlinBuildProperties.isInIdeaSync)
java.srcDirs("jvm/test")
}
}
val migrationTestSourceSet = sourceSets["migrationTest"]
configurations {
"migrationTestImplementation" {
extendsFrom(testImplementation.get())
}
}
dependencies {
api(kotlinStdlib())
testImplementation(project(":kotlin-test:kotlin-test-junit"))
"migrationTestImplementation"(sourceSets.main.get().output)
}
tasks {
val compileKotlin by existing(KotlinCompile::class) {
kotlinOptions {
languageVersion = "1.3"
apiVersion = "1.3"
freeCompilerArgs = listOf(
"-Xmulti-platform",
"-Xallow-kotlin-package",
"-Xmultifile-parts-inherit",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-Xuse-experimental=kotlin.Experimental",
"-Xcoroutines=enable",
"-XXLanguage:-ReleaseCoroutines",
"-Xno-use-ir",
"-module-name", "kotlin-coroutines-experimental-compat"
)
}
}
val compileTestKotlin by existing(KotlinCompile::class) {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
freeCompilerArgs = listOf("-Xcoroutines=enable")
}
}
val compileMigrationTestKotlin by existing(KotlinCompile::class) {
kotlinOptions {
languageVersion = "1.3"
apiVersion = "1.3"
freeCompilerArgs = listOf()
}
}
val migrationTestClasses by existing
val migrationTest by creating(Test::class) {
dependsOn(migrationTestClasses)
group = "verification"
testClassesDirs = migrationTestSourceSet.output.classesDirs
classpath = migrationTestSourceSet.runtimeClasspath
}
val check by existing {
dependsOn(migrationTest)
}
val jar by existing(Jar::class) {
callGroovy("manifestAttributes", manifest, project, "Main")
}
}
sourcesJar()
javadocJar()
@@ -0,0 +1,15 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package test
import kotlin.test.*
inline fun <reified T> assertStaticAndRuntimeTypeIs(value: T) {
@Suppress("USELESS_CAST")
if ((value as Any?) !is T) {
fail("Expected value $value to have ${T::class} type")
}
}
+1
View File
@@ -46,6 +46,7 @@ configurations {
dependencies {
compile project(':kotlin-stdlib')
testCompile project(':kotlin-test:kotlin-test-junit')
testCompile project(':kotlin-coroutines-experimental-compat')
}
jar {
+1
View File
@@ -16,6 +16,7 @@ dependencies {
compile project(':kotlin-stdlib')
compile project(':kotlin-stdlib-jdk7')
testCompile project(':kotlin-test:kotlin-test-junit')
testCompile project(':kotlin-coroutines-experimental-compat')
}
sourceSets {
+5 -5
View File
@@ -70,7 +70,7 @@ sourceSets {
coroutinesExperimental {
kotlin {
srcDir coroutinesExpJsSrcDir
// srcDir coroutinesExpJsSrcDir
}
}
}
@@ -206,8 +206,8 @@ task compileJs(type: NoDebugJavaExec) {
doFirst {
args = [jsOutputFile, rootDir, "$jsSrcDir/wrapper.js"] + inputFiles.collect { it.path }.sort() +
(compileBuiltinsKotlin2Js.outputs.files.collect { it.path }.sort() +
compileKotlin2Js.outputs.files.collect { it.path }.sort() +
compileCoroutinesExperimentalKotlin2Js.outputs.files.collect { it.path }.sort()).findAll {
compileKotlin2Js.outputs.files.collect { it.path }.sort() /*+
compileCoroutinesExperimentalKotlin2Js.outputs.files.collect { it.path }.sort()*/).findAll {
it.endsWith(".js") && !it.endsWith(".meta.js")
}
}
@@ -253,8 +253,8 @@ task compileJs(type: NoDebugJavaExec) {
sourceMapFile.text = groovy.json.JsonOutput.toJson(sourceMap)
file(jsOutputMetaFile).text = file(compileKotlin2Js.outputFile.path.replaceAll('\\.js$', '.meta.js')).text +
file(compileCoroutinesExperimentalKotlin2Js.outputFile.path.replaceAll('\\.js$', '.meta.js')).text
file(jsOutputMetaFile).text = file(compileKotlin2Js.outputFile.path.replaceAll('\\.js$', '.meta.js')).text /*+
file(compileCoroutinesExperimentalKotlin2Js.outputFile.path.replaceAll('\\.js$', '.meta.js')).text*/
}
}
+4 -3
View File
@@ -26,18 +26,18 @@ sourceSets {
}
coroutinesExperimental {
kotlin {
srcDir '../coroutines-experimental/jvm/src'
// srcDir '../coroutines-experimental/jvm/src'
}
}
coroutinesExperimentalTest {
kotlin {
srcDir '../coroutines-experimental/jvm/test'
// srcDir '../coroutines-experimental/jvm/test'
}
}
coroutinesExperimentalMigrationTest {
kotlin {
if(!BuildPropertiesKt.getKotlinBuildProperties(project).inIdeaSync) {
srcDir '../coroutines-experimental/jvm/test'
// srcDir '../coroutines-experimental/jvm/test'
}
}
}
@@ -77,6 +77,7 @@ dependencies {
testCompile project(':kotlin-test:kotlin-test-junit')
testCompile sourceSets.coroutinesExperimental.output
testCompile project(':kotlin-coroutines-experimental-compat')
coroutinesExperimentalCompile sourceSets.main.output
coroutinesExperimentalTestCompile sourceSets.test.output
@@ -1,15 +1,12 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("ObsoleteExperimentalCoroutines")
package test.coroutines
import java.util.concurrent.Semaphore
import kotlin.coroutines.*
import kotlin.coroutines.experimental.startCoroutine
import kotlin.test.*
/**