Skip to content

Commit 4050393

Browse files
authored
refactor: Migrate to Gradle version catalog
2 parents cda9b5c + 7e7b179 commit 4050393

6 files changed

Lines changed: 63 additions & 29 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
pull_request:
78
workflow_dispatch:
89
inputs:
910
version:

build.gradle.kts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id("fabric-loom") version "1.12-SNAPSHOT"
2+
alias(libs.plugins.fabric.loom)
33
}
44

55
base {
66
archivesName = properties["archives_base_name"] as String
7-
version = properties["mod_version"] as String
7+
version = libs.versions.mod.version.get()
88
group = properties["maven_group"] as String
99
}
1010

@@ -18,40 +18,38 @@ repositories {
1818
name = "meteor-maven-snapshots"
1919
url = uri("https://maven.meteordev.org/snapshots")
2020
}
21-
flatDir {
22-
dirs("libs")
23-
}
2421
}
2522

2623
dependencies {
27-
// Fabric
28-
minecraft("com.mojang:minecraft:${properties["minecraft_version"] as String}")
29-
mappings("net.fabricmc:yarn:${properties["yarn_mappings"] as String}:v2")
30-
modImplementation("net.fabricmc:fabric-loader:${properties["loader_version"] as String}")
31-
32-
// Meteor - using local JAR for consistent version
33-
modImplementation(files("libs/meteor-client-${properties["meteor_version"] as String}.jar"))
24+
// Minecraft
25+
minecraft(libs.minecraft)
26+
mappings(variantOf(libs.yarn) { classifier("v2") })
27+
modImplementation(libs.fabric.loader)
3428

35-
// Compile-time access to Orbit event bus (provided by Meteor at runtime)
36-
compileOnly("meteordevelopment:orbit:0.2.4")
29+
// Meteor Client
30+
modImplementation(libs.meteor.client)
31+
compileOnly(libs.orbit)
3732

3833
// NanoHTTPD for HTTP server and WebSocket support
39-
modImplementation("org.nanohttpd:nanohttpd:2.3.1")!!.let { include(it) }
40-
modImplementation("org.nanohttpd:nanohttpd-websocket:2.3.1")!!.let { include(it) }
34+
modImplementation(libs.nanohttpd.core)
35+
include(libs.nanohttpd.core)
36+
modImplementation(libs.nanohttpd.websocket)
37+
include(libs.nanohttpd.websocket)
4138

4239
// JSON serialization for WebSocket messages
43-
modImplementation("com.google.code.gson:gson:2.11.0")!!.let { include(it) }
40+
modImplementation(libs.gson)
41+
include(libs.gson)
4442

4543
// Testing
46-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
47-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
44+
testImplementation(libs.junit.api)
45+
testRuntimeOnly(libs.junit.engine)
4846
}
4947

5048
tasks {
5149
processResources {
5250
val propertyMap = mapOf(
5351
"version" to project.version,
54-
"mc_version" to project.property("minecraft_version"),
52+
"mc_version" to libs.versions.minecraft.get(),
5553
)
5654

5755
inputs.properties(propertyMap)

gradle.properties

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
org.gradle.jvmargs=-Xmx4G
22
org.gradle.configuration-cache=false
33

4-
# Fabric Properties (https://fabricmc.net/develop)
5-
minecraft_version=1.21.10
6-
yarn_mappings=1.21.10+build.2
7-
loader_version=0.17.3
8-
94
# Mod Properties
10-
mod_version=0.2.0
115
maven_group=com.cope.meteorwebgui
126
archives_base_name=meteor-webgui
13-
14-
# Dependencies
15-
meteor_version=1.21.10-32

gradle/libs.versions.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[versions]
2+
# Mod Properties
3+
mod-version = "0.2.0"
4+
5+
# Minecraft
6+
minecraft = "1.21.10"
7+
yarn-mappings = "1.21.10+build.2"
8+
fabric-loader = "0.17.3"
9+
loom = "1.12-SNAPSHOT"
10+
11+
# Dependencies
12+
meteor = "1.21.10-SNAPSHOT"
13+
orbit = "0.2.4"
14+
15+
# WebServer and WebSocket
16+
nanohttpd = "2.3.1"
17+
gson = "2.11.0"
18+
19+
# Testing
20+
junit = "5.10.2"
21+
22+
[libraries]
23+
# Minecraft
24+
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
25+
yarn = { module = "net.fabricmc:yarn", version.ref = "yarn-mappings" }
26+
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" }
27+
28+
# Meteor
29+
meteor-client = { module = "meteordevelopment:meteor-client", version.ref = "meteor" }
30+
orbit = { module = "meteordevelopment:orbit", version.ref = "orbit" }
31+
32+
# WebServer
33+
nanohttpd-core = { module = "org.nanohttpd:nanohttpd", version.ref = "nanohttpd" }
34+
nanohttpd-websocket = { module = "org.nanohttpd:nanohttpd-websocket", version.ref = "nanohttpd" }
35+
36+
# JSON
37+
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
38+
39+
# Testing
40+
junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
41+
junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
42+
43+
[plugins]
44+
fabric-loom = { id = "fabric-loom", version.ref = "loom" }

libs/meteor-client-1.21.10-32.jar

-4.45 MB
Binary file not shown.

libs/meteor-client-1.21.8-56.jar

-4.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)