Skip to content

Commit 4b75970

Browse files
committed
Move workflows Kotlin dependencies for Gradle to version catalog
1 parent e08b875 commit 4b75970

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-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.compiler.embeddable)
88
}
99

1010
gradlePlugin {

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ 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.ExternalModuleDependency
23+
import org.gradle.api.artifacts.VersionCatalogsExtension
2324
import org.gradle.api.tasks.JavaExec
2425
import org.gradle.jvm.toolchain.JavaLanguageVersion
2526
import org.gradle.jvm.toolchain.JavaToolchainService
@@ -40,15 +41,16 @@ import static org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles.JVM_C
4041
@CompileStatic
4142
class PreprocessWorkflowsPlugin implements Plugin<Project> {
4243
void apply(Project project) {
44+
def libs = project.extensions.getByType(VersionCatalogsExtension).find('libs').orElseThrow(AssertionError::new)
4345
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')
46+
libs.findLibrary('workflows-kotlin-compiler').orElseThrow(AssertionError::new).get(),
47+
libs.findLibrary('workflows-kotlin-scripting-compiler').orElseThrow(AssertionError::new).get()
4648
)
4749
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-
)
50+
libs.findLibrary('workflows-kotlin-main-kts').orElseThrow(AssertionError::new).get()
51+
).tap {
52+
it.transitive = false
53+
}
5254

5355
def preprocessWorkflows = project.tasks.register('preprocessWorkflows') {
5456
it.group = 'github actions'

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.14.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-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "workflows-kotlin" }
39+
workflows-kotlin-main-kts = { module = "org.jetbrains.kotlin:kotlin-main-kts", version.ref = "workflows-kotlin" }
40+
workflows-kotlin-scripting-compiler = { 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)