Skip to content

Kts transition #1951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 0 additions & 79 deletions benchmarks/build.gradle

This file was deleted.

85 changes: 85 additions & 0 deletions benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("net.ltgt.apt")
id("com.github.johnrengelman.shadow")
id("me.champeau.gradle.jmh")
}

repositories {
maven("https://repo.typesafe.com/typesafe/releases/")
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
}

tasks.compileJmhKotlin {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=enable"
}

/*
* Due to a bug in the inliner it sometimes does not remove inlined symbols (that are later renamed) from unused code paths,
* and it breaks JMH that tries to post-process these symbols and fails because they are renamed.
*/
val removeRedundantFiles = tasks.register<Delete>("removeRedundantFiles") {
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble//SaneFlowPlaysScrabble\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")

// Primes
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$1.class")
}

tasks.jmhRunBytecodeGenerator {
dependsOn(removeRedundantFiles)
}

// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
jmh {
jmhVersion = "1.21"
duplicateClassesStrategy = DuplicatesStrategy.INCLUDE
failOnError = true
resultFormat = "CSV"
project.findProperty("jmh")?.also {
include = listOf(".*$it.*")
}
// includeTests = false
}

tasks.jmhJar {
baseName = "benchmarks"
classifier = null
version = null
destinationDir = file("$rootDir")
}

dependencies {
compile("org.openjdk.jmh:jmh-core:1.21")
compile("io.projectreactor:reactor-core:${property("reactor_vesion")}")
compile("io.reactivex.rxjava2:rxjava:2.1.9")
compile("com.github.akarnokd:rxjava2-extensions:0.20.8")

compile("org.openjdk.jmh:jmh-core:1.21")
compile("com.typesafe.akka:akka-actor_2.12:2.5.0")
compile(project(":kotlinx-coroutines-core"))

// add jmh dependency on main
jmhImplementation(sourceSets.main.get().runtimeClasspath)
}
42 changes: 42 additions & 0 deletions buildSrc/src/main/kotlin/MavenCentral.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

@file:Suppress("UnstableApiUsage")

import org.gradle.api.Project
import org.gradle.api.provider.Property
import org.gradle.api.publish.maven.MavenPom

// --------------- pom configuration ---------------

fun MavenPom.configureMavenCentralMetadata(project: Project) {
name by project.name
description by "Coroutines support libraries for Kotlin"
url by "https://github.com/Kotlin/kotlinx.coroutines"

licenses {
license {
name by "The Apache Software License, Version 2.0"
url by "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution by "repo"
}
}

developers {
developer {
id by "JetBrains"
name by "JetBrains Team"
organization by "JetBrains"
organizationUrl by "https://www.jetbrains.com"
}
}

scm {
url by "https://github.com/Kotlin/kotlinx.coroutines"
}
}

private infix fun <T> Property<T>.by(value: T) {
set(value)
}
37 changes: 0 additions & 37 deletions gradle/maven-central.gradle

This file was deleted.

4 changes: 1 addition & 3 deletions gradle/publish-bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
apply plugin: 'maven'
apply plugin: 'maven-publish'

apply from: project.rootProject.file('gradle/maven-central.gradle')

// ------------- tasks

def isMultiplatform = project.name == "kotlinx-coroutines-core"
Expand Down Expand Up @@ -64,7 +62,7 @@ publishing {
}

publications.all {
pom.withXml(configureMavenCentralMetadata)
MavenCentralKt.configureMavenCentralMetadata(pom, project)

// add empty javadocs (no need for MPP root publication which publishes only pom file)
if (it.name != 'kotlinMultiplatform' && !isBom) {
Expand Down
4 changes: 3 additions & 1 deletion stdlib-stubs/build.gradle → js/js-stub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

compileKotlin {
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

tasks.named<KotlinCompile>("compileKotlin") {
kotlinOptions {
freeCompilerArgs += "-Xallow-kotlin-package"
}
Expand Down
3 changes: 0 additions & 3 deletions kotlinx-coroutines-test/build.gradle

This file was deleted.

3 changes: 3 additions & 0 deletions kotlinx-coroutines-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies {
implementation(project(":kotlinx-coroutines-debug"))
}
34 changes: 0 additions & 34 deletions reactive/kotlinx-coroutines-reactive/build.gradle

This file was deleted.

43 changes: 43 additions & 0 deletions reactive/kotlinx-coroutines-reactive/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
import org.jetbrains.dokka.gradle.DokkaTask
import java.net.URL

val reactiveStreamsVersion = property("reactive_streams_version")

dependencies {
compile("org.reactivestreams:reactive-streams:$reactiveStreamsVersion")
testCompile("org.reactivestreams:reactive-streams-tck:$reactiveStreamsVersion")
}

tasks {
val testNG = register<Test>("testNG") {
useTestNG()
reports.html.destination = file("$buildDir/reports/testng")
include("**/*ReactiveStreamTckTest.*")
// Skip testNG when tests are filtered with --tests, otherwise it simply fails
onlyIf {
filter.includePatterns.isEmpty()
}
doFirst {
// Classic gradle, nothing works without doFirst
println("TestNG tests: ($includes)")
}
}

named<Test>("test") {
reports.html.destination = file("$buildDir/reports/junit")

dependsOn(testNG)
}

withType<DokkaTask>().configureEach {
externalDocumentationLink(delegateClosureOf<ExternalDocumentationLink.Builder> {
url = URL("https://www.reactive-streams.org/reactive-streams-$reactiveStreamsVersion-javadoc/")
packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL()
})
}
}
Loading