Skip to content

Commit 946a3fc

Browse files
committed
core: use a library catalog (libs.versions.toml)
Currently, we need to manually sync dependency versions between modules. Using a centralized dependency catalog enables easier upgrades. https://docs.gradle.org/current/userguide/platforms.html
1 parent 89a7e0b commit 946a3fc

File tree

12 files changed

+167
-109
lines changed

12 files changed

+167
-109
lines changed

core/build.gradle

+35-53
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,92 @@
1-
// this project is licensed under LGPLv3.
2-
// DO NOT ADD any dependency which isn't compatible with LGPLv3, such as:
3-
// - GPLv2, GPLv2+
4-
// - GPLv3, GPLv3+
5-
// - EPL 1.0
6-
//
7-
// The following licenses were checked for compatibility for use as libraries:
8-
// - Apache 2.0
9-
// - MIT
10-
// - BSD licenses
11-
// - EPL2.0 (see https://www.eclipse.org/legal/epl-2.0/faq.php#h.hsnsfg4e0htq)
12-
// - LGPLv2, LGPLv2+, LGPLv3
13-
// - GPLv2 with classpath exception
14-
// - CC Attribution
15-
161
import static org.apache.tools.ant.taskdefs.condition.Os.*
172

183
plugins {
194
id 'java'
20-
// must be kept in sync with kotlin_version below
21-
id 'org.jetbrains.kotlin.jvm' version '1.7.21'
22-
id 'com.google.devtools.ksp' version '1.7.21-1.0.8' apply false
5+
alias(libs.plugins.kotlin.jvm)
6+
alias(libs.plugins.ksp) apply false
237
id 'application'
248
id 'checkstyle'
25-
id 'com.github.spotbugs' version '5.0.+'
26-
id 'com.github.johnrengelman.shadow' version '7.1.2'
9+
alias(libs.plugins.spotbugs)
10+
alias(libs.plugins.shadow)
2711
id 'jacoco'
2812
}
2913

30-
// must be kept in sync across all modules
31-
def kotlin_version = '1.7.21'
32-
33-
3414
// region DEPENDENCIES
3515

3616
repositories {
3717
mavenCentral()
3818
}
3919

4020
dependencies {
21+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
22+
4123
implementation project(':osrd-railjson')
4224

4325
// kotlin
44-
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version // Apache 2.0
45-
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.6.+' // Apache 2.0
46-
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-test', version: '1.6.+' // Apache 2.0
47-
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version // Apache 2.0
26+
implementation libs.kotlin.stdlib
27+
implementation libs.kotlinx.coroutines.core
28+
testImplementation libs.kotlin.test
29+
testImplementation libs.kotlinx.coroutines.test
4830

4931
implementation project(':kt-osrd-signaling')
5032
implementation project(":kt-osrd-sim-interlocking")
5133
implementation project(":kt-osrd-sim-infra")
5234

5335
// base primitives
54-
implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre' // Apache 2.0
36+
implementation libs.guava
5537

5638
// command line parsing
57-
implementation group: 'com.beust', name: 'jcommander', version: '1.82' // Apache 2.0
39+
implementation libs.jcommander
5840

5941
// fast primitive collections
60-
implementation group: 'com.carrotsearch', name: 'hppc', version: '0.9.1' // Apache 2.0
42+
implementation libs.hppc
6143

6244
// JSON parsing
63-
implementation 'com.squareup.moshi:moshi:1.14.0' // Apache 2.0
64-
implementation 'com.squareup.moshi:moshi-adapters:1.14.0' // Apache 2.0
45+
implementation libs.moshi
46+
implementation libs.moshi.adapters
6547

6648
// HTTP server framework
67-
implementation group: 'org.takes', name: 'takes', version: '1.24.+' // MIT
68-
implementation group: 'javax.json', name: 'javax.json-api', version: '1.1.4' // GPLv2 with classpath exemption
49+
implementation libs.takes
50+
implementation libs.javax.json.api
6951

7052
// HTTP client
71-
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.10.0' // Apache 2.0
53+
implementation libs.okhttp
7254

7355
// ClassGraph (FastClasspathScanner)
74-
implementation group: 'io.github.classgraph', name: 'classgraph', version: '4.8.+' // MIT
56+
implementation libs.classgraph
7557

7658
// for debug UI
77-
implementation 'com.github.yannrichet:JMathPlot:1.0.1' // BSD
59+
implementation libs.jmathplot
7860

7961
// the logging API stub
80-
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.+' // MIT
62+
implementation libs.slf4j
8163

8264
// the logging API implementation
83-
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.4.+' // EPL 1.0 (incompatible) and LGPL 2.1 (compatible)
84-
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.+'
65+
implementation libs.logback.core
66+
implementation libs.logback.classic
8567

8668
// Sentry
87-
implementation group: 'io.sentry', name: 'sentry', version: '6.8.+' // MIT
69+
implementation libs.sentry
8870

8971
// Use JUnit Jupiter API for testing.
90-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.+' // EPL 2.0
91-
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.+' // EPL 2.0
72+
testImplementation libs.junit.jupiter.api
73+
testImplementation libs.junit.jupiter.params
9274
// Use JUnit Jupiter Engine for testing.
93-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.+' // EPL 2.0
75+
testRuntimeOnly libs.junit.jupiter.engine
9476
// jqwik for property based testing
95-
testImplementation 'net.jqwik:jqwik:1.7.+' // EPL 2.0
77+
testImplementation libs.jqwik
9678
// mockito for mocking
97-
testImplementation group: 'org.mockito', name: 'mockito-inline', version: '4.9.+' // MIT
98-
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.9.+' // MIT
79+
testImplementation libs.mockito.inline
80+
testImplementation libs.mockito.junit.jupiter
9981

10082
// Only needed to run tests in a version of IntelliJ IDEA that bundles older versions
101-
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.9.+' // EPL 2.0
83+
testRuntimeOnly libs.junit.platform.launcher
10284

10385
// for linter annotations
104-
compileOnly 'net.jcip:jcip-annotations:1.0' // CC Attribution
105-
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '4.7.+' // LGPLv2.1
106-
testCompileOnly 'net.jcip:jcip-annotations:1.0' // CC Attribution
107-
testCompileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '4.7.+' // LGPLv2.1
86+
compileOnly libs.jcip.annotations
87+
compileOnly libs.spotbugs.annotations
88+
testCompileOnly libs.jcip.annotations
89+
testCompileOnly libs.spotbugs.annotations
10890
}
10991

11092
// endregion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
2+
alias(libs.plugins.kotlin.jvm)
33
}
44

55
repositories {
66
mavenCentral()
77
}
88

99
dependencies {
10-
api "org.jetbrains.kotlin:kotlin-reflect:1.7.10"
10+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
11+
api libs.kotlin.reflect
1112
}
1213

Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
2+
alias(libs.plugins.kotlin.jvm)
33
}
44

55
repositories {
66
mavenCentral()
77
}
88

99
dependencies {
10+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
1011
api project(":kt-fast-collections-annotations")
11-
implementation 'com.google.devtools.ksp:symbol-processing-api:1.7.10-1.0.6'
12-
implementation "org.jetbrains.kotlin:kotlin-reflect:1.7.10"
12+
implementation libs.ksp.symbol.processing.api
13+
implementation libs.kotlin.reflect
1314
}

core/kt-fast-collections/build.gradle

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
3-
id 'com.google.devtools.ksp'
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ksp)
44
}
55

66
repositories {
77
mavenCentral()
88
}
99

10-
def kotlin_version = '1.7.10'
11-
1210
dependencies {
11+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
1312
api project(':kt-fast-collections-annotations')
1413
ksp project(':kt-fast-collections-generator')
1514

16-
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version // Apache 2.0
17-
api group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.6.+' // Apache 2.0
18-
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version // Apache 2.0
15+
implementation libs.kotlin.stdlib
16+
api libs.kotlinx.coroutines.core
17+
testImplementation libs.kotlin.test
1918
}
2019

2120
// to get KSP generated-stuff to be recognised

core/kt-osrd-signaling/build.gradle

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
3-
id 'com.google.devtools.ksp'
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ksp)
44
}
55

66
repositories {
77
mavenCentral()
88
}
99

10-
def kotlin_version = '1.7.10'
11-
1210
dependencies {
11+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
1312
api project(":kt-osrd-utils")
1413
api project(':kt-osrd-sim-infra')
1514
api project(":osrd-railjson")
1615

17-
implementation group: 'io.github.microutils', name: 'kotlin-logging', version: '3.0.4' // Apache 2.0
18-
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version // Apache 2.0
19-
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version // Apache 2.0
16+
implementation libs.kotlin.logging
17+
implementation libs.kotlin.stdlib
18+
testImplementation libs.kotlin.test
2019
}
2120

2221
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {

core/kt-osrd-sim-infra/build.gradle

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
3-
id 'com.google.devtools.ksp'
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ksp)
44
}
55

66
repositories {
77
mavenCentral()
88
}
99

10-
def kotlin_version = '1.7.10'
11-
1210
dependencies {
11+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
1312
implementation project(':kt-fast-collections')
1413
ksp project(':kt-fast-collections-generator')
1514

1615
api project(":kt-osrd-utils")
1716
api project(":osrd-railjson")
18-
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version // Apache 2.0
19-
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version // Apache 2.0
17+
implementation libs.kotlin.stdlib
18+
testImplementation libs.kotlin.test
2019
}
2120

2221
// to get KSP generated-stuff to be recognised

core/kt-osrd-sim-interlocking/build.gradle

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
3-
id 'com.google.devtools.ksp'
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ksp)
44
}
55

66
repositories {
77
mavenCentral()
88
}
99

10-
def kotlin_version = '1.7.10'
11-
1210
dependencies {
11+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
1312
api project(":kt-osrd-utils")
1413
api project(':kt-osrd-sim-infra')
15-
api group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.6.+' // Apache 2.0
14+
api libs.kotlinx.coroutines.core
1615

17-
implementation group: 'io.github.microutils', name: 'kotlin-logging', version: '3.0.4' // Apache 2.0
18-
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version // Apache 2.0
19-
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-test', version: '1.6.+' // Apache 2.0
20-
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version // Apache 2.0
16+
implementation libs.kotlin.logging
17+
implementation libs.kotlin.stdlib
18+
implementation libs.kotlinx.coroutines.test
19+
testImplementation libs.kotlin.test
2120

2221
// the logging API implementation is only needed during testing, as this is a library
23-
testRuntimeOnly group: 'ch.qos.logback', name: 'logback-core', version: '1.4.+' // EPL 1.0 (incompatible) and LGPL 2.1 (compatible)
24-
testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.+'
22+
testRuntimeOnly libs.logback.core
23+
testRuntimeOnly libs.logback.classic
2524
}
2625

2726
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {

core/kt-osrd-sncf-signaling/build.gradle

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
2+
alias(libs.plugins.kotlin.jvm)
33
}
44

55
repositories {
66
mavenCentral()
77
}
88

9-
def kotlin_version = '1.7.10'
10-
119
dependencies {
10+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
1211
api project(':kt-osrd-signaling')
1312

14-
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version // Apache 2.0
15-
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version // Apache 2.0
13+
implementation libs.kotlin.stdlib
14+
testImplementation libs.kotlin.test
1615
}
1716

1817
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {

core/kt-osrd-utils/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
3-
id 'com.google.devtools.ksp'
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ksp)
44
}
55

66
repositories {
77
mavenCentral()
88
}
99

10-
def kotlin_version = '1.7.10'
11-
1210
dependencies {
11+
// PLEASE ADD AND UPDATE DEPENDENCIES USING libs.versions.toml
1312
implementation project(':kt-fast-collections')
1413
ksp project(':kt-fast-collections-generator')
1514

16-
api group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.6.+' // Apache 2.0
17-
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version // Apache 2.0
18-
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version // Apache 2.0
15+
api libs.kotlinx.coroutines.core
16+
implementation libs.kotlin.stdlib
17+
testImplementation libs.kotlin.test
1918
}
2019

20+
2121
// to get KSP generated-stuff to be recognised
2222
kotlin {
2323
sourceSets {

0 commit comments

Comments
 (0)