DH Jar now knows git version that it was built from
This commit is contained in:
+27
-7
@@ -326,13 +326,17 @@ subprojects { p ->
|
||||
// Put stuff from gradle.properties into the mod info
|
||||
processResources {
|
||||
def resourceTargets = [ // Location of where to inject the properties
|
||||
// Properties for each of the loaders
|
||||
"fabric.mod.json",
|
||||
"quilt.mod.json",
|
||||
"META-INF/mods.toml",
|
||||
// Holds info like git commit
|
||||
// TODO: For some reason this script doesnt work with the core project
|
||||
"build_info.json",
|
||||
|
||||
// The mixins for each of the loaders
|
||||
"DistantHorizons."+ p.name +".fabricLike.mixins.json"
|
||||
// Properties for each of the loaders
|
||||
"fabric.mod.json",
|
||||
"quilt.mod.json",
|
||||
"META-INF/mods.toml",
|
||||
|
||||
// The mixins for each of the loaders
|
||||
"DistantHorizons."+ p.name +".fabricLike.mixins.json"
|
||||
]
|
||||
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||
|
||||
@@ -355,6 +359,18 @@ subprojects { p ->
|
||||
// TODOI: Find something we can use so we can basically re-map only when the jar is shadowed and relocated
|
||||
// println p.tasks.findByName('shadowJar')
|
||||
|
||||
// Gets git info for the project
|
||||
def git_main_commit = "Git_not_found"
|
||||
def git_core_commit = "Git_not_found"
|
||||
def git_main_branch = "Git_not_found"
|
||||
try {
|
||||
"git rev-parse --is-inside-work-tree".execute() // If git doesnt exist, or this isnt cloned from git, then this wont work
|
||||
git_main_commit = 'git rev-parse --verify HEAD'.execute().text.trim()
|
||||
git_core_commit = 'git ls-tree --object-only HEAD coreSubProjects'.execute().text.trim()
|
||||
git_main_branch = 'git symbolic-ref --short HEAD'.execute().text.trim()
|
||||
} catch (Exception e) {
|
||||
println "Git or Git project not found"
|
||||
}
|
||||
|
||||
def replaceProperties = [
|
||||
version : mod_version,
|
||||
@@ -370,7 +386,11 @@ subprojects { p ->
|
||||
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||
compatible_forgemc_versions : compatible_forgemc_versions,
|
||||
java_version : java_version,
|
||||
quilt_contributors : "{"+quilt_contributors.join(", ")+"}"
|
||||
quilt_contributors : "{"+quilt_contributors.join(", ")+"}",
|
||||
|
||||
git_main_commit : git_main_commit,
|
||||
git_core_commit : git_core_commit,
|
||||
git_main_branch : git_main_branch
|
||||
]
|
||||
// The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"git_main_commit": "${git_main_commit}",
|
||||
"git_core_commit": "${git_core_commit}",
|
||||
"git_main_branch": "${git_main_branch}"
|
||||
}
|
||||
@@ -22,6 +22,7 @@ package com.seibel.distanthorizons.fabric;
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent;
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent;
|
||||
import com.seibel.distanthorizons.core.config.ConfigBase;
|
||||
import com.seibel.distanthorizons.core.jar.ModGitInfo;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*;
|
||||
import com.seibel.distanthorizons.common.LodCommonMain;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
@@ -72,6 +73,11 @@ public class FabricMain
|
||||
FabricDependencySetup.createInitialBindings();
|
||||
LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||
|
||||
// Print git info (Useful for dev builds)
|
||||
LOGGER.info("DH Branch: "+ ModGitInfo.Git_Main_Branch);
|
||||
LOGGER.info("DH Commit: "+ ModGitInfo.Git_Main_Commit);
|
||||
LOGGER.info("DH-Core Commit: "+ ModGitInfo.Git_Core_Commit);
|
||||
|
||||
if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium")) {
|
||||
ModAccessorInjector.INSTANCE.bind(ISodiumAccessor.class, new SodiumAccessor());
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.seibel.distanthorizons.common.forge.LodForgeMethodCaller;
|
||||
import com.seibel.distanthorizons.common.wrappers.DependencySetup;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.jar.ModGitInfo;
|
||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import com.seibel.distanthorizons.core.ReflectionHandler;
|
||||
@@ -112,6 +113,11 @@ public class ForgeMain implements LodForgeMethodCaller
|
||||
ForgeDependencySetup.createInitialBindings();
|
||||
LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||
|
||||
// Print git info (Useful for dev builds)
|
||||
LOGGER.info("DH Branch: "+ ModGitInfo.Git_Main_Branch);
|
||||
LOGGER.info("DH Commit: "+ ModGitInfo.Git_Main_Commit);
|
||||
LOGGER.info("DH-Core Commit: "+ ModGitInfo.Git_Core_Commit);
|
||||
|
||||
client_proxy = new ForgeClientProxy();
|
||||
MinecraftForge.EVENT_BUS.register(client_proxy);
|
||||
server_proxy = new ForgeServerProxy(false);
|
||||
|
||||
Reference in New Issue
Block a user