Extend UpdateChecker logging
This commit is contained in:
parent
38392dc9e2
commit
6e473a19ee
|
@ -49,7 +49,7 @@ public class UpdateCheckCommand extends Command {
|
|||
Inceptum.LOGGER.error("No stable version was found, switching to experimental channel");
|
||||
Inceptum.CONFIG.channel = channel;
|
||||
Inceptum.saveConfig();
|
||||
}, Inceptum.LOGGER::error, Inceptum.LOGGER::error);
|
||||
}, Inceptum.LOGGER::info, Inceptum.LOGGER::error, Inceptum.LOGGER::error);
|
||||
}
|
||||
|
||||
public static void update(UpdateInfo source, boolean relaunch) throws IOException, URISyntaxException {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.gitlab.jfronny.inceptum.windows;
|
||||
|
||||
import imgui.ImGui;
|
||||
import io.gitlab.jfronny.inceptum.Inceptum;
|
||||
|
||||
public class AboutWindow extends Window {
|
||||
public AboutWindow() {
|
||||
|
@ -9,7 +10,7 @@ public class AboutWindow extends Window {
|
|||
|
||||
@Override
|
||||
public void draw() {
|
||||
ImGui.text("Inceptum Copyright (C) 2021 JFronny");
|
||||
ImGui.text("Inceptum " + Inceptum.VERSION.version + " Copyright (C) 2021 JFronny");
|
||||
ImGui.text("This program comes with ABSOLUTELY NO WARRANTY.");
|
||||
ImGui.text("This is free software, and you are welcome to redistribute it under certain conditions.");
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Wrapper {
|
|||
p = p.resolve("run/libraries/io/gitlab/jfronny/inceptum/Inceptum");
|
||||
if (!Files.exists(p)) {
|
||||
System.err.println("No Inceptum jar was identified");
|
||||
UpdateInfo ui = UpdateChecker.check(UpdateChannel.Stable, new ComparableVersion("0"), OSCheck.OS.getMojName(), c -> {}, System.err::println, (s, e) -> {
|
||||
UpdateInfo ui = UpdateChecker.check(UpdateChannel.Stable, new ComparableVersion("0"), OSCheck.OS.getMojName(), c -> {}, System.out::println, System.err::println, (s, e) -> {
|
||||
e.printStackTrace();
|
||||
System.err.println(s);
|
||||
});
|
||||
|
|
|
@ -16,9 +16,12 @@ import java.util.function.Consumer;
|
|||
public class UpdateChecker {
|
||||
private static final long PROJECT_ID = 30862253L;
|
||||
|
||||
public static UpdateInfo check(UpdateChannel channel, ComparableVersion current, String flavor, Consumer<UpdateChannel> channelInvalid, Consumer<String> error, BiConsumer<String, Exception> showError) {
|
||||
public static UpdateInfo check(UpdateChannel channel, ComparableVersion current, String flavor, Consumer<UpdateChannel> channelInvalid, Consumer<String> out, Consumer<String> error, BiConsumer<String, Exception> showError) {
|
||||
try {
|
||||
if (flavor.equals("custom")) return null;
|
||||
if (flavor.equals("custom")) {
|
||||
out.accept("Custom build, skipping update check");
|
||||
return null;
|
||||
}
|
||||
GitlabProject project = GitlabApi.getProject(PROJECT_ID);
|
||||
PackageInfo experimental = null;
|
||||
PackageInfo stable = null;
|
||||
|
@ -45,7 +48,11 @@ public class UpdateChecker {
|
|||
case CI -> experimental;
|
||||
case Stable -> stable;
|
||||
};
|
||||
if (current.compareTo(new ComparableVersion(info.version)) >= 0) return null;
|
||||
out.accept("Latest version is " + info.version + ", current is " + current);
|
||||
if (current.compareTo(new ComparableVersion(info.version)) >= 0) {
|
||||
out.accept("Up-to-date");
|
||||
return null;
|
||||
}
|
||||
PackageFileInfo file = GitlabApi.getFile(project, info, f -> f.file_name.endsWith('-' + flavor + ".jar"));
|
||||
if (file == null)
|
||||
error.accept("No valid package was discovered");
|
||||
|
|
Loading…
Reference in New Issue