@@ -19,7 +19,7 @@ package org.spockframework.gradle
1919import groovy.transform.CompileStatic
2020import org.gradle.api.Plugin
2121import org.gradle.api.Project
22- import org.gradle.api.artifacts.ModuleDependency
22+ import org.gradle.api.artifacts.VersionCatalogsExtension
2323import org.gradle.api.tasks.JavaExec
2424import org.gradle.jvm.toolchain.JavaLanguageVersion
2525import org.gradle.jvm.toolchain.JavaToolchainService
@@ -40,15 +40,16 @@ import static org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles.JVM_C
4040@CompileStatic
4141class 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 }
0 commit comments