Skip to content

Commit 3784a7e

Browse files
author
Abduqodiri Qurbonzoda
committed
[Plugin] Fix "Adding a Configuration as a dependency is not allowed" #99
1 parent 2a11b0d commit 3784a7e

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,21 @@ private fun Project.createJsBenchmarkCompileTask(target: JsBenchmarkTarget): Kot
3030

3131
benchmarkCompilation.apply {
3232
val sourceSet = kotlinSourceSets.single()
33+
3334
sourceSet.kotlin.setSrcDirs(files("$benchmarkBuildDir/sources"))
3435
sourceSet.resources.setSrcDirs(files())
36+
3537
sourceSet.dependencies {
36-
implementation(compilation.compileDependencyFiles)
3738
implementation(compilation.output.allOutputs)
3839
implementation(npm("benchmark", "*"))
3940
runtimeOnly(npm("source-map-support", "*"))
4041
}
42+
project.configurations.let {
43+
it.getByName(sourceSet.implementationConfigurationName).extendsFrom(
44+
it.getByName(compilation.compileDependencyConfigurationName)
45+
)
46+
}
47+
4148
compileKotlinTask.apply {
4249
group = BenchmarksPlugin.BENCHMARKS_TASK_GROUP
4350
description = "Compile JS benchmark source files for '${target.name}'"

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,21 @@ private fun Project.createNativeBenchmarkCompileTask(target: NativeBenchmarkTarg
6666

6767
benchmarkCompilation.apply {
6868
val sourceSet = kotlinSourceSets.single()
69+
6970
sourceSet.resources.setSrcDirs(files())
70-
// TODO: check if there are other ways to set compiler options.
71-
this.kotlinOptions.freeCompilerArgs = compilation.kotlinOptions.freeCompilerArgs
7271
sourceSet.kotlin.setSrcDirs(files("$benchmarkBuildDir/sources"))
72+
7373
sourceSet.dependencies {
74-
implementation(compilation.compileDependencyFiles)
7574
implementation(compilation.output.allOutputs)
7675
}
76+
project.configurations.let {
77+
it.getByName(sourceSet.implementationConfigurationName).extendsFrom(
78+
it.getByName(compilation.compileDependencyConfigurationName)
79+
)
80+
}
81+
82+
// TODO: check if there are other ways to set compiler options.
83+
this.kotlinOptions.freeCompilerArgs = compilation.kotlinOptions.freeCompilerArgs
7784
}
7885

7986
compilationTarget.apply {

0 commit comments

Comments
 (0)