Skip to content

Advance Kotlin version to 1.9.21 #163

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 8 commits into from
Dec 7, 2023
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
4 changes: 2 additions & 2 deletions examples/kotlin-kts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import org.jetbrains.kotlin.gradle.tasks.*
plugins {
java
kotlin("jvm")
kotlin("plugin.allopen") version "1.9.0"
kotlin("plugin.allopen") version "1.9.21"
id("org.jetbrains.kotlinx.benchmark")
}

sourceSets.all {
sourceSets.configureEach {
java.setSrcDirs(listOf("$name/src"))
resources.setSrcDirs(listOf("$name/resources"))
}
Expand Down
4 changes: 2 additions & 2 deletions examples/kotlin-multiplatform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import kotlinx.benchmark.gradle.JsBenchmarksExecutor

plugins {
id 'org.jetbrains.kotlin.multiplatform'
id 'org.jetbrains.kotlin.plugin.allopen' version "1.9.0"
id 'org.jetbrains.kotlin.plugin.allopen' version "1.9.21"
id 'org.jetbrains.kotlinx.benchmark'
}

Expand All @@ -28,7 +28,7 @@ kotlin {
if (HostManager.hostIsLinux) linuxX64('native')
if (HostManager.hostIsMingw) mingwX64('native')

sourceSets.all {
sourceSets.configureEach {
languageSettings {
progressiveMode = true
}
Expand Down
4 changes: 2 additions & 2 deletions examples/kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.allopen' version "1.9.0"
id 'org.jetbrains.kotlin.plugin.allopen' version "1.9.21"
id 'org.jetbrains.kotlinx.benchmark'
}

Expand All @@ -16,7 +16,7 @@ sourceSets {
benchmarks
}

sourceSets.all {
sourceSets.configureEach {
kotlin.srcDirs = ["$it.name/src"]
java.srcDirs = ["$it.name/src"]
resources.srcDirs = ["$it.name/resources"]
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group=org.jetbrains.kotlinx
version=0.5.0-SNAPSHOT

kotlin_version=1.9.0
kotlin_version=1.9.21
jmhVersion=1.21
infra_version=0.3.0-dev-74
kotlin.code.style=official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class BenchmarkConfiguration {
var mode: String? = null
var outputTimeUnit: String? = null
var reportFormat: String? = null
var includes: MutableList<String> = mutableListOf()
var excludes: MutableList<String> = mutableListOf()
var params: MutableMap<String, MutableList<Any>> = mutableMapOf()
var advanced: MutableMap<String, Any> = mutableMapOf()
private var includes: MutableList<String> = mutableListOf()
private var excludes: MutableList<String> = mutableListOf()
private var params: MutableMap<String, MutableList<Any>> = mutableMapOf()
private var advanced: MutableMap<String, Any> = mutableMapOf()

fun include(pattern: String) {
includes.add(pattern)
Expand Down Expand Up @@ -41,7 +41,7 @@ class BenchmarkConfiguration {
reportFormat = ${reportFormat?.escape()}
includes = ${includes.map { it.escape() }}
excludes = ${excludes.map { it.escape() }}
${params.entries.joinToString(separator = "\n") { """param("${it.key}", ${it?.value?.joinToString()})""" }}
${params.entries.joinToString(separator = "\n") { """param("${it.key}", ${it.value.joinToString()})""" }}
${advanced.entries.joinToString(separator = "\n") {
"""advanced("${it.key}", ${if (it.value is String) "\"${it.value}\"" else it.value})"""
}}
Expand Down
2 changes: 1 addition & 1 deletion plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group=org.jetbrains.kotlinx
version=0.5.0-SNAPSHOT

kotlin_version=1.9.0
kotlin_version=1.9.21
jmhVersion=1.21
infra_version=0.3.0-dev-74

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ open class BenchmarksExtension(val project: Project) {
val target = multiplatform.targets.findByName(name)
// We allow the name to be either a target or a source set
when (val compilation = target?.compilations?.findByName(KotlinCompilation.MAIN_COMPILATION_NAME)
?: multiplatform.targets.flatMap { it.compilations }.find { it.defaultSourceSetName == name }) {
?: multiplatform.targets.flatMap { it.compilations }.find { it.defaultSourceSet.name == name }) {
null -> {
project.logger.warn("Warning: Cannot find a benchmark compilation '$name', ignoring.")
BenchmarkTarget(this, name) // ignore
Expand Down
4 changes: 2 additions & 2 deletions plugin/main/src/kotlinx/benchmark/gradle/BenchmarksPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class BenchmarksPlugin : Plugin<Project> {

plugins.withType(org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin::class.java) { kotlinPlugin ->
logger.info("Detected Kotlin plugin version '${kotlinPlugin.pluginVersion}'")
if (!getKotlinVersion(kotlinPlugin.pluginVersion).isAtLeast(1, 9, 0)) {
logger.error("JetBrains Gradle Benchmarks plugin requires Kotlin version 1.9.0 or higher")
if (!getKotlinVersion(kotlinPlugin.pluginVersion).isAtLeast(1, 9, 20)) {
logger.error("JetBrains Gradle Benchmarks plugin requires Kotlin version 1.9.20 or higher")
}
}

Expand Down
22 changes: 12 additions & 10 deletions plugin/main/src/kotlinx/benchmark/gradle/JsMultiplatformTasks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@ private fun Project.createJsBenchmarkCompileTask(target: JsBenchmarkTarget): Kot
)
}

compileKotlinTask.apply {
group = BenchmarksPlugin.BENCHMARKS_TASK_GROUP
description = "Compile JS benchmark source files for '${target.name}'"
compileTaskProvider.configure {
it.apply {
group = BenchmarksPlugin.BENCHMARKS_TASK_GROUP
description = "Compile JS benchmark source files for '${target.name}'"

//TODO: fix destination dir after KT-29711 is fixed
//println("JS: ${kotlinOptions.outputFile}")
//destinationDir = file("$benchmarkBuildDir/classes")
dependsOn("${target.name}${BenchmarksPlugin.BENCHMARK_GENERATE_SUFFIX}")
//TODO: fix destination dir after KT-29711 is fixed
//println("JS: ${kotlinOptions.outputFile}")
//destinationDir = file("$benchmarkBuildDir/classes")
dependsOn("${target.name}${BenchmarksPlugin.BENCHMARK_GENERATE_SUFFIX}")

kotlinOptions.apply {
sourceMap = true
moduleKind = "umd"
kotlinOptions.apply {
sourceMap = true
moduleKind = "umd"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private fun Project.createNativeBenchmarkCompileTask(target: NativeBenchmarkTarg
// a link task. So we disable execution the klib compiling task to save time.
// benchmarkCompilation.compileKotlinTask.enabled = false

benchmarkCompilation.compileKotlinTask.dependsOn(generateSourceTaskName(target))
benchmarkCompilation.compileTaskProvider.configure { it.dependsOn(generateSourceTaskName(target)) }

benchmarkCompilation.apply {
val sourceSet = kotlinSourceSets.single()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ private fun Project.createWasmBenchmarkCompileTask(target: WasmBenchmarkTarget):
)
}
}
compileKotlinTask.apply {
group = BenchmarksPlugin.BENCHMARKS_TASK_GROUP
description = "Compile Wasm benchmark source files for '${target.name}'"
dependsOn("${target.name}${BenchmarksPlugin.BENCHMARK_GENERATE_SUFFIX}")
compileTaskProvider.configure {
it.apply {
group = BenchmarksPlugin.BENCHMARKS_TASK_GROUP
description = "Compile Wasm benchmark source files for '${target.name}'"
dependsOn("${target.name}${BenchmarksPlugin.BENCHMARK_GENERATE_SUFFIX}")
}
}
}
return benchmarkCompilation
Expand Down
8 changes: 7 additions & 1 deletion runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ kotlin {
js("jsIr", IR) { nodejs() }
wasm("wasmJs") { d8() }

sourceSets.all {
targets.configureEach {
compilations.configureEach {
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
}
}

sourceSets.configureEach {
kotlin.srcDirs = ["$it.name/src"]
resources.srcDirs = ["$it.name/resources"]
languageSettings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ actual enum class Scope {
Benchmark
}

@Target(AnnotationTarget.CLASS)
actual annotation class State(actual val value: Scope)

@Target(AnnotationTarget.FUNCTION)
actual annotation class Setup

@Target(AnnotationTarget.FUNCTION)
actual annotation class TearDown

@Target(AnnotationTarget.FUNCTION)
actual annotation class Benchmark


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ actual enum class Scope {
Benchmark
}

@Target(AnnotationTarget.CLASS)
actual annotation class State(actual val value: Scope)

@Target(AnnotationTarget.FUNCTION)
actual annotation class Setup

@Target(AnnotationTarget.FUNCTION)
actual annotation class TearDown

@Target(AnnotationTarget.FUNCTION)
actual annotation class Benchmark


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ actual enum class Scope {
Benchmark
}

@Target(AnnotationTarget.CLASS)
actual annotation class State(actual val value: Scope)

@Target(AnnotationTarget.FUNCTION)
actual annotation class Setup

@Target(AnnotationTarget.FUNCTION)
actual annotation class TearDown

@Target(AnnotationTarget.FUNCTION)
actual annotation class Benchmark


Expand Down