@@ -19,7 +19,8 @@ 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.ExternalModuleDependency
23+ import org.gradle.api.artifacts.VersionCatalogsExtension
2324import org.gradle.api.tasks.JavaExec
2425import org.gradle.jvm.toolchain.JavaLanguageVersion
2526import org.gradle.jvm.toolchain.JavaToolchainService
@@ -40,15 +41,16 @@ import static org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles.JVM_C
4041@CompileStatic
4142class 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'
@@ -83,6 +85,12 @@ class PreprocessWorkflowsPlugin implements Plugin<Project> {
8385 // work-around for https://youtrack.jetbrains.com/issue/KT-42101
8486 it. systemProperty(' kotlin.main.kts.compiled.scripts.cache.dir' , ' ' )
8587 }
88+ project. pluginManager. withPlugin(' io.spring.nohttp' ) {
89+ // iff both tasks are run, workflow files should be generated before checkstyle check
90+ project. tasks. named(' checkstyleNohttp' ) {
91+ it. mustRunAfter(preprocessWorkflow)
92+ }
93+ }
8694 preprocessWorkflows. configure {
8795 it. dependsOn(preprocessWorkflow)
8896 }
0 commit comments