Fix modrinth v2, introduce JfCommons
This commit is contained in:
parent
166b3e2124
commit
617a8cf9df
14
build.gradle
14
build.gradle
|
@ -14,6 +14,9 @@ application {
|
|||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'https://gitlab.com/api/v4/projects/35745143/packages/maven'
|
||||
}
|
||||
}
|
||||
|
||||
ext.currentVer = "0.0.0+nogit"
|
||||
|
@ -36,7 +39,7 @@ allprojects {
|
|||
|
||||
ext {
|
||||
lwjglVersion = '3.3.0'
|
||||
imguiVersion = '1.86.0'
|
||||
imguiVersion = '1.86.4'
|
||||
log4jVersion = '2.14.1'
|
||||
flavorProp = project.hasProperty('flavor') ? project.getProperty('flavor') : 'custom'
|
||||
flavor = flavorProp
|
||||
|
@ -59,10 +62,11 @@ if (flavor == 'custom') {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.code.gson:gson:2.8.9'
|
||||
implementation 'org.slf4j:slf4j-api:1.7.33'
|
||||
implementation 'ch.qos.logback:logback-classic:1.2.10'
|
||||
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r'
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
implementation 'org.slf4j:slf4j-api:1.7.36'
|
||||
implementation 'ch.qos.logback:logback-classic:1.2.11'
|
||||
implementation 'io.gitlab.jfronny:commons:0.1.0.2022.4.28.18.56.28'
|
||||
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.1.0.202203080745-r'
|
||||
implementation project(":wrapper")
|
||||
|
||||
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.gitlab.jfronny.inceptum.frontend.cli.commands;
|
||||
|
||||
import io.gitlab.jfronny.inceptum.Inceptum;
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingBiFunction;
|
||||
import io.gitlab.jfronny.inceptum.frontend.cli.BaseInstanceCommand;
|
||||
import io.gitlab.jfronny.inceptum.frontend.cli.Command;
|
||||
import io.gitlab.jfronny.inceptum.frontend.cli.CommandArgs;
|
||||
|
@ -9,9 +9,6 @@ import io.gitlab.jfronny.inceptum.model.inceptum.InstanceMeta;
|
|||
import io.gitlab.jfronny.inceptum.util.ModManager;
|
||||
import io.gitlab.jfronny.inceptum.util.PathUtil;
|
||||
import io.gitlab.jfronny.inceptum.util.Utils;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingBiFunction;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingFunction;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingSupplier;
|
||||
import io.gitlab.jfronny.inceptum.util.mds.IWModDescription;
|
||||
import io.gitlab.jfronny.inceptum.util.mds.ModsDirScanner;
|
||||
import io.gitlab.jfronny.inceptum.util.source.ModSource;
|
||||
|
|
|
@ -4,6 +4,7 @@ import imgui.ImGui;
|
|||
import imgui.type.ImBoolean;
|
||||
import imgui.type.ImInt;
|
||||
import imgui.type.ImString;
|
||||
import io.gitlab.jfronny.commons.tuple.Tuple;
|
||||
import io.gitlab.jfronny.inceptum.frontend.gui.window.GuiUtil;
|
||||
import io.gitlab.jfronny.inceptum.model.fabric.FabricVersionLoaderInfo;
|
||||
import io.gitlab.jfronny.inceptum.model.inceptum.InstanceMeta;
|
||||
|
@ -17,7 +18,6 @@ import io.gitlab.jfronny.inceptum.util.Utils;
|
|||
import io.gitlab.jfronny.inceptum.util.api.FabricMetaApi;
|
||||
import io.gitlab.jfronny.inceptum.util.api.McApi;
|
||||
import io.gitlab.jfronny.inceptum.util.cache.MemoryCache;
|
||||
import io.gitlab.jfronny.inceptum.util.tuple.Tuple;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package io.gitlab.jfronny.inceptum.frontend.gui.window.dialog;
|
||||
|
||||
import imgui.ImGui;
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingConsumer;
|
||||
import io.gitlab.jfronny.inceptum.Inceptum;
|
||||
import io.gitlab.jfronny.inceptum.frontend.gui.window.Window;
|
||||
import io.gitlab.jfronny.inceptum.util.ProcessState;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingConsumer;
|
||||
import org.eclipse.jgit.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -21,7 +21,7 @@ public class ProcessStateWatcherWindow extends Window {
|
|||
this.cancel = cancel;
|
||||
new Thread(() -> {
|
||||
try {
|
||||
executor.consume(canceled);
|
||||
executor.accept(canceled);
|
||||
if (canceled.get()) cancel.run();
|
||||
finished = true;
|
||||
} catch (Throwable e) {
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
package io.gitlab.jfronny.inceptum.frontend.gui.window.edit;
|
||||
|
||||
import imgui.ImGui;
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingBiConsumer;
|
||||
import io.gitlab.jfronny.inceptum.Inceptum;
|
||||
import io.gitlab.jfronny.inceptum.InceptumGui;
|
||||
import io.gitlab.jfronny.inceptum.frontend.gui.control.Tab;
|
||||
import io.gitlab.jfronny.inceptum.frontend.gui.window.dialog.ProcessStateWatcherWindow;
|
||||
import io.gitlab.jfronny.inceptum.util.InstanceExporter;
|
||||
import io.gitlab.jfronny.inceptum.util.ProcessState;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingBiConsumer;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ExportTab extends Tab {
|
||||
private final InstanceEditWindow window;
|
||||
|
@ -51,7 +49,7 @@ public class ExportTab extends Tab {
|
|||
ProcessState state = new ProcessState(InstanceExporter.STEP_COUNT, "Initializing...");
|
||||
InceptumGui.open(new ProcessStateWatcherWindow("Exporting", "Could not export pack", state, cToken -> {
|
||||
Path exportPath = Paths.get(p);
|
||||
export.consume(state, exportPath);
|
||||
export.accept(state, exportPath);
|
||||
Inceptum.showInfo(window.path.getFileName().toString() + " has been successfully exported to " + exportPath, "Successfully exported");
|
||||
}, null));
|
||||
}
|
||||
|
|
|
@ -27,9 +27,15 @@ public class ModrinthProject {
|
|||
public String source_url;
|
||||
public String wiki_url;
|
||||
public String discord_url;
|
||||
public List<String> donation_urls;
|
||||
public List<DonationUrl> donation_urls;
|
||||
public List<GalleryItem> gallery;
|
||||
|
||||
public static class DonationUrl {
|
||||
public String id;
|
||||
public String platform;
|
||||
public String url;
|
||||
}
|
||||
|
||||
public static class License {
|
||||
public String id;
|
||||
public String name;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package io.gitlab.jfronny.inceptum.util.mds;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingConsumer;
|
||||
import io.gitlab.jfronny.inceptum.model.fabric.FabricModJson;
|
||||
import io.gitlab.jfronny.inceptum.model.inceptum.ModDescription;
|
||||
import io.gitlab.jfronny.inceptum.util.PathUtil;
|
||||
import io.gitlab.jfronny.inceptum.util.Utils;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingConsumer;
|
||||
import io.gitlab.jfronny.inceptum.util.source.ModSource;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -83,7 +83,7 @@ public record FileScanTask(Path file, BiConsumer<Path, IWModDescription> discove
|
|||
imodFile = newImod;
|
||||
modified = true;
|
||||
}
|
||||
if (modified) imodModified.consume(imodFile);
|
||||
if (modified) imodModified.accept(imodFile);
|
||||
}
|
||||
|
||||
private Optional<FabricModJson> getFmj(Path modJarDefault, ModDescription md) throws IOException, URISyntaxException {
|
||||
|
|
|
@ -3,13 +3,14 @@ package io.gitlab.jfronny.inceptum.util.mds;
|
|||
import io.gitlab.jfronny.inceptum.model.inceptum.InstanceMeta;
|
||||
import io.gitlab.jfronny.inceptum.util.PathUtil;
|
||||
import io.gitlab.jfronny.inceptum.util.Utils;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingConsumer;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import static java.nio.file.StandardWatchEventKinds.*;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.gitlab.jfronny.inceptum.util.source;
|
||||
|
||||
import io.gitlab.jfronny.commons.tuple.Triple;
|
||||
import io.gitlab.jfronny.commons.tuple.Tuple;
|
||||
import io.gitlab.jfronny.inceptum.model.curseforge.CurseforgeDependency;
|
||||
import io.gitlab.jfronny.inceptum.model.curseforge.CurseforgeFile;
|
||||
import io.gitlab.jfronny.inceptum.model.curseforge.CurseforgeMod;
|
||||
|
@ -7,8 +9,6 @@ import io.gitlab.jfronny.inceptum.util.HashUtils;
|
|||
import io.gitlab.jfronny.inceptum.util.Utils;
|
||||
import io.gitlab.jfronny.inceptum.util.api.CurseforgeApi;
|
||||
import io.gitlab.jfronny.inceptum.util.cache.MemoryCache;
|
||||
import io.gitlab.jfronny.inceptum.util.tuple.Triple;
|
||||
import io.gitlab.jfronny.inceptum.util.tuple.Tuple;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package io.gitlab.jfronny.inceptum.util.source;
|
||||
|
||||
import io.gitlab.jfronny.commons.tuple.Tuple;
|
||||
import io.gitlab.jfronny.inceptum.model.modrinth.ModrinthProject;
|
||||
import io.gitlab.jfronny.inceptum.model.modrinth.ModrinthVersion;
|
||||
import io.gitlab.jfronny.inceptum.util.HashUtils;
|
||||
import io.gitlab.jfronny.inceptum.util.Utils;
|
||||
import io.gitlab.jfronny.inceptum.util.api.ModrinthApi;
|
||||
import io.gitlab.jfronny.inceptum.util.cache.MemoryCache;
|
||||
import io.gitlab.jfronny.inceptum.util.tuple.Tuple;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
|
|
@ -12,12 +12,16 @@ application {
|
|||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'https://gitlab.com/api/v4/projects/35745143/packages/maven'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.code.gson:gson:2.8.9'
|
||||
implementation 'org.slf4j:slf4j-api:1.7.32'
|
||||
implementation 'ch.qos.logback:logback-classic:1.2.10'
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
implementation 'org.slf4j:slf4j-api:1.7.36'
|
||||
implementation 'ch.qos.logback:logback-classic:1.2.11'
|
||||
implementation 'io.gitlab.jfronny:commons:0.1.0.2022.4.28.18.56.28'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package io.gitlab.jfronny.inceptum.util;
|
||||
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingConsumer;
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingSupplier;
|
||||
import io.gitlab.jfronny.inceptum.WrapperStrap;
|
||||
import io.gitlab.jfronny.inceptum.gson.GsonHolder;
|
||||
import io.gitlab.jfronny.inceptum.model.OSType;
|
||||
import io.gitlab.jfronny.inceptum.util.cache.GsonFileCache;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingConsumer;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingSupplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -255,7 +255,7 @@ public class Utils {
|
|||
|
||||
public static <TEx extends Exception> void ls(Path dir, ThrowingConsumer<Path, TEx> consumer) throws IOException, TEx {
|
||||
try (Stream<Path> sp = Files.list(dir)) {
|
||||
for (Path path : sp.toList()) consumer.consume(path);
|
||||
for (Path path : sp.toList()) consumer.accept(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.gitlab.jfronny.inceptum.util.cache;
|
||||
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingSupplier;
|
||||
import io.gitlab.jfronny.inceptum.util.Utils;
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingSupplier;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.gitlab.jfronny.inceptum.util.cache;
|
||||
|
||||
import io.gitlab.jfronny.inceptum.util.lambda.ThrowingSupplier;
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingSupplier;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.lambda;
|
||||
|
||||
public interface ThrowingBiConsumer<T, U, TEx extends Throwable> {
|
||||
void consume(T var1, U var2) throws TEx;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.lambda;
|
||||
|
||||
public interface ThrowingBiFunction<TIn, UIn, TOut, TEx extends Throwable> {
|
||||
TOut apply(TIn var1, UIn var2) throws TEx;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.lambda;
|
||||
|
||||
public interface ThrowingConsumer<T, TEx extends Throwable> {
|
||||
void consume(T var) throws TEx;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.lambda;
|
||||
|
||||
public interface ThrowingFunction<TIn, TOut, TEx extends Throwable> {
|
||||
TOut apply(TIn var) throws TEx;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.lambda;
|
||||
|
||||
public interface ThrowingRunnable<TEx extends Throwable> {
|
||||
void run() throws TEx;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.lambda;
|
||||
|
||||
public interface ThrowingSupplier<T, TEx extends Throwable> {
|
||||
T get() throws TEx;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.tuple;
|
||||
|
||||
public record Quadruple<T1, T2, T3, T4>(T1 val1, T2 val2, T3 val3, T4 val4) {
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.tuple;
|
||||
|
||||
public record Single<T1>(T1 val1) {
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.tuple;
|
||||
|
||||
public record Triple<T1, T2, T3>(T1 val1, T2 val2, T3 val3) {
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package io.gitlab.jfronny.inceptum.util.tuple;
|
||||
|
||||
public record Tuple<T1, T2>(T1 val1, T2 val2) {
|
||||
public static <T1> Single<T1> of(T1 val1) {
|
||||
return new Single<>(val1);
|
||||
}
|
||||
|
||||
public static <T1, T2> Tuple<T1, T2> of(T1 left, T2 right) {
|
||||
return new Tuple<>(left, right);
|
||||
}
|
||||
|
||||
public static <T1, T2, T3> Triple<T1, T2, T3> of(T1 t1, T2 t2, T3 t3) {
|
||||
return new Triple<>(t1, t2, t3);
|
||||
}
|
||||
|
||||
public static <T1, T2, T3, T4> Quadruple<T1, T2, T3, T4> of(T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
return new Quadruple<>(t1, t2, t3, t4);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue