Skip to content

Commit

Permalink
Add commit hash, slf4j
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Jan 30, 2022
1 parent c1f1c91 commit a978d9b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions brachyurabootstrapconf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ https://github.com/CoolCrabs/brachyura/releases/download/v_a88bbf1dc3304d5be5d3f
https://github.com/CoolCrabs/brachyura/releases/download/v_a88bbf1dc3304d5be5d3f8790723bfd1c0cd07bb/brachyura-mixin-compile-extensions-0.4-sources.jar 915937729F65FB050A456AC41E97195EF69E6046 brachyura-mixin-compile-extensions-0.4-sources.jar false
https://github.com/CoolCrabs/brachyura/releases/download/v_a88bbf1dc3304d5be5d3f8790723bfd1c0cd07bb/trieharder-0.2.0.jar 6F64E056E6412EC7F287CC21B4081C59F1C6A533 trieharder-0.2.0.jar true
https://github.com/CoolCrabs/brachyura/releases/download/v_a88bbf1dc3304d5be5d3f8790723bfd1c0cd07bb/trieharder-0.2.0-sources.jar AC68B3CBE5683194A2DA69C7DE8219597F2430DD trieharder-0.2.0-sources.jar false
https://repo.eclipse.org/content/groups/releases/org/eclipse/jgit/org.eclipse.jgit/6.0.0.202111291000-r/org.eclipse.jgit-6.0.0.202111291000-r.jar a6184d0441ad4a912f73c2f9e14f2fe3826b9306 org.eclipse.jgit-6.0.0.202111291000-r.jar true
https://repo.eclipse.org/content/groups/releases/org/eclipse/jgit/org.eclipse.jgit/6.0.0.202111291000-r/org.eclipse.jgit-6.0.0.202111291000-r-sources.jar 81144d5f8866f92fdd93cae624e4f38d6ff92320 org.eclipse.jgit-6.0.0.202111291000-r-sources.jar false
https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.35/slf4j-api-1.7.35.jar 517f3a0687490b72d0e56d815e05608a541af802 slf4j-api-1.7.35.jar true
https://github.com/CoolCrabs/brachyura/releases/download/v_a88bbf1dc3304d5be5d3f8790723bfd1c0cd07bb/fernutil-0.2.jar 1EE8EA1EC01CC6C2958EBC2578A804DF610F9C0B fernutil-0.2.jar true
https://github.com/CoolCrabs/brachyura/releases/download/v_a88bbf1dc3304d5be5d3f8790723bfd1c0cd07bb/fernutil-0.2-sources.jar 4CB9223A2CD1AF04DB524BCBFC318773947B1B85 fernutil-0.2-sources.jar false
https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.2/asm-9.2.jar 81a03f76019c67362299c40e0ba13405f5467bff asm-9.2.jar true
Expand Down
23 changes: 21 additions & 2 deletions buildscript/src/main/java/Buildscript.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
import net.fabricmc.mappingio.tree.MappingTree;
import net.fabricmc.mappingio.tree.MemoryMappingTree;
import net.fabricmc.tinyremapper.TinyRemapper;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;

public class Buildscript extends FabricProject {
static final boolean SODIUM = true;
Expand Down Expand Up @@ -91,7 +94,7 @@ public void getModDependencies(ModDependencyCollector d) {
if (SODIUM) {
// d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.16.5-0.2.0"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME); // TOOD missing sha1 hash
try {
Path target = getLocalBrachyuraPath().resolve("sodium1.16.5-0.2.0.jar");
Path target = getLocalBrachyuraPath().resolve("sodium1.16.5-0.2.0.jar");
if (!Files.exists(target)) {
try (
AtomicFile f = new AtomicFile(target);
Expand Down Expand Up @@ -184,6 +187,22 @@ public JavaJarDependency build() {
}
}

@Override
public Path getBuildJarPath() {
Repository repository = null;
String commitHash = "";
try {
repository = Git.open(getProjectDir().toFile()).getRepository();
commitHash = repository.parseCommit(repository.resolve(Constants.HEAD).toObjectId()).getName().substring(0, 8);
repository.close();
} catch (IOException e) {
e.printStackTrace();
}


return getBuildLibsDir().resolve(getModId() + "-" + getVersion() + "-" + commitHash + ".jar");
}

@Override
public IdeProject getIdeProject() {
Path cwd = PathUtil.resolveAndCreateDir(getProjectDir(), "run");
Expand Down Expand Up @@ -247,4 +266,4 @@ public IdeProject getIdeProject() {
)
.build();
}
}
}

0 comments on commit a978d9b

Please sign in to comment.