Some trivial performance improvements
parent
93820f0d65
commit
76087d4d3d
|
@ -40,7 +40,6 @@ import org.gradle.api.GradleException;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.logging.Logger;
|
import org.gradle.api.logging.Logger;
|
||||||
|
|
||||||
import net.fabricmc.loom.util.Checksum;
|
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
import net.fabricmc.loom.util.DependencyProvider;
|
import net.fabricmc.loom.util.DependencyProvider;
|
||||||
import net.fabricmc.loom.util.DownloadUtil;
|
import net.fabricmc.loom.util.DownloadUtil;
|
||||||
|
@ -172,15 +171,8 @@ public class MinecraftProvider extends DependencyProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadJars(Logger logger) throws IOException {
|
private void downloadJars(Logger logger) throws IOException {
|
||||||
if (!minecraftClientJar.exists() || (!Checksum.equals(minecraftClientJar, versionInfo.downloads.get("client").sha1) && StaticPathWatcher.INSTANCE.hasFileChanged(minecraftClientJar.toPath()))) {
|
DownloadUtil.downloadIfChanged(new URL(versionInfo.downloads.get("client").url), minecraftClientJar, logger);
|
||||||
logger.debug("Downloading Minecraft {} client jar", minecraftVersion);
|
DownloadUtil.downloadIfChanged(new URL(versionInfo.downloads.get("server").url), minecraftServerJar, logger);
|
||||||
DownloadUtil.downloadIfChanged(new URL(versionInfo.downloads.get("client").url), minecraftClientJar, logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!minecraftServerJar.exists() || (!Checksum.equals(minecraftServerJar, versionInfo.downloads.get("server").sha1) && StaticPathWatcher.INSTANCE.hasFileChanged(minecraftServerJar.toPath()))) {
|
|
||||||
logger.debug("Downloading Minecraft {} server jar", minecraftVersion);
|
|
||||||
DownloadUtil.downloadIfChanged(new URL(versionInfo.downloads.get("server").url), minecraftServerJar, logger);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mergeJars(Logger logger) throws IOException {
|
private void mergeJars(Logger logger) throws IOException {
|
||||||
|
|
|
@ -26,8 +26,8 @@ package net.fabricmc.loom.util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
import org.gradle.api.artifacts.Configuration;
|
||||||
|
@ -98,15 +98,17 @@ public class ModCompileRemapper {
|
||||||
*/
|
*/
|
||||||
private static boolean isFabricMod(Project project, Logger logger, ResolvedArtifact artifact, String notation) {
|
private static boolean isFabricMod(Project project, Logger logger, ResolvedArtifact artifact, String notation) {
|
||||||
File input = artifact.getFile();
|
File input = artifact.getFile();
|
||||||
AtomicBoolean fabricMod = new AtomicBoolean(false);
|
|
||||||
project.zipTree(input).visit(f -> {
|
try (ZipFile zipFile = new ZipFile(input)) {
|
||||||
if (f.getName().endsWith("fabric.mod.json")) {
|
if (zipFile.getEntry("fabric.mod.json") != null) {
|
||||||
logger.info("Found Fabric mod in modCompile: {}", notation);
|
logger.info("Found Fabric mod in modCompile: {}", notation);
|
||||||
fabricMod.set(true);
|
return true;
|
||||||
f.stopVisiting();
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return fabricMod.get();
|
return false;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addToRegularCompile(Project project, Configuration regularCompile, String notation) {
|
private static void addToRegularCompile(Project project, Configuration regularCompile, String notation) {
|
||||||
|
|
Loading…
Reference in New Issue