Skip to content

Commit 5364821

Browse files
author
Abduqodiri Qurbonzoda
committed
[Plugin] Make benchmark compilation name unique for each target
Kotlin plugin produces IR and WASM executables in build/compileSync/compilationName directory. Thus, if benchmark compilation name of two targets are equal, in parallel execution of tasks they overwrite each other, leading to Gradle task configuration error: Task ':examples:kotlin-multiplatform:jsIrBuiltInBenchmarkBenchmarkProductionExecutableCompileSync' uses this output of task ':examples:kotlin-multiplatform:compileBenchmarkProductionExecutableKotlinWasm' without declaring an explicit or implicit dependency.
1 parent e94fdee commit 5364821

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

plugin/main/src/kotlinx/benchmark/gradle/BenchmarksPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BenchmarksPlugin : Plugin<Project> {
1616
const val BENCHMARK_COMPILE_SUFFIX = "BenchmarkCompile"
1717
const val BENCHMARK_JAR_SUFFIX = "BenchmarkJar"
1818
const val BENCHMARK_EXEC_SUFFIX = "Benchmark"
19-
const val BENCHMARK_COMPILATION_NAME = "benchmark"
19+
const val BENCHMARK_COMPILATION_SUFFIX = "Benchmark"
2020

2121
const val JMH_CORE_DEPENDENCY = "org.openjdk.jmh:jmh-core"
2222
const val JMH_GENERATOR_DEPENDENCY = "org.openjdk.jmh:jmh-generator-bytecode:"

plugin/main/src/kotlinx/benchmark/gradle/JsMultiplatformTasks.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ private fun Project.createJsBenchmarkCompileTask(target: JsBenchmarkTarget): Kot
2222
val compilation = target.compilation
2323
val benchmarkBuildDir = benchmarkBuildDir(target)
2424
val benchmarkCompilation =
25-
compilation.target.compilations.create(BenchmarksPlugin.BENCHMARK_COMPILATION_NAME) as KotlinJsCompilation
25+
compilation.target.compilations.create(target.name + BenchmarksPlugin.BENCHMARK_COMPILATION_SUFFIX) as KotlinJsCompilation
2626

2727
(compilation.target as KotlinJsTargetDsl).apply {
2828
//force to create executable: required for IR, do nothing on Legacy

plugin/main/src/kotlinx/benchmark/gradle/NativeMultiplatformTasks.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private fun Project.createNativeBenchmarkCompileTask(target: NativeBenchmarkTarg
5555
val benchmarkBuildDir = benchmarkBuildDir(target)
5656
val compilationTarget = compilation.target
5757
val benchmarkCompilation =
58-
compilationTarget.compilations.create(BenchmarksPlugin.BENCHMARK_COMPILATION_NAME) as KotlinNativeCompilation
58+
compilationTarget.compilations.create(target.name + BenchmarksPlugin.BENCHMARK_COMPILATION_SUFFIX) as KotlinNativeCompilation
5959

6060
// In the previous version of this method a compileTask was changed to build an executable instead of klib.
6161
// Currently it's impossible to change task output kind and an executable is always produced by

plugin/main/src/kotlinx/benchmark/gradle/WasmMultiplatformTasks.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private fun Project.createWasmBenchmarkCompileTask(target: WasmBenchmarkTarget):
2121
val compilation = target.compilation
2222
val benchmarkBuildDir = benchmarkBuildDir(target)
2323
val benchmarkCompilation =
24-
compilation.target.compilations.create(BenchmarksPlugin.BENCHMARK_COMPILATION_NAME) as KotlinJsIrCompilation
24+
compilation.target.compilations.create(target.name + BenchmarksPlugin.BENCHMARK_COMPILATION_SUFFIX) as KotlinJsIrCompilation
2525

2626
val kotlinTarget = compilation.target
2727
check(kotlinTarget is KotlinJsTargetDsl)

0 commit comments

Comments
 (0)