Skip to content

Commit 32f8fdc

Browse files
Fix hardcoded version in fabric.mod.json (#44)
* Fix hardcoded version in fabric.mod.json * Removed commit hash from version
1 parent 2ae0ec2 commit 32f8fdc

File tree

3 files changed

+15
-26
lines changed

3 files changed

+15
-26
lines changed

build.gradle

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ plugins {
66
id "io.gitlab.arturbosch.detekt" version "1.15.0"
77
id "com.github.jakemarsden.git-hooks" version "0.0.2"
88
id "com.github.johnrengelman.shadow" version "7.0.0"
9-
id 'org.ajoberstar.grgit' version '4.1.0'
109
}
1110

1211
sourceCompatibility = JavaVersion.VERSION_16
1312
targetCompatibility = JavaVersion.VERSION_16
1413

1514
archivesBaseName = project.archives_base_name
16-
version = "${project.mod_version}+${getVersionMetadata()}"
15+
version = project.mod_version+getVersionMetadata()
1716
group = project.maven_group
1817

1918
sourceSets {
@@ -203,21 +202,9 @@ def getVersionMetadata() {
203202

204203
// CI builds only
205204
if (build_id != null) {
206-
return "build.${build_id}"
207-
}
208-
209-
if (grgit != null) {
210-
def head = grgit.head()
211-
def id = head.abbreviatedId
212-
213-
// Flag the build if the build tree is not clean
214-
if (!grgit.status().clean) {
215-
id += "-dirty"
216-
}
217-
218-
return "rev.${id}"
205+
return "+build.${build_id}"
219206
}
220207

221208
// No tracking information could be found about the build
222-
return "unknown"
209+
return ""
223210
}

src/main/kotlin/com/github/quiltservertools/ledger/commands/subcommands/StatusCommand.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package com.github.quiltservertools.ledger.commands.subcommands
22

3-
import kotlinx.coroutines.launch
4-
import me.lucko.fabric.api.permissions.v0.Permissions
5-
import net.fabricmc.loader.api.FabricLoader
6-
import net.minecraft.server.command.CommandManager
7-
import net.minecraft.text.ClickEvent
8-
import net.minecraft.text.TranslatableText
93
import com.github.quiltservertools.ledger.Ledger
104
import com.github.quiltservertools.ledger.commands.BuildableCommand
115
import com.github.quiltservertools.ledger.commands.CommandConsts
@@ -15,6 +9,13 @@ import com.github.quiltservertools.ledger.utility.LiteralNode
159
import com.github.quiltservertools.ledger.utility.TextColorPallet
1610
import com.github.quiltservertools.ledger.utility.literal
1711
import com.github.quiltservertools.ledger.utility.translate
12+
import kotlinx.coroutines.launch
13+
import me.lucko.fabric.api.permissions.v0.Permissions
14+
import net.fabricmc.loader.api.FabricLoader
15+
import net.fabricmc.loader.api.SemanticVersion
16+
import net.minecraft.server.command.CommandManager
17+
import net.minecraft.text.ClickEvent
18+
import net.minecraft.text.TranslatableText
1819

1920
object StatusCommand : BuildableCommand {
2021
override fun build(): LiteralNode =
@@ -74,7 +75,7 @@ object StatusCommand : BuildableCommand {
7475
it.withClickEvent(
7576
ClickEvent(
7677
ClickEvent.Action.OPEN_URL,
77-
"https://quiltservertools.github.io/Ledger/${getVersion().friendlyString}/"
78+
"https://quiltservertools.github.io/Ledger/latest/"
7879
)
7980
)
8081
}
@@ -85,6 +86,7 @@ object StatusCommand : BuildableCommand {
8586
return 1
8687
}
8788

88-
private fun getVersion() =
89-
FabricLoader.getInstance().getModContainer(Ledger.MOD_ID).get().metadata.version
89+
private fun getVersion() = SemanticVersion.parse(
90+
FabricLoader.getInstance().getModContainer(Ledger.MOD_ID).get().metadata.version.friendlyString
91+
)
9092
}

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"id": "ledger",
4-
"version": "1.0.0",
4+
"version": "${version}",
55
"name": "Ledger",
66
"description": "Logs world events and allows for them to be rolled back",
77
"authors": [

0 commit comments

Comments
 (0)