@@ -4,9 +4,7 @@ import com.google.protobuf.gradle.proto
44import java.nio.charset.StandardCharsets
55import java.util.Base64
66import org.gradle.api.JavaVersion
7- import org.gradle.api.artifacts.VersionCatalogsExtension
87import org.gradle.api.distribution.DistributionContainer
9- import org.gradle.api.plugins.BasePluginExtension
108import org.gradle.api.plugins.JavaApplication
119import org.gradle.api.plugins.JavaPlugin
1210import org.gradle.api.plugins.JavaPluginExtension
@@ -62,9 +60,8 @@ val javacModuleOptions =
6260 " -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" ,
6361 )
6462val javacTestJvmOptions = javacModuleOptions.map { it.removePrefix(" -J" ) }
65- val versionCatalog = extensions.getByType<VersionCatalogsExtension >().named(" libs" )
66- val protobufVersion = versionCatalog.findVersion(" protobuf" ).get().requiredVersion
67- fun library (alias : String ) = versionCatalog.findLibrary(alias).get()
63+ val catalog = libs
64+ val protobufVersion = catalog.versions.protobuf.asProvider().get()
6865
6966allprojects {
7067 group = rootProject.group
@@ -102,6 +99,12 @@ subprojects {
10299 }
103100 }
104101 }
102+
103+ plugins.withId(" org.jetbrains.kotlin.jvm" ) {
104+ tasks.withType<KotlinCompile >().configureEach {
105+ compilerOptions.jvmTarget.set(JvmTarget .JVM_11 )
106+ }
107+ }
105108}
106109
107110fun Project.configureMavenPublishing (displayName : String , descriptionText : String ) {
@@ -170,7 +173,7 @@ project(":scip-shared") {
170173 apply (plugin = " java-library" )
171174
172175 dependencies {
173- " api" (library( " scip- java- bindings" ) )
176+ " api" (catalog. scip. java. bindings)
174177 }
175178
176179 configureMavenPublishing(
@@ -185,9 +188,9 @@ project(":scip-javac") {
185188
186189 dependencies {
187190 " api" (project(" :scip-shared" ))
188- " testImplementation" (library( " junit- jupiter- api" ) )
189- " testRuntimeOnly" (library( " junit- jupiter- engine" ) )
190- " testRuntimeOnly" (library( " junit- platform- launcher" ) )
191+ " testImplementation" (catalog. junit. jupiter. api)
192+ " testRuntimeOnly" (catalog. junit. jupiter. engine)
193+ " testRuntimeOnly" (catalog. junit. platform. launcher)
191194 }
192195
193196 tasks.named<JavaCompile >(" compileJava" ) {
@@ -228,22 +231,21 @@ project(":scip-kotlinc") {
228231
229232 dependencies {
230233 " implementation" (project(" :scip-shared" ))
231- " implementation" (library( " scip- kotlin- bindings" ) )
232- " compileOnly" (library( " kotlin- stdlib" ) )
233- " compileOnly" (library( " kotlin- compiler- embeddable" ) )
234+ " implementation" (catalog. scip. kotlin. bindings)
235+ " compileOnly" (catalog. kotlin. stdlib)
236+ " compileOnly" (catalog. kotlin. compiler. embeddable)
234237
235- " testImplementation" (library( " kotlin- compiler- embeddable" ) )
236- " testImplementation" (library( " kotlin- test" ) )
237- " testImplementation" (library( " kotlin- test- junit5" ) )
238- " testImplementation" (library( " kotlin- reflect" ) )
239- " testImplementation" (library( " kotest- assertions- core" ) )
240- " testImplementation" (library( " kctfork- core" ) )
241- " testRuntimeOnly" (library( " junit- jupiter- engine" ) )
242- " testRuntimeOnly" (library( " junit- platform- launcher" ) )
238+ " testImplementation" (catalog. kotlin. compiler. embeddable)
239+ " testImplementation" (catalog. kotlin. test)
240+ " testImplementation" (catalog. kotlin. test. junit5)
241+ " testImplementation" (catalog. kotlin. reflect)
242+ " testImplementation" (catalog. kotest. assertions. core)
243+ " testImplementation" (catalog. kctfork. core)
244+ " testRuntimeOnly" (catalog. junit. jupiter. engine)
245+ " testRuntimeOnly" (catalog. junit. platform. launcher)
243246 }
244247
245248 tasks.withType<KotlinCompile >().configureEach {
246- compilerOptions.jvmTarget.set(JvmTarget .JVM_11 )
247249 compilerOptions.freeCompilerArgs.addAll(" -Xinline-classes" , " -Xcontext-parameters" )
248250 }
249251
@@ -266,24 +268,19 @@ project(":scip-gradle-plugin") {
266268 apply (plugin = " java-library" )
267269 apply (plugin = " com.github.johnrengelman.shadow" )
268270
269- extensions.configure<BasePluginExtension > {
270- archivesName.set(" scip-gradle" )
271- }
272-
273271 dependencies {
274- " compileOnly" (library( " gradle- api" ) )
275- " compileOnly" (library( " gradle- test- kit" ) )
272+ " compileOnly" (catalog. gradle. api)
273+ " compileOnly" (catalog. gradle. test. kit)
276274 }
277-
278275}
279276
280277project(" :scip-maven-plugin" ) {
281278 apply (plugin = " java-library" )
282279
283280 dependencies {
284- " implementation" (library( " maven- plugin- api" ) )
285- " implementation" (library( " maven- project" ) )
286- " compileOnly" (library( " maven- plugin- annotations" ) )
281+ " implementation" (catalog. maven. plugin. api)
282+ " implementation" (catalog. maven. project)
283+ " compileOnly" (catalog. maven. plugin. annotations)
287284 }
288285
289286 tasks.named<ProcessResources >(" processResources" ) {
@@ -307,11 +304,11 @@ project(":scip-aggregator") {
307304 apply (plugin = " com.google.protobuf" )
308305
309306 dependencies {
310- " api" (library( " scip- java- bindings" ) )
307+ " api" (catalog. scip. java. bindings)
311308 " implementation" (project(" :scip-shared" ))
312- " testImplementation" (library( " junit- jupiter- api" ) )
313- " testRuntimeOnly" (library( " junit- jupiter- engine" ) )
314- " testRuntimeOnly" (library( " junit- platform- launcher" ) )
309+ " testImplementation" (catalog. junit. jupiter. api)
310+ " testRuntimeOnly" (catalog. junit. jupiter. engine)
311+ " testRuntimeOnly" (catalog. junit. platform. launcher)
315312 }
316313
317314 extensions.configure<ProtobufExtension >(" protobuf" ) {
@@ -340,23 +337,19 @@ project(":scip-java") {
340337
341338 dependencies {
342339 " implementation" (project(" :scip-aggregator" ))
343- " implementation" (library(" clikt-jvm" ))
344- " implementation" (library(" kotlin-stdlib" ))
345- " implementation" (library(" kotlin-compiler-embeddable" ))
346- " implementation" (library(" kotlin-scripting-common" ))
347- " implementation" (library(" kotlin-scripting-jvm" ))
348- " implementation" (library(" kotlin-scripting-dependencies" ))
349- " implementation" (library(" kotlin-scripting-dependencies-maven" ))
350- " implementation" (library(" kotlinx-serialization-json-jvm" ))
351-
352- " testImplementation" (library(" kotlin-test" ))
353- " testImplementation" (library(" kotlin-test-junit5" ))
354- " testRuntimeOnly" (library(" junit-jupiter-engine" ))
355- " testRuntimeOnly" (library(" junit-platform-launcher" ))
356- }
340+ " implementation" (catalog.clikt.jvm)
341+ " implementation" (catalog.kotlin.stdlib)
342+ " implementation" (catalog.kotlin.compiler.embeddable)
343+ " implementation" (catalog.kotlin.scripting.common)
344+ " implementation" (catalog.kotlin.scripting.jvm)
345+ " implementation" (catalog.kotlin.scripting.dependencies)
346+ " implementation" (catalog.kotlin.scripting.dependencies.maven)
347+ " implementation" (catalog.kotlinx.serialization.json.jvm)
357348
358- tasks.withType<KotlinCompile >().configureEach {
359- compilerOptions.jvmTarget.set(JvmTarget .JVM_11 )
349+ " testImplementation" (catalog.kotlin.test)
350+ " testImplementation" (catalog.kotlin.test.junit5)
351+ " testRuntimeOnly" (catalog.junit.jupiter.engine)
352+ " testRuntimeOnly" (catalog.junit.platform.launcher)
360353 }
361354
362355 tasks.named<Test >(" test" ) {
@@ -422,8 +415,8 @@ project(":scip-snapshots-java-common") {
422415 apply (plugin = " java-library" )
423416
424417 dependencies {
425- " compileOnly" (library( " lombok" ) )
426- " annotationProcessor" (library( " lombok" ) )
418+ " compileOnly" (catalog. lombok)
419+ " annotationProcessor" (catalog. lombok)
427420 }
428421
429422 val annotationProcessorClasspath = configurations.named(" annotationProcessor" )
@@ -454,7 +447,7 @@ project(":scip-snapshots-kotlin-common") {
454447 apply (plugin = " org.jetbrains.kotlin.jvm" )
455448
456449 dependencies {
457- " implementation" (library( " kotlin- stdlib" ) )
450+ " implementation" (catalog. kotlin. stdlib)
458451 }
459452
460453 val scipTargetroot = layout.buildDirectory.dir(" scip-targetroot" )
@@ -465,7 +458,6 @@ project(":scip-snapshots-kotlin-common") {
465458 dependsOn(kotlincShadow)
466459 inputs.file(kotlincShadow.flatMap { it.archiveFile })
467460 outputs.dir(scipTargetroot)
468- compilerOptions.jvmTarget.set(JvmTarget .JVM_11 )
469461 compilerOptions.freeCompilerArgs.addAll(
470462 " -Xplugin=${kotlincShadow.flatMap { it.archiveFile }.get().asFile.absolutePath} " ,
471463 " -P" ,
@@ -498,10 +490,10 @@ project(":scip-snapshots") {
498490
499491 dependencies {
500492 " implementation" (project(" :scip-java" ))
501- " implementation" (library( " scip- java- bindings" ) )
502- " testImplementation" (library( " junit- jupiter- api" ) )
503- " testRuntimeOnly" (library( " junit- jupiter- engine" ) )
504- " testRuntimeOnly" (library( " junit- platform- launcher" ) )
493+ " implementation" (catalog. scip. java. bindings)
494+ " testImplementation" (catalog. junit. jupiter. api)
495+ " testRuntimeOnly" (catalog. junit. jupiter. engine)
496+ " testRuntimeOnly" (catalog. junit. platform. launcher)
505497 }
506498
507499 val javaCase = project(" :scip-snapshots-java-common" )
0 commit comments