Skip to content

Commit 0c992ac

Browse files
Abduqodiri Qurbonzodaqurbonzoda
authored andcommitted
[Plugin] Fix "Adding a Configuration as a dependency is not allowed" #99
1 parent 6182c04 commit 0c992ac

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

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

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

3232
benchmarkCompilation.apply {
3333
val sourceSet = kotlinSourceSets.single()
34+
3435
sourceSet.kotlin.setSrcDirs(files("$benchmarkBuildDir/sources"))
3536
sourceSet.resources.setSrcDirs(files())
37+
3638
sourceSet.dependencies {
37-
implementation(compilation.compileDependencyFiles)
3839
implementation(compilation.output.allOutputs)
3940
implementation(npm("benchmark", "*"))
4041
runtimeOnly(npm("source-map-support", "*"))
4142
}
43+
project.configurations.let {
44+
it.getByName(sourceSet.implementationConfigurationName).extendsFrom(
45+
it.getByName(compilation.compileDependencyConfigurationName)
46+
)
47+
}
48+
4249
compileKotlinTask.apply {
4350
group = BenchmarksPlugin.BENCHMARKS_TASK_GROUP
4451
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 {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@ private fun Project.createWasmBenchmarkCompileTask(target: WasmBenchmarkTarget):
3232
with(kotlinSourceSets.single()) {
3333
kotlin.setSrcDirs(files("$benchmarkBuildDir/sources"))
3434
resources.setSrcDirs(files())
35+
3536
dependencies {
36-
implementation(compilation.compileDependencyFiles)
3737
implementation(compilation.output.allOutputs)
3838
}
39+
project.configurations.let {
40+
it.getByName(this.implementationConfigurationName).extendsFrom(
41+
it.getByName(compilation.compileDependencyConfigurationName)
42+
)
43+
}
3944
}
4045
compileKotlinTask.apply {
4146
group = BenchmarksPlugin.BENCHMARKS_TASK_GROUP

0 commit comments

Comments
 (0)