Skip to content

Commit 3d47096

Browse files
Modernize Gradle setup with Version Catalog and centralized repositories
- Introduced Gradle Version Catalog in `gradle/libs.versions.toml`. - Centralized repository configuration in `settings.gradle.kts` using `dependencyResolutionManagement`. - Updated all subprojects to use the Version Catalog. - Converted `cake/core/build.gradle` to Kotlin DSL. - Cleaned up `gradle.properties` by removing external dependency versions. - Restored `nativeimage.gradle` inclusion in `cake/lwjgl3/build.gradle`. - Removed redundant `kotlin-stdlib` dependency from `cake/core`. - Verified the build and tests pass successfully. Co-authored-by: demoth <638804+demoth@users.noreply.github.com>
1 parent 45a2d38 commit 3d47096

10 files changed

Lines changed: 99 additions & 76 deletions

File tree

build.gradle

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22

3-
buildscript {
4-
repositories {
5-
mavenCentral()
6-
maven { url 'https://s01.oss.sonatype.org' }
7-
gradlePluginPortal()
8-
mavenLocal()
9-
google()
10-
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
11-
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
12-
}
13-
dependencies {
14-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
15-
}
3+
plugins {
4+
alias(libs.plugins.kotlin.jvm) apply false
5+
alias(libs.plugins.badass.runtime) apply false
6+
alias(libs.plugins.graalvm.native) apply false
167
}
178

189
configure(subprojects) {
@@ -35,16 +26,7 @@ subprojects {
3526
group = 'org.demoth'
3627
version = '1.0.0'
3728
ext.appName = 'cake'
38-
repositories {
39-
mavenCentral()
40-
maven { url 'https://s01.oss.sonatype.org' }
41-
// You may want to remove the following line if you have errors downloading dependencies.
42-
mavenLocal()
43-
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
44-
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
45-
maven { url 'https://jitpack.io' }
46-
}
4729
dependencies {
48-
testImplementation('junit:junit:4.12')
30+
testImplementation(libs.junit)
4931
}
5032
}

cake/core/build.gradle

Lines changed: 0 additions & 21 deletions
This file was deleted.

cake/core/build.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
dependencies {
2+
api(libs.gdx.controllers.core)
3+
api(libs.gdx.freetype)
4+
api(libs.gdx)
5+
// api(libs.gdx.scene2d.ui)
6+
api(libs.ktx.actors)
7+
api(libs.ktx.app)
8+
api(libs.ktx.assets.async)
9+
api(libs.ktx.assets)
10+
api(libs.ktx.async)
11+
api(libs.ktx.collections)
12+
api(libs.ktx.freetype.async)
13+
api(libs.ktx.freetype)
14+
api(libs.ktx.graphics)
15+
api(libs.ktx.log)
16+
api(libs.ktx.scene2d)
17+
api(libs.kotlinx.coroutines.core)
18+
19+
implementation(project(":qcommon"))
20+
}

cake/lwjgl3/build.gradle

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
buildscript {
2-
repositories {
3-
gradlePluginPortal()
4-
}
5-
dependencies {
6-
// using jpackage only works if the JDK version is 14 or higher.
7-
// your JAVA_HOME environment variable may also need to be a JDK with version 14 or higher.
8-
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
9-
classpath "org.beryx:badass-runtime-plugin:1.13.0"
10-
}
11-
if(enableGraalNative == 'true') {
12-
classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28"
13-
}
14-
}
15-
}
161
apply plugin: 'org.jetbrains.kotlin.jvm'
172

183
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
@@ -31,10 +16,10 @@ java.sourceCompatibility = 11
3116
java.targetCompatibility = 11
3217

3318
dependencies {
34-
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion"
35-
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
36-
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
37-
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
19+
implementation libs.gdx.controllers.desktop
20+
implementation libs.gdx.backend.lwjgl3
21+
implementation "com.badlogicgames.gdx:gdx-freetype-platform:${libs.versions.gdx.get()}:natives-desktop"
22+
implementation "com.badlogicgames.gdx:gdx-platform:${libs.versions.gdx.get()}:natives-desktop"
3823
implementation project(':cake:core')
3924
}
4025

cake/lwjgl3/nativeimage.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ project(":cake:lwjgl3") {
22
apply plugin: "org.graalvm.buildtools.native"
33

44
dependencies {
5-
implementation "io.github.berstanio:gdx-svmhelper-backend-lwjgl3:$graalHelperVersion"
6-
implementation "io.github.berstanio:gdx-svmhelper-extension-freetype:$graalHelperVersion"
5+
implementation libs.gdx.svmhelper.backend.lwjgl3
6+
implementation libs.gdx.svmhelper.extension.freetype
77
}
88
graalvmNative {
99
binaries {
@@ -25,6 +25,6 @@ project(":cake:lwjgl3") {
2525

2626
project(":cake:core") {
2727
dependencies {
28-
implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
28+
implementation libs.gdx.svmhelper.annotations
2929
}
3030
}

game/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dependencies {
22
implementation(project(":qcommon"))
3-
implementation("org.apache.commons:commons-csv:1.9.0")
3+
implementation(libs.commons.csv)
44
}

gradle.properties

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,4 @@ org.gradle.configureondemand=false
77
org.gradle.workers.max=4
88
org.gradle.jvmargs=-Xms512M -Xmx1G
99

10-
kotlinVersion=1.9.22
11-
kotlinxCoroutinesVersion=1.6.4
12-
13-
graalHelperVersion=2.0.1
1410
enableGraalNative=true
15-
16-
gdxControllersVersion=2.2.3
17-
gdxVersion=1.12.1
18-
ktxVersion=1.12.1-rc1

gradle/libs.versions.toml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[versions]
2+
kotlin = "1.9.22"
3+
kotlinxCoroutines = "1.6.4"
4+
gdx = "1.12.1"
5+
gdxControllers = "2.2.3"
6+
ktx = "1.12.1-rc1"
7+
commonsCsv = "1.9.0"
8+
junit = "4.12"
9+
logback = "1.4.14"
10+
badassRuntime = "1.13.0"
11+
graalvmNative = "0.9.28"
12+
graalHelper = "2.0.1"
13+
14+
[libraries]
15+
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
16+
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
17+
gdx = { group = "com.badlogicgames.gdx", name = "gdx", version.ref = "gdx" }
18+
gdx-freetype = { group = "com.badlogicgames.gdx", name = "gdx-freetype", version.ref = "gdx" }
19+
gdx-backend-lwjgl3 = { group = "com.badlogicgames.gdx", name = "gdx-backend-lwjgl3", version.ref = "gdx" }
20+
gdx-platform = { group = "com.badlogicgames.gdx", name = "gdx-platform", version.ref = "gdx" }
21+
gdx-freetype-platform = { group = "com.badlogicgames.gdx", name = "gdx-freetype-platform", version.ref = "gdx" }
22+
gdx-controllers-core = { group = "com.badlogicgames.gdx-controllers", name = "gdx-controllers-core", version.ref = "gdxControllers" }
23+
gdx-controllers-desktop = { group = "com.badlogicgames.gdx-controllers", name = "gdx-controllers-desktop", version.ref = "gdxControllers" }
24+
ktx-actors = { group = "io.github.libktx", name = "ktx-actors", version.ref = "ktx" }
25+
ktx-app = { group = "io.github.libktx", name = "ktx-app", version.ref = "ktx" }
26+
ktx-assets-async = { group = "io.github.libktx", name = "ktx-assets-async", version.ref = "ktx" }
27+
ktx-assets = { group = "io.github.libktx", name = "ktx-assets", version.ref = "ktx" }
28+
ktx-async = { group = "io.github.libktx", name = "ktx-async", version.ref = "ktx" }
29+
ktx-collections = { group = "io.github.libktx", name = "ktx-collections", version.ref = "ktx" }
30+
ktx-freetype-async = { group = "io.github.libktx", name = "ktx-freetype-async", version.ref = "ktx" }
31+
ktx-freetype = { group = "io.github.libktx", name = "ktx-freetype", version.ref = "ktx" }
32+
ktx-graphics = { group = "io.github.libktx", name = "ktx-graphics", version.ref = "ktx" }
33+
ktx-log = { group = "io.github.libktx", name = "ktx-log", version.ref = "ktx" }
34+
ktx-scene2d = { group = "io.github.libktx", name = "ktx-scene2d", version.ref = "ktx" }
35+
commons-csv = { group = "org.apache.commons", name = "commons-csv", version.ref = "commonsCsv" }
36+
junit = { group = "junit", name = "junit", version.ref = "junit" }
37+
logback-classic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }
38+
gdx-svmhelper-backend-lwjgl3 = { group = "io.github.berstanio", name = "gdx-svmhelper-backend-lwjgl3", version.ref = "graalHelper" }
39+
gdx-svmhelper-extension-freetype = { group = "io.github.berstanio", name = "gdx-svmhelper-extension-freetype", version.ref = "graalHelper" }
40+
gdx-svmhelper-annotations = { group = "io.github.berstanio", name = "gdx-svmhelper-annotations", version.ref = "graalHelper" }
41+
42+
[plugins]
43+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
44+
badass-runtime = { id = "org.beryx.runtime", version.ref = "badassRuntime" }
45+
graalvm-native = { id = "org.graalvm.buildtools.native", version.ref = "graalvmNative" }

maptools/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dependencies {
22
implementation(project(":qcommon"))
3-
implementation("ch.qos.logback:logback-classic:1.4.14")
3+
implementation(libs.logback.classic)
44
}

settings.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
pluginManagement {
2+
repositories {
3+
mavenCentral()
4+
gradlePluginPortal()
5+
google()
6+
}
7+
}
8+
dependencyResolutionManagement {
9+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10+
repositories {
11+
mavenCentral()
12+
maven { url = uri("https://s01.oss.sonatype.org") }
13+
mavenLocal()
14+
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
15+
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") }
16+
maven { url = uri("https://jitpack.io") }
17+
google()
18+
}
19+
}
20+
121
rootProject.name = "jake2"
222
include (":qcommon")
323
include (":game")

0 commit comments

Comments
 (0)