Skip to content

Commit

Permalink
Add more info to manifest, fix tests running through gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed Nov 18, 2024
1 parent 87db039 commit c11a7cb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
6 changes: 4 additions & 2 deletions spatial-neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ neoForge {
create("spatial") {
modSourceSets.add(spatialLib.sourceSets.main)
}

create("spatial_test") {}
}

unitTest {
enable()
testedMod = mods.named("spatial")
testedMod = mods.named("spatial_test")
}

runs {
create("gameTestServer") {
this.type = "gameTestServer"
gameDirectory.set(file("runs/gametest"))

systemProperty("neoforge.enabledGameTestNamespaces", "spatial")
systemProperty("neoforge.enabledGameTestNamespaces", "spatial_test")

this.sourceSet = sourceSets.test
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@Mod(SpatialTestMod.MOD_ID)
public class SpatialTestMod {

public static final String MOD_ID = "spatialtest";
public static final String MOD_ID = "spatial_test";
private static final Logger LOGS = LogManager.getLogger("spatial");

public SpatialTestMod() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ loaderVersion = "${loader_version_range}"
license = "MIT"

[[mods]] #mandatory
modId = "spatial"
modId = "spatial_test"
version = "0.0.1"
displayName = "Spatial Test Mod"
authors = "RobotGryphon" #optional
Expand All @@ -16,14 +16,14 @@ displayURL = "https://compactmods.dev"
# logoFile="examplemod.png" #optional

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

[[dependencies.spatial]]
[[dependencies.spatial_test]]
modId = "minecraft"
type = "required"
versionRange = "${minecraft_version_range}"
Expand Down
26 changes: 25 additions & 1 deletion spatial/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import java.text.SimpleDateFormat
import java.util.*

var envVersion: String = System.getenv("VERSION") ?: "0.0.1"
if (envVersion.startsWith("v"))
envVersion = envVersion.trimStart('v')
Expand All @@ -13,7 +16,7 @@ plugins {
base {
archivesName = "spatial"
group = "dev.compactmods"
version = "0.1.0"
version = envVersion
}

java {
Expand All @@ -24,6 +27,27 @@ neoForge {
neoFormVersion = neoforged.versions.neoform
}

tasks.withType<Jar> {
val gitVersion = providers.exec {
commandLine("git", "rev-parse", "HEAD")
}.standardOutput.asText.get()

manifest {
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
attributes(
mapOf(
"Automatic-Module-Name" to "spatial",
"Specification-Title" to "Spatial",
"Specification-Version" to "1", // We are version 1 of ourselves
"Implementation-Title" to "Spatial",
"Implementation-Timestamp" to now,
"FMLModType" to "GAMELIBRARY",
"Minecraft-Version" to mojang.versions.minecraft.get(),
"Commit-Hash" to gitVersion
)
)
}
}

val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/spatial"
publishing {
Expand Down
2 changes: 0 additions & 2 deletions spatial/src/main/resources/META-INF/MANIFEST.MF

This file was deleted.

0 comments on commit c11a7cb

Please sign in to comment.