Skip to content
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

Pt. 2: Bump coroutines to 1.6.1 #723

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Migrate jmh to kotlinx.benchmark
  • Loading branch information
bnvinay92 committed Apr 25, 2022
commit 886e4d89b1a9a48c0e213bbc1aa47fecbb0788bb
2 changes: 1 addition & 1 deletion .github/workflows/kotlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs :
gradle-dependencies-cache-key : |
gradle/libs.versions.toml
arguments : |
test apiCheck artifactsCheck lint ktlintCheck jmhJar --no-daemon --stacktrace --continue
test apiCheck artifactsCheck lint ktlintCheck jvmWorkflowNodeBenchmarkJar --no-daemon --stacktrace --continue
concurrent : true
gradle-build-scan-report : false
gradle-distribution-sha-256-sum-warning : false
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
buildscript {
dependencies {
classpath(libs.android.gradle.plugin)
classpath(libs.jmh.gradle.plugin)
classpath(libs.dokka.gradle.plugin)
classpath(libs.kotlin.serialization.gradle.plugin)
classpath(libs.kotlinx.binaryCompatibility.gradle.plugin)
classpath(libs.kotlinx.benchmark.gradle.plugin)
classpath(libs.kotlin.gradle.plugin)
classpath(libs.google.ksp)
classpath(libs.ktlint.gradle)
Expand Down
9 changes: 4 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ kotlin = "1.6.10"
kotlinx-binary-compatibility = "0.6.0"
kotlinx-coroutines = "1.5.1"
kotlinx-serialization-json = "1.3.2"
kotlinx-benchmark = "0.4.2"

ktlint = "10.2.1"
material = "1.3.0"
Expand Down Expand Up @@ -87,6 +88,7 @@ google-ksp = { id = "com.google.devtools.ksp", version.ref = "google-ksp"}

kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlinx-apiBinaryCompatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinx-binary-compatibility" }
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-publish" }

Expand Down Expand Up @@ -154,11 +156,6 @@ hamcrest = "org.hamcrest:hamcrest-core:2.2"

jetbrains-annotations = "org.jetbrains:annotations:19.0.0"

jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" }
jmh-generator = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" }

jmh-gradle-plugin = "me.champeau.gradle:jmh-gradle-plugin:0.5.3"

junit = { module = "junit:junit", version.ref = "jUnit" }

kotlin-common = { module = "org.jetbrains.kotlin:kotlin-stdlib-common", version.ref = "kotlin" }
Expand All @@ -178,6 +175,8 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c
kotlinx-coroutines-rx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" }
kotlinx-benchmark-gradle-plugin = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-plugin", version.ref = "kotlinx-benchmark" }
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" }

ktlint-gradle = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint" }

Expand Down
55 changes: 30 additions & 25 deletions workflow-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import kotlinx.benchmark.gradle.JvmBenchmarkTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("multiplatform")
id("org.jetbrains.dokka")
// Benchmark plugins.
// id("me.champeau.gradle.jmh")
// // If this plugin is not applied, IntelliJ won't see the JMH definitions for some reason.
// idea
id("org.jetbrains.kotlinx.benchmark")
}

java {
Expand All @@ -15,7 +15,24 @@ java {
apply(from = rootProject.file(".buildscript/configure-maven-publish.gradle"))

kotlin {
jvm { withJava() }
jvm {
compilations {
val main by getting
val workflowNode by creating {
kotlinOptions {
val compileKotlinJvm: KotlinCompile by tasks
freeCompilerArgs += "-Xfriend-paths=${compileKotlinJvm.destinationDir}"
}
defaultSourceSet {
dependencies {
implementation(main.compileDependencyFiles + main.output.classesDirs)
implementation(libs.kotlinx.benchmark.runtime)
}
}
}
}
withJava()
}

sourceSets {
val jvmMain by getting {
Expand All @@ -37,23 +54,11 @@ kotlin {
}
}

// // Benchmark configuration.
// configure<JMHPluginExtension> {
// include = listOf(".*")
// duplicateClassesStrategy = DuplicatesStrategy.WARN
// }
// configurations.named("jmh") {
// attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
// }
// tasks.named<KotlinCompile>("compileJmhKotlin") {
// kotlinOptions {
// // Give the benchmark code access to internal definitions.
// val compileKotlin: KotlinCompile by tasks
// freeCompilerArgs += "-Xfriend-paths=${compileKotlin.destinationDir}"
// }
// }

// // These dependencies will be available on the classpath for source inside src/jmh.
// "jmh"(libs.kotlin.jdk6)
// "jmh"(libs.jmh.core)
// "jmh"(libs.jmh.generator)
benchmark {
targets {
register("jvmWorkflowNode") {
this as JvmBenchmarkTarget
jmhVersion = libs.versions.jmh.get()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import java.util.concurrent.TimeUnit.SECONDS
@Warmup(iterations = 3, time = 5, timeUnit = SECONDS)
@Measurement(iterations = 3, time = 5, timeUnit = SECONDS)
@OutputTimeUnit(MICROSECONDS)
open class WorkflowNodeBenchmark {
internal open class WorkflowNodeBenchmark {

/**
* Used to parameterize the benchmarks.
Expand Down