Skip to content

Commit

Permalink
Update 1.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox2Code committed Jul 8, 2023
1 parent 6cbeb97 commit 58493e5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies {
api 'org.ow2.asm:asm-commons:9.5'
api 'org.semver4j:semver4j:4.3.0'
api 'org.spongepowered:mixin:0.8.5'
api 'com.github.LlamaLad7.MixinExtras:mixinextras-common:0.2.0-beta.8'
api 'com.github.LlamaLad7.MixinExtras:mixinextras-common:0.2.0-beta.9'
api 'org.luaj:luaj-jse:3.0.1'

// Mixin dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ GSON_DEPENDENCY, new Dependency("com.google.guava:guava:21.0", MAVEN_CENTRAL, "c
new Dependency("org.apache.commons:commons-lang3:3.3.2", MAVEN_CENTRAL, "org.apache.commons.lang3.tuple.Pair"),
new Dependency("org.luaj:luaj-jse:3.0.1", MAVEN_CENTRAL, "org.luaj.vm2.Globals"),
new Dependency("org.spongepowered:mixin:0.8.5", SPONGE_POWERED, "org.spongepowered.asm.mixin.Mixins"),
new Dependency("com.github.LlamaLad7.MixinExtras:mixinextras-common:0.2.0-beta.8",
JITPACK, "com.llamalad7.mixinextras.MixinExtrasBootstrap"),
new Dependency("com.github.LlamaLad7.MixinExtras:mixinextras-common:0.2.0-beta.9",
JITPACK, "com.llamalad7.mixinextras.MixinExtrasBootstrap",
// Need fallback URL cause JitPack links can ded at any time
"https://github.com/LlamaLad7/MixinExtras/releases/download/0.2.0-beta.9/mixinextras-common-0.2.0-beta.9.jar"),
};

public static final Dependency sparkDependency =
Expand Down Expand Up @@ -142,13 +144,27 @@ private static File loadDependencyImpl(Dependency dependency, boolean minecraft,
if (!parentFile.isDirectory() && !parentFile.mkdirs()) {
throw new RuntimeException("Cannot create dependency directory for " + dependency.name);
}
IOException fallBackIoe = null;
try (OutputStream os = Files.newOutputStream(file.toPath())) {
justDownloaded = true;
NetUtils.downloadTo(new URL(dependency.repository.endsWith(".jar") ?
dependency.repository : dependency.repository + "/" + postURL), os);
} catch (IOException ioe) {
if (file.exists() && !file.delete()) file.deleteOnExit();
throw new RuntimeException("Cannot download " + dependency.name, ioe);
if (dependency.fallbackUrl != null) {
fallBackIoe = ioe;
} else {
if (file.exists() && !file.delete()) file.deleteOnExit();
throw new RuntimeException("Cannot download " + dependency.name, ioe);
}
}
if (fallBackIoe != null) {
try (OutputStream os = Files.newOutputStream(file.toPath())) {
justDownloaded = true;
NetUtils.downloadTo(new URL(dependency.fallbackUrl), os);
} catch (IOException ioe) {
if (file.exists() && !file.delete()) file.deleteOnExit();
throw new RuntimeException("Cannot download " + dependency.name, fallBackIoe);
}
}
}
if (dev) return file; // We don't have a FoxClass loader in dev environment.
Expand Down Expand Up @@ -286,12 +302,17 @@ private static String resolvePostURL(String string) {
}

public static class Dependency {
public final String name, repository, classCheck;
public final String name, repository, classCheck, fallbackUrl;

public Dependency(String name, String repository, String classCheck) {
this(name, repository, classCheck, null);
}

public Dependency(String name, String repository, String classCheck, String fallbackUrl) {
this.name = name;
this.repository = repository;
this.classCheck = classCheck;
this.fallbackUrl = fallbackUrl;
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.parallel=true
org.gradle.jvmargs=-Xmx1024m -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8

# FoxLoader properties
foxloader.version=1.2.9
foxloader.version=1.2.10
foxloader.lastReIndevTransformerChanges=1.2.4

# ReIndev properties
Expand Down

0 comments on commit 58493e5

Please sign in to comment.