mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Replace Commons IO NullOutputStream with custom impl
Fixes #302. The class was backported from 1.12 where Commons IO is not used at all.
This commit is contained in:
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.commons.io.output.NullOutputStream;
|
||||
import dev.architectury.loom.util.NullOutputStream;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.file.ConfigurableFileCollection;
|
||||
@@ -77,13 +77,13 @@ public abstract class ForgeToolExecutor {
|
||||
if (settings.getShowVerboseStdout().get()) {
|
||||
spec.setStandardOutput(System.out);
|
||||
} else {
|
||||
spec.setStandardOutput(NullOutputStream.NULL_OUTPUT_STREAM);
|
||||
spec.setStandardOutput(NullOutputStream.INSTANCE);
|
||||
}
|
||||
|
||||
if (settings.getShowVerboseStderr().get()) {
|
||||
spec.setErrorOutput(System.err);
|
||||
} else {
|
||||
spec.setErrorOutput(NullOutputStream.NULL_OUTPUT_STREAM);
|
||||
spec.setErrorOutput(NullOutputStream.INSTANCE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package dev.architectury.loom.util;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
public final class NullOutputStream extends OutputStream {
|
||||
public static final NullOutputStream INSTANCE = new NullOutputStream();
|
||||
|
||||
private NullOutputStream() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
import org.apache.commons.io.output.NullOutputStream;
|
||||
import dev.architectury.loom.util.NullOutputStream;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.logging.LogLevel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -88,8 +88,8 @@ public class SrgProvider extends DependencyProvider {
|
||||
PrintStream err = System.err;
|
||||
|
||||
if (getProject().getGradle().getStartParameter().getLogLevel().compareTo(LogLevel.LIFECYCLE) >= 0) {
|
||||
System.setOut(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM));
|
||||
System.setErr(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM));
|
||||
System.setOut(new PrintStream(NullOutputStream.INSTANCE));
|
||||
System.setErr(new PrintStream(NullOutputStream.INSTANCE));
|
||||
}
|
||||
|
||||
Files.deleteIfExists(mergedMojangRaw);
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import dev.architectury.loom.forge.tool.ForgeToolExecutor;
|
||||
import dev.architectury.loom.util.MappingOption;
|
||||
import org.apache.commons.io.output.NullOutputStream;
|
||||
import dev.architectury.loom.util.NullOutputStream;
|
||||
import org.cadixdev.lorenz.MappingSet;
|
||||
import org.cadixdev.mercury.Mercury;
|
||||
import org.cadixdev.mercury.remapper.MercuryRemapper;
|
||||
@@ -171,8 +171,8 @@ public class ForgeSourcesRemapper {
|
||||
PrintStream err = System.err;
|
||||
|
||||
if (!ForgeToolExecutor.shouldShowVerboseStderr(project)) {
|
||||
System.setOut(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM));
|
||||
System.setErr(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM));
|
||||
System.setOut(new PrintStream(NullOutputStream.INSTANCE));
|
||||
System.setErr(new PrintStream(NullOutputStream.INSTANCE));
|
||||
}
|
||||
|
||||
remapForgeSourcesInner(project, serviceFactory, tmpInput.toPath(), tmpOutput.toPath());
|
||||
|
||||
Reference in New Issue
Block a user