Skip to content

Commit 9c24e5f

Browse files
authored
Move workflows Kotlin dependencies for Gradle to version catalog (#2066)
This contains old Kotlin version to test that Renovate now properly updates it.
1 parent 52dfc4f commit 9c24e5f

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

build-logic/preprocess-workflows/preprocess-workflows.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
dependencies {
7-
implementation('org.jetbrains.kotlin:kotlin-compiler-embeddable:2.1.0')
7+
implementation(libs.workflows.kotlin.compilerEmbeddable)
88
}
99

1010
gradlePlugin {

build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.spockframework.gradle
1919
import groovy.transform.CompileStatic
2020
import org.gradle.api.Plugin
2121
import org.gradle.api.Project
22-
import org.gradle.api.artifacts.ModuleDependency
22+
import org.gradle.api.artifacts.VersionCatalogsExtension
2323
import org.gradle.api.tasks.JavaExec
2424
import org.gradle.jvm.toolchain.JavaLanguageVersion
2525
import org.gradle.jvm.toolchain.JavaToolchainService
@@ -40,15 +40,16 @@ import static org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles.JVM_C
4040
@CompileStatic
4141
class PreprocessWorkflowsPlugin implements Plugin<Project> {
4242
void apply(Project project) {
43+
def libs = project.extensions.getByType(VersionCatalogsExtension).find('libs').orElseThrow(AssertionError::new)
4344
def kotlinCompilerClasspath = project.configurations.detachedConfiguration(
44-
project.dependencies.create('org.jetbrains.kotlin:kotlin-compiler:2.1.0'),
45-
project.dependencies.create('org.jetbrains.kotlin:kotlin-scripting-compiler:2.1.0')
45+
libs.findLibrary('workflows-kotlin-compiler').orElseThrow(AssertionError::new).get(),
46+
libs.findLibrary('workflows-kotlin-scriptingCompiler').orElseThrow(AssertionError::new).get()
4647
)
4748
def kotlinScriptClasspath = project.configurations.detachedConfiguration(
48-
project.dependencies.create('org.jetbrains.kotlin:kotlin-main-kts:2.1.0') { ModuleDependency it ->
49-
it.transitive = false
50-
}
51-
)
49+
libs.findLibrary('workflows-kotlin-mainKts').orElseThrow(AssertionError::new).get()
50+
).tap {
51+
it.transitive = false
52+
}
5253

5354
def preprocessWorkflows = project.tasks.register('preprocessWorkflows') {
5455
it.group = 'github actions'
@@ -83,6 +84,12 @@ class PreprocessWorkflowsPlugin implements Plugin<Project> {
8384
// work-around for https://youtrack.jetbrains.com/issue/KT-42101
8485
it.systemProperty('kotlin.main.kts.compiled.scripts.cache.dir', '')
8586
}
87+
project.pluginManager.withPlugin('io.spring.nohttp') {
88+
// iff both tasks are run, workflow files should be generated before checkstyle check
89+
project.tasks.named('checkstyleNohttp') {
90+
it.mustRunAfter(preprocessWorkflow)
91+
}
92+
}
8693
preprocessWorkflows.configure {
8794
it.dependsOn(preprocessWorkflow)
8895
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ tasks.register("codeCoverageReport", JacocoReport) {
251251
}
252252

253253
if (gradle.startParameter.taskNames == ["ghActionsBuild"]) {
254-
gradle.startParameter.taskNames = ["build", "codeCoverageReport"]
254+
gradle.startParameter.taskNames = ["build", "preprocessWorkflows", "codeCoverageReport"]
255255
}
256256

257257
if (gradle.startParameter.taskNames == ["ghActionsPublish"] || gradle.startParameter.taskNames == ["ghActionsDocs"]) {

gradle/libs.versions.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ junit = '5.11.4'
88
asm = '9.7.1'
99
mockito4 = '4.11.0'
1010
mockito5 = '5.15.2'
11+
workflows-kotlin = "2.0.20"
1112

1213
[libraries]
1314
jetbrains-annotations = "org.jetbrains:annotations:26.0.1"
@@ -33,6 +34,10 @@ junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
3334
junit-jupiter.module = "org.junit.jupiter:junit-jupiter"
3435
junit-platform-testkit.module = "org.junit.platform:junit-platform-testkit"
3536
junit-platform-console.module = "org.junit.platform:junit-platform-console"
37+
workflows-kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "workflows-kotlin" }
38+
workflows-kotlin-compilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "workflows-kotlin" }
39+
workflows-kotlin-mainKts = { module = "org.jetbrains.kotlin:kotlin-main-kts", version.ref = "workflows-kotlin" }
40+
workflows-kotlin-scriptingCompiler = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler", version.ref = "workflows-kotlin" }
3641

3742
# just here so that renovate can figure out the dependencies
3843
groovy-v2 = { module = "org.codehaus.groovy:groovy", version.ref="groovy2" }

0 commit comments

Comments
 (0)