diff --git a/build-logic/preprocess-workflows/preprocess-workflows.gradle b/build-logic/preprocess-workflows/preprocess-workflows.gradle index f8c79aa04d..c6eb2c83b4 100644 --- a/build-logic/preprocess-workflows/preprocess-workflows.gradle +++ b/build-logic/preprocess-workflows/preprocess-workflows.gradle @@ -4,7 +4,7 @@ plugins { } dependencies { - implementation('org.jetbrains.kotlin:kotlin-compiler-embeddable:2.1.0') + implementation(libs.workflows.kotlin.compiler.embeddable) } gradlePlugin { diff --git a/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy b/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy index 4f4429e147..cfbbc636d8 100644 --- a/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy +++ b/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy @@ -19,7 +19,7 @@ package org.spockframework.gradle import groovy.transform.CompileStatic import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.artifacts.ModuleDependency +import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.api.tasks.JavaExec import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.jvm.toolchain.JavaToolchainService @@ -40,15 +40,16 @@ import static org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles.JVM_C @CompileStatic class PreprocessWorkflowsPlugin implements Plugin { void apply(Project project) { + def libs = project.extensions.getByType(VersionCatalogsExtension).find('libs').orElseThrow(AssertionError::new) def kotlinCompilerClasspath = project.configurations.detachedConfiguration( - project.dependencies.create('org.jetbrains.kotlin:kotlin-compiler:2.1.0'), - project.dependencies.create('org.jetbrains.kotlin:kotlin-scripting-compiler:2.1.0') + libs.findLibrary('workflows-kotlin-compiler').orElseThrow(AssertionError::new).get(), + libs.findLibrary('workflows-kotlin-scripting-compiler').orElseThrow(AssertionError::new).get() ) def kotlinScriptClasspath = project.configurations.detachedConfiguration( - project.dependencies.create('org.jetbrains.kotlin:kotlin-main-kts:2.1.0') { ModuleDependency it -> - it.transitive = false - } - ) + libs.findLibrary('workflows-kotlin-main-kts').orElseThrow(AssertionError::new).get() + ).tap { + it.transitive = false + } def preprocessWorkflows = project.tasks.register('preprocessWorkflows') { it.group = 'github actions' @@ -83,6 +84,12 @@ class PreprocessWorkflowsPlugin implements Plugin { // work-around for https://youtrack.jetbrains.com/issue/KT-42101 it.systemProperty('kotlin.main.kts.compiled.scripts.cache.dir', '') } + project.pluginManager.withPlugin('io.spring.nohttp') { + // iff both tasks are run, workflow files should be generated before checkstyle check + project.tasks.named('checkstyleNohttp') { + it.mustRunAfter(preprocessWorkflow) + } + } preprocessWorkflows.configure { it.dependsOn(preprocessWorkflow) } diff --git a/build.gradle b/build.gradle index bd81b3ccfc..9e0dcb0166 100644 --- a/build.gradle +++ b/build.gradle @@ -251,7 +251,7 @@ tasks.register("codeCoverageReport", JacocoReport) { } if (gradle.startParameter.taskNames == ["ghActionsBuild"]) { - gradle.startParameter.taskNames = ["build", "codeCoverageReport"] + gradle.startParameter.taskNames = ["build", "preprocessWorkflows", "codeCoverageReport"] } if (gradle.startParameter.taskNames == ["ghActionsPublish"] || gradle.startParameter.taskNames == ["ghActionsDocs"]) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a5951961a2..6aff1a43c4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,8 @@ jacoco = '0.8.12' junit = '5.11.4' asm = '9.7.1' mockito4 = '4.11.0' -mockito5 = '5.15.2' +mockito5 = '5.15s.2' +workflows-kotlin = "2.0.20" [libraries] jetbrains-annotations = "org.jetbrains:annotations:26.0.1" @@ -33,6 +34,10 @@ junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" } junit-jupiter.module = "org.junit.jupiter:junit-jupiter" junit-platform-testkit.module = "org.junit.platform:junit-platform-testkit" junit-platform-console.module = "org.junit.platform:junit-platform-console" +workflows-kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "workflows-kotlin" } +workflows-kotlin-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "workflows-kotlin" } +workflows-kotlin-main-kts = { module = "org.jetbrains.kotlin:kotlin-main-kts", version.ref = "workflows-kotlin" } +workflows-kotlin-scripting-compiler = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler", version.ref = "workflows-kotlin" } # just here so that renovate can figure out the dependencies groovy-v2 = { module = "org.codehaus.groovy:groovy", version.ref="groovy2" }