Skip to content

Commit c11a7cb

Browse files
committed
Add more info to manifest, fix tests running through gradle
1 parent 87db039 commit c11a7cb

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

spatial-neoforge/build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ neoForge {
2525
create("spatial") {
2626
modSourceSets.add(spatialLib.sourceSets.main)
2727
}
28+
29+
create("spatial_test") {}
2830
}
2931

3032
unitTest {
3133
enable()
32-
testedMod = mods.named("spatial")
34+
testedMod = mods.named("spatial_test")
3335
}
3436

3537
runs {
3638
create("gameTestServer") {
3739
this.type = "gameTestServer"
3840
gameDirectory.set(file("runs/gametest"))
3941

40-
systemProperty("neoforge.enabledGameTestNamespaces", "spatial")
42+
systemProperty("neoforge.enabledGameTestNamespaces", "spatial_test")
4143

4244
this.sourceSet = sourceSets.test
4345
}

spatial-neoforge/src/test/java/dev/compactmods/spatial/test/core/SpatialTestMod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@Mod(SpatialTestMod.MOD_ID)
88
public class SpatialTestMod {
99

10-
public static final String MOD_ID = "spatialtest";
10+
public static final String MOD_ID = "spatial_test";
1111
private static final Logger LOGS = LogManager.getLogger("spatial");
1212

1313
public SpatialTestMod() {

spatial-neoforge/src/test/resources/META-INF/neoforge.mods.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ loaderVersion = "${loader_version_range}"
33
license = "MIT"
44

55
[[mods]] #mandatory
6-
modId = "spatial"
6+
modId = "spatial_test"
77
version = "0.0.1"
88
displayName = "Spatial Test Mod"
99
authors = "RobotGryphon" #optional
@@ -16,14 +16,14 @@ displayURL = "https://compactmods.dev"
1616
# logoFile="examplemod.png" #optional
1717

1818
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
19-
[[dependencies.spatial]] #optional
19+
[[dependencies.spatial_test]] #optional
2020
modId = "neoforge"
2121
type = "required"
2222
versionRange = "${neo_version_range}"
2323
ordering = "NONE"
2424
side = "BOTH"
2525

26-
[[dependencies.spatial]]
26+
[[dependencies.spatial_test]]
2727
modId = "minecraft"
2828
type = "required"
2929
versionRange = "${minecraft_version_range}"

spatial/build.gradle.kts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import java.text.SimpleDateFormat
2+
import java.util.*
3+
14
var envVersion: String = System.getenv("VERSION") ?: "0.0.1"
25
if (envVersion.startsWith("v"))
36
envVersion = envVersion.trimStart('v')
@@ -13,7 +16,7 @@ plugins {
1316
base {
1417
archivesName = "spatial"
1518
group = "dev.compactmods"
16-
version = "0.1.0"
19+
version = envVersion
1720
}
1821

1922
java {
@@ -24,6 +27,27 @@ neoForge {
2427
neoFormVersion = neoforged.versions.neoform
2528
}
2629

30+
tasks.withType<Jar> {
31+
val gitVersion = providers.exec {
32+
commandLine("git", "rev-parse", "HEAD")
33+
}.standardOutput.asText.get()
34+
35+
manifest {
36+
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
37+
attributes(
38+
mapOf(
39+
"Automatic-Module-Name" to "spatial",
40+
"Specification-Title" to "Spatial",
41+
"Specification-Version" to "1", // We are version 1 of ourselves
42+
"Implementation-Title" to "Spatial",
43+
"Implementation-Timestamp" to now,
44+
"FMLModType" to "GAMELIBRARY",
45+
"Minecraft-Version" to mojang.versions.minecraft.get(),
46+
"Commit-Hash" to gitVersion
47+
)
48+
)
49+
}
50+
}
2751

2852
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/spatial"
2953
publishing {

spatial/src/main/resources/META-INF/MANIFEST.MF

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

0 commit comments

Comments
 (0)