Skip to content

Commit

Permalink
Add PluginDependenciesSpec.embeddedKotlin function
Browse files Browse the repository at this point in the history
Signed-off-by: Björn Kautler <Bjoern@Kautler.net>
  • Loading branch information
Vampire committed Jun 12, 2023
1 parent a0cbef0 commit dda0a0a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ val expectedKotlinDslPluginsVersion: String
package org.gradle.kotlin.dsl
import org.gradle.api.Incubating
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.plugin.use.PluginDependenciesSpec
Expand Down Expand Up @@ -92,6 +93,21 @@ fun DependencyHandler.kotlin(module: String, version: String? = null): Any =
"org.jetbrains.kotlin:kotlin-${'$'}module${'$'}{version?.let { ":${'$'}version" } ?: ""}"
/**
* Applies the given Kotlin plugin [module] at the embedded version (currently _${embeddedKotlinVersion}_).
*
* For example: `plugins { embeddedKotlin("plugin.serialization") }`
*
* Visit the [plugin portal](https://plugins.gradle.org/search?term=org.jetbrains.kotlin) to see the list of available plugins.
*
* @param module simple name of the Kotlin Gradle plugin module, for example "jvm", "android", "kapt", "plugin.allopen" etc...
* @since 8.3
*/
@Incubating
fun PluginDependenciesSpec.embeddedKotlin(module: String): PluginDependencySpec =
id("org.jetbrains.kotlin.${'$'}module") version embeddedKotlinVersion
/**
* Applies the given Kotlin plugin [module].
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ class PluginDependenciesSpecScopeTest {
kotlin("jvm") version "1.1.1"
}
}

@Test
fun `given embedded kotlin plugin accessor, it should create a single request with embedded version`() {
expecting(plugin(id = "org.jetbrains.kotlin.jvm", version = embeddedKotlinVersion)) {
embeddedKotlin("jvm")
}
}
}


Expand Down

0 comments on commit dda0a0a

Please sign in to comment.