Skip to content

Commit

Permalink
Set compression level
Browse files Browse the repository at this point in the history
Minor cleanups
Bump ASM
  • Loading branch information
LexManos committed Dec 2, 2024
1 parent b6fa390 commit f298a56
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
14 changes: 7 additions & 7 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ dependencyResolutionManagement {
library('nulls', 'org.jetbrains:annotations:24.0.1')
library('powermock', 'org.powermock:powermock-core:2.0.9')

version('asm', '9.7')
version('asm', '9.7.1')
library('asm', 'org.ow2.asm', 'asm' ).versionRef('asm')
library('asm-commons', 'org.ow2.asm', 'asm-commons').versionRef('asm')
library('asm-tree', 'org.ow2.asm', 'asm-tree' ).versionRef('asm')
bundle('asm', ['asm', 'asm-commons', 'asm-tree'])
version('junit', '5.10.1')
library('junit-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
library('junit-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit')
library('junit-platform-launcher', 'org.junit.platform:junit-platform-launcher:1.10.1')
bundle('junit-runtime', ['junit-engine', 'junit-platform-launcher'])

version('junit', '5.10.1')
library('junit-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
library('junit-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit')
library('junit-platform-launcher', 'org.junit.platform:junit-platform-launcher:1.10.1')
bundle('junit-runtime', ['junit-engine', 'junit-platform-launcher'])
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/minecraftforge/fart/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static void main(String[] args) throws IOException {
};
if (options.has(logO)) {
PrintStream out = System.out;
@SuppressWarnings("resource")
PrintStream file = new PrintStream(new FileOutputStream(options.valueOf(logO)));
log = ln -> {
if (!ln.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.util.ArrayList;
import java.util.List;

import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/net/minecraftforge/fart/internal/RenamerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
Expand All @@ -37,6 +36,7 @@ class RenamerImpl implements Renamer {
private final List<ClassProvider> classProviders;
private final int threads;
private final Consumer<String> logger;
@SuppressWarnings("unused")
private final Consumer<String> debug;
private boolean setup = false;
private ClassProvider libraryClasses;
Expand Down Expand Up @@ -70,12 +70,16 @@ public void run(File input, File output) {
if (!this.setup)
this.setup();

input = Objects.requireNonNull(input).getAbsoluteFile();
output = Objects.requireNonNull(output).getAbsoluteFile();

if (input == null)
throw new IllegalArgumentException("input argument can't be null");
if (output == null)
throw new IllegalArgumentException("output argument can't be null");
if (!input.exists())
throw new IllegalArgumentException("Input file not found: " + input.getAbsolutePath());

input = input.getAbsoluteFile();
output = output.getAbsoluteFile();

logger.accept("Reading Input: " + input.getAbsolutePath());
// Read everything from the input jar!
List<Entry> oldEntries = new ArrayList<>();
Expand Down Expand Up @@ -159,6 +163,9 @@ else if (name.equals(MANIFEST_NAME))
logger.accept("Writing Output: " + output.getAbsolutePath());
try (FileOutputStream fos = new FileOutputStream(output);
ZipOutputStream zos = new ZipOutputStream(fos)) {
// Explicitly set compression level because of potential differences based on environment.
// See https://github.com/MinecraftForge/JarSplitter/pull/2
zos.setLevel(6);

for (Entry e : newEntries) {
String name = e.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package net.minecraftforge.fart.internal;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
Expand Down

0 comments on commit f298a56

Please sign in to comment.