Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Commit e0c9c24

Browse files
authored
Merge pull request #855 from gradle/eskatos/plugins/kotlin-dsl-testImplementation
Let the `kotlin-dsl` plugin add gradleKotlinDSl() to testImplementation
2 parents 5d506e9 + ff6318f commit e0c9c24

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

plugins/src/main/kotlin/org/gradle/kotlin/dsl/plugins/dsl/KotlinDslPlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import org.gradle.kotlin.dsl.plugins.embedded.EmbeddedKotlinPlugin
2626
* The `kotlin-dsl` plugin.
2727
*
2828
* - Applies the `embedded-kotlin` plugin
29-
* - Adds the `gradleKotlinDsl()` dependency to the `compileOnly` and `testRuntimeOnly` configurations
29+
* - Adds the `gradleKotlinDsl()` dependency to the `compileOnly` and `testImplementation` configurations
3030
* - Configures the Kotlin DSL compiler plugins
3131
*
3232
* @see org.gradle.kotlin.dsl.plugins.embedded.EmbeddedKotlinPlugin
@@ -38,7 +38,7 @@ open class KotlinDslPlugin : Plugin<Project> {
3838

3939
applyEmbeddedKotlinPlugin()
4040
applyKotlinDslCompilerPlugins()
41-
addGradleKotlinDslDependencyTo("compileOnly", "testRuntimeOnly")
41+
addGradleKotlinDslDependencyTo("compileOnly", "testImplementation")
4242
}
4343
}
4444

plugins/src/test/kotlin/org/gradle/kotlin/dsl/plugins/dsl/KotlinDslPluginTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class KotlinDslPluginTest : AbstractPluginTest() {
4444
}
4545

4646
@Test
47-
fun `gradle kotlin dsl api is available at test runtime`() {
47+
fun `gradle kotlin dsl api is available for test implementation`() {
4848
withBuildScript("""
4949
5050
plugins {
@@ -81,16 +81,17 @@ class KotlinDslPluginTest : AbstractPluginTest() {
8181
8282
import org.gradle.testfixtures.ProjectBuilder
8383
import org.junit.Test
84+
import org.gradle.kotlin.dsl.*
8485
8586
class MyTest {
8687
8788
@Test
8889
fun `my test`() {
89-
val project = ProjectBuilder.builder().build()
90-
project.plugins.apply(MyPlugin::class.java)
90+
ProjectBuilder.builder().build().run {
91+
apply<MyPlugin>()
92+
}
9193
}
9294
}
93-
9495
""")
9596

9697
assertThat(

0 commit comments

Comments
 (0)