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.logging.Logger;
|
||||
|
||||
import net.fabricmc.loom.util.Checksum;
|
||||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.DependencyProvider;
|
||||
import net.fabricmc.loom.util.DownloadUtil;
|
||||
|
@ -172,16 +171,9 @@ public class MinecraftProvider extends DependencyProvider {
|
|||
}
|
||||
|
||||
private void downloadJars(Logger logger) throws IOException {
|
||||
if (!minecraftClientJar.exists() || (!Checksum.equals(minecraftClientJar, versionInfo.downloads.get("client").sha1) && StaticPathWatcher.INSTANCE.hasFileChanged(minecraftClientJar.toPath()))) {
|
||||
logger.debug("Downloading Minecraft {} client jar", minecraftVersion);
|
||||
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 {
|
||||
logger.lifecycle(":merging jars");
|
||||
|
|
|
@ -26,8 +26,8 @@ package net.fabricmc.loom.util;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
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) {
|
||||
File input = artifact.getFile();
|
||||
AtomicBoolean fabricMod = new AtomicBoolean(false);
|
||||
project.zipTree(input).visit(f -> {
|
||||
if (f.getName().endsWith("fabric.mod.json")) {
|
||||
|
||||
try (ZipFile zipFile = new ZipFile(input)) {
|
||||
if (zipFile.getEntry("fabric.mod.json") != null) {
|
||||
logger.info("Found Fabric mod in modCompile: {}", notation);
|
||||
fabricMod.set(true);
|
||||
f.stopVisiting();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return fabricMod.get();
|
||||
}
|
||||
|
||||
private static void addToRegularCompile(Project project, Configuration regularCompile, String notation) {
|
||||
|
|
Loading…
Reference in New Issue