Skip to content

Commit d691de0

Browse files
authored
Detect the Kotlin version at runtime rather than hard-coding it. (#64)
2 parents 89d2419 + 45c0be8 commit d691de0

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## [Unreleased]
44
### Changed
5-
- Bump all dependencies to latest.
5+
- Bump required JVM from 11 to 17. ([#63](https://github.com/diffplug/atplug/pull/63))
6+
- Detect Kotlin version rather than harcode it. ([#64](https://github.com/diffplug/atplug/pull/64))
67

78
## [1.1.1] - 2024-07-06
89
### Changed

atplug-plugin-gradle/src/main/java/com/diffplug/atplug/tooling/gradle/PlugPlugin.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ class PlugPlugin : Plugin<Project> {
3838
project.plugins.apply(JavaPlugin::class.java)
3939
val javaExtension = project.extensions.getByType(JavaPluginExtension::class.java)
4040
val main = javaExtension.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)
41-
val dep = project.dependencies.create("org.jetbrains.kotlin:kotlin-reflect:1.8.20")
41+
val plugin =
42+
project.plugins.findPlugin("org.jetbrains.kotlin.jvm")
43+
as org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
44+
val dep =
45+
project.dependencies.create("org.jetbrains.kotlin:kotlin-reflect:${plugin.pluginVersion}")
4246
val plugGenConfig =
4347
project.configurations.create("plugGenerate") { plugGen: Configuration ->
4448
plugGen.extendsFrom(

atplug-plugin-gradle/src/test/java/com/diffplug/atplug/tooling/PlugGeneratorTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PlugGeneratorTest : ResourceHarness() {
2323
true,
2424
listOf(
2525
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1",
26-
"org.jetbrains.kotlin:kotlin-reflect:1.8.20"))
26+
"org.jetbrains.kotlin:kotlin-reflect:2.1.0"))
2727
val atplug_runtime = mutableSetOf(findRuntimeJar())
2828
atplug_runtime.addAll(transitives)
2929
return atplug_runtime

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ subprojects {
4848
dependencies {
4949
implementation "org.ow2.asm:asm:9.7.1"
5050
implementation 'com.diffplug.gradle:goomph:4.2.0'
51+
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0'
5152
testImplementation 'org.assertj:assertj-core:3.27.3'
5253
}
5354
tasks.named('test') {

0 commit comments

Comments
 (0)