Skip to content

Commit 0f15812

Browse files
qwwdfsadturansky
andauthored
Kts transition (#1951)
* Kotlin DSL - 'android:example-app' (#1940) * 'android:example-app'. Gradle 5.6.1 - sync with root project * Kotlin DSL - 'android:example-app' * Kotlin DSL - 'android:animation-app' (#1941) * 'android:animation-app'. Gradle 5.6.1 - sync with root project * Kotlin DSL - 'android:animation-app' * Kotlin DSL - 'swing' (#1943) * Kotlin DSL - 'integration:jdk8' (#1944) * Kotlin DSL - 'test' (#1945) * Kotlin DSL - 'reactive:reactive' (#1946) * Kotlin DSL - 'android-unit-tests' * Use relative paths * Kotlin DSL - 'js-stub' (#1938) (#1959) * Kotlin DSL - 'android' (#1938) (#1956) * Kotlin DSL - 'stdlib-stubs' (#1938) (#1955) * Kotlin DSL - 'site' (#1938) (#1954) * Kotlin DSL - 'maven-central' (#1938) (#1953) * Kotlin DSL - 'benchmarks' (#1938) (#1952) Co-authored-by: Victor Turansky <[email protected]>
1 parent 8d6e464 commit 0f15812

36 files changed

+582
-477
lines changed

benchmarks/build.gradle

-79
This file was deleted.

benchmarks/build.gradle.kts

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
6+
7+
plugins {
8+
id("net.ltgt.apt")
9+
id("com.github.johnrengelman.shadow")
10+
id("me.champeau.gradle.jmh")
11+
}
12+
13+
repositories {
14+
maven("https://repo.typesafe.com/typesafe/releases/")
15+
}
16+
17+
tasks.withType<KotlinCompile>().configureEach {
18+
kotlinOptions.jvmTarget = "1.8"
19+
}
20+
21+
tasks.compileJmhKotlin {
22+
kotlinOptions.freeCompilerArgs += "-Xjvm-default=enable"
23+
}
24+
25+
/*
26+
* Due to a bug in the inliner it sometimes does not remove inlined symbols (that are later renamed) from unused code paths,
27+
* and it breaks JMH that tries to post-process these symbols and fails because they are renamed.
28+
*/
29+
val removeRedundantFiles = tasks.register<Delete>("removeRedundantFiles") {
30+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")
31+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$1.class")
32+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$1.class")
33+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$1.class")
34+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
35+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
36+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
37+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$1\$1.class")
38+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$2\$1.class")
39+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class")
40+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")
41+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class")
42+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble//SaneFlowPlaysScrabble\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")
43+
44+
// Primes
45+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$2\$1.class")
46+
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$1.class")
47+
}
48+
49+
tasks.jmhRunBytecodeGenerator {
50+
dependsOn(removeRedundantFiles)
51+
}
52+
53+
// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
54+
// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
55+
jmh {
56+
jmhVersion = "1.21"
57+
duplicateClassesStrategy = DuplicatesStrategy.INCLUDE
58+
failOnError = true
59+
resultFormat = "CSV"
60+
project.findProperty("jmh")?.also {
61+
include = listOf(".*$it.*")
62+
}
63+
// includeTests = false
64+
}
65+
66+
tasks.jmhJar {
67+
baseName = "benchmarks"
68+
classifier = null
69+
version = null
70+
destinationDir = file("$rootDir")
71+
}
72+
73+
dependencies {
74+
compile("org.openjdk.jmh:jmh-core:1.21")
75+
compile("io.projectreactor:reactor-core:${property("reactor_vesion")}")
76+
compile("io.reactivex.rxjava2:rxjava:2.1.9")
77+
compile("com.github.akarnokd:rxjava2-extensions:0.20.8")
78+
79+
compile("org.openjdk.jmh:jmh-core:1.21")
80+
compile("com.typesafe.akka:akka-actor_2.12:2.5.0")
81+
compile(project(":kotlinx-coroutines-core"))
82+
83+
// add jmh dependency on main
84+
jmhImplementation(sourceSets.main.get().runtimeClasspath)
85+
}
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
@file:Suppress("UnstableApiUsage")
6+
7+
import org.gradle.api.Project
8+
import org.gradle.api.provider.Property
9+
import org.gradle.api.publish.maven.MavenPom
10+
11+
// --------------- pom configuration ---------------
12+
13+
fun MavenPom.configureMavenCentralMetadata(project: Project) {
14+
name by project.name
15+
description by "Coroutines support libraries for Kotlin"
16+
url by "https://github.com/Kotlin/kotlinx.coroutines"
17+
18+
licenses {
19+
license {
20+
name by "The Apache Software License, Version 2.0"
21+
url by "https://www.apache.org/licenses/LICENSE-2.0.txt"
22+
distribution by "repo"
23+
}
24+
}
25+
26+
developers {
27+
developer {
28+
id by "JetBrains"
29+
name by "JetBrains Team"
30+
organization by "JetBrains"
31+
organizationUrl by "https://www.jetbrains.com"
32+
}
33+
}
34+
35+
scm {
36+
url by "https://github.com/Kotlin/kotlinx.coroutines"
37+
}
38+
}
39+
40+
private infix fun <T> Property<T>.by(value: T) {
41+
set(value)
42+
}

gradle/maven-central.gradle

-37
This file was deleted.

gradle/publish-bintray.gradle

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
apply plugin: 'maven'
88
apply plugin: 'maven-publish'
99

10-
apply from: project.rootProject.file('gradle/maven-central.gradle')
11-
1210
// ------------- tasks
1311

1412
def isMultiplatform = project.name == "kotlinx-coroutines-core"
@@ -64,7 +62,7 @@ publishing {
6462
}
6563

6664
publications.all {
67-
pom.withXml(configureMavenCentralMetadata)
65+
MavenCentralKt.configureMavenCentralMetadata(pom, project)
6866

6967
// add empty javadocs (no need for MPP root publication which publishes only pom file)
7068
if (it.name != 'kotlinMultiplatform' && !isBom) {

stdlib-stubs/build.gradle renamed to js/js-stub/build.gradle.kts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
compileKotlin {
5+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
6+
7+
tasks.named<KotlinCompile>("compileKotlin") {
68
kotlinOptions {
79
freeCompilerArgs += "-Xallow-kotlin-package"
810
}

kotlinx-coroutines-test/build.gradle

-3
This file was deleted.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies {
2+
implementation(project(":kotlinx-coroutines-debug"))
3+
}

reactive/kotlinx-coroutines-reactive/build.gradle

-34
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
6+
import org.jetbrains.dokka.gradle.DokkaTask
7+
import java.net.URL
8+
9+
val reactiveStreamsVersion = property("reactive_streams_version")
10+
11+
dependencies {
12+
compile("org.reactivestreams:reactive-streams:$reactiveStreamsVersion")
13+
testCompile("org.reactivestreams:reactive-streams-tck:$reactiveStreamsVersion")
14+
}
15+
16+
tasks {
17+
val testNG = register<Test>("testNG") {
18+
useTestNG()
19+
reports.html.destination = file("$buildDir/reports/testng")
20+
include("**/*ReactiveStreamTckTest.*")
21+
// Skip testNG when tests are filtered with --tests, otherwise it simply fails
22+
onlyIf {
23+
filter.includePatterns.isEmpty()
24+
}
25+
doFirst {
26+
// Classic gradle, nothing works without doFirst
27+
println("TestNG tests: ($includes)")
28+
}
29+
}
30+
31+
named<Test>("test") {
32+
reports.html.destination = file("$buildDir/reports/junit")
33+
34+
dependsOn(testNG)
35+
}
36+
37+
withType<DokkaTask>().configureEach {
38+
externalDocumentationLink(delegateClosureOf<ExternalDocumentationLink.Builder> {
39+
url = URL("https://www.reactive-streams.org/reactive-streams-$reactiveStreamsVersion-javadoc/")
40+
packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL()
41+
})
42+
}
43+
}

0 commit comments

Comments
 (0)