Skip to content

Commit

Permalink
touch up the log messages a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
quat1024 committed Feb 18, 2023
1 parent 6846776 commit 92fcb1f
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 69 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ Running changelog document, will be added to as I commit things.
* The plugin will *not* retrieve ATs transitively from mod dependencies.
* Forge has them configurable through Java in the coremod, so it's impossible in the general case.
* Just paste them into the project. (Because I don't try to auto generate a coremod, you don't have to worry about them showing up in the built jar)
* Binpatches
* Binpatches.
* 1.6.4 stopped being a jarmod, instead distributing patches inside a `binpatches.pack.lzma` file.
* Now, if this file exists, Voldeloom is able to parse the file and apply the binary patches.
* You can't quite launch 1.6 yet, but it's a start.

## Other changes

* Rewrote how `genSources` interacts with Fernflower.
* It does not attempt to interact with the Gradle `ProgressLogger` system anymore, because it didn't appear to be working. This also removed a *lot* of logging being swallowed by the progress logger.
* Another optimization (rather brazenly using NIO for reading classes from the jar) improved the runtime a fair bit on my computer. This is a tinge unsafe, so `-Pvoldeloom.saferFernflower` will toggle back to the old `ZipFile`/`ZipEntry` system.
* Reduced retained size of in-memory MCP mappings by about 50%.
* You can also reduce the retained size of the in-memory Tiny mappings tree with `-Pvoldeloom.lowMemory`, but it's a bit slow and unsafe, whcih is why it's behind a flag. Might be useful if you're very memory constrained and want to squeeze out every drop.
* Redid the whole "dependency provider" system to be less garbage.
* Names of providers have changed. The general shape of log output also changed, a bit less spammy, but I will still spam you with file paths.
* The project-wide `offline` and `refreshDependencies` flags were moved from `Constants` into the extension:
* Set the `voldeloom.offline` system property, project property, pass `--offline` to Gradle, or configure `offline` in the extension to configure offline mode
* Set the `voldeloom.refreshDependencies` system property, project property, pass `--refresh-dependencies` to Gradle, or configure `refreshDependencies` in the extension to configure refreshDependencies mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Binpatcher patch() throws Exception {
cleanOnRefreshDependencies(output);

log.info("] binpatch input: {}", input);
log.info("] binpatch output: {}", output);
log.lifecycle("] binpatch output: {}", output);
log.info("] number of binpatches: {}", binpatches.size());

if(Files.notExists(output)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ public ForgeDependencyFetcher sniff() throws Exception {
Preconditions.checkNotNull(forgeJar, "forge jar");

class LibrarySniffingClassVisitor extends ClassVisitor {
public LibrarySniffingClassVisitor(ClassVisitor classVisitor, Collection<String> sniffedLibraries) {
super(Opcodes.ASM4, classVisitor);
this.sniffedLibraries = sniffedLibraries;
public LibrarySniffingClassVisitor() {
super(Opcodes.ASM4, null);
}

private final Collection<String> sniffedLibraries;

@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
//static initializer
Expand Down Expand Up @@ -93,13 +90,15 @@ public void visitLdcInsn(Object value) {
if(Files.exists(coreFmlLibsPath)) {
log.info("|-> Parsing cpw.mods.fml.relauncher.CoreFMLLibraries...");
try(InputStream in = Files.newInputStream(coreFmlLibsPath)) {
new ClassReader(in).accept(new LibrarySniffingClassVisitor(null, sniffedLibraries), ClassReader.SKIP_FRAMES); //just don't need frames
new ClassReader(in).accept(new LibrarySniffingClassVisitor(), ClassReader.SKIP_FRAMES); //just don't need frames
}
} else {
log.info("|-> No cpw.mods.fml.relauncher.CoreFMLLibraries class in this jar.");
}
}

log.info("] found {} libraries", sniffedLibraries.size());

return this;
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/fabricmc/loom/newprovider/Jarmodder.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public Jarmodder patch() throws Exception {
Preconditions.checkNotNull(overlay, "jarmod overlay");

cleanOnRefreshDependencies(jarmodded);

log.lifecycle("] jarmodded: {}", jarmodded);

if(Files.notExists(jarmodded)) {
log.lifecycle("|-> Jarmodded jar does not exist, performing jarmod...");
Files.createDirectories(jarmodded.getParent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public MappingsWrapper(Project project, LoomGradleExtension extension, Configura
if(extension.forgeCapabilities.useSrgsAsFallback()) mappingDiscriminant += "-srgfallback";

mappingsDepString = getDepString() + mappingDiscriminant;
log.info("] mappings dep: {}", mappingsDepString);
log.info("] mappings source: {}", getPath());
log.lifecycle("] mappings dep: {}", mappingsDepString);
log.lifecycle("] mappings source: {}", getPath());

try(FileSystem mcpZipFs = FileSystems.newFileSystem(URI.create("jar:" + getPath().toUri()), Collections.emptyMap())) {
//TODO: Remove this crap when i do the good mappings system
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/fabricmc/loom/newprovider/Merger.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Merger merge() throws Exception {

log.info("] merge client: {}", clientJar);
log.info("] merge server: {}", serverJar);
log.info("] merge target: {}", merged);
log.lifecycle("] merge target: {}", merged);

if(Files.notExists(merged)) {
Files.createDirectories(merged.getParent());
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/fabricmc/loom/newprovider/Remapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ public Remapper remap() throws Exception {
Preconditions.checkNotNull(inputJar, "input jar");
Preconditions.checkNotNull(nonNativeLibs, "nonNativeLibs"); // ?

cleanOnRefreshDependencies(intermediaryJar, mappedJar);
log.lifecycle("] intermediary jar: {}", intermediaryJar);
log.lifecycle("] mapped jar: {}", mappedJar);

cleanOnRefreshDependencies(intermediaryJar, mappedJar);
if (Files.notExists(intermediaryJar) || Files.notExists(mappedJar)) {
log.lifecycle("|-> At least one mapped jar didn't exist, performing remap...");

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/fabricmc/loom/newprovider/Tinifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ public Tinifier tinify() throws Exception {
Preconditions.checkNotNull(mappings, "mappings");

mappingsFile = getCacheDir().resolve("mappings").resolve(mappings.getPath().getFileName() + mappings.getMappingDiscriminant() + ".tiny");
log.info("] mappings destination: {}", mappingsFile);
log.lifecycle("] mappings destination: {}", mappingsFile);

cleanOnRefreshDependencies(mappingsFile);

if(Files.notExists(mappingsFile)) {
log.info("|-> Mappings file does not exist, writing...");
Files.createDirectories(mappingsFile.getParent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,21 @@ public VanillaDependencyFetcher fetch() throws Exception {
Preconditions.checkNotNull(manifest, "minecraft version manifest");
Preconditions.checkNotNull(librariesBaseUrl, "libraries base URL");

log.lifecycle("] native libraries directory: {}", nativesDir);

cleanOnRefreshDependencies(nativesDir);

Path nativesJarStore = nativesDir.resolve("jars");
Files.createDirectories(nativesJarStore);

int nativeDepCount = 0;

for(VersionManifest.Library library : manifest.libraries) {
if(!library.allowed()) continue;

if(library.isNative()) {
log.info("Found minecraft native dependency {}", library.getArtifactName());
nativeDepCount++;

Path libJarFile = library.getPath(nativesJarStore);

Expand Down Expand Up @@ -130,6 +135,8 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
}
}

log.info("] found {} native libraries and {} maven dependencies", nativeDepCount, mavenDependencies.size());

return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ public VanillaJarFetcher fetch() throws Exception {
Path versionManifestIndexJson = getCacheDir().resolve("version_manifest.json");
Path thisVersionManifestJson = getCacheDir().resolve("minecraft-" + mc.getFilenameSafeVersion() + "-info.json");

log.info("] client jar: {}", clientJar);
log.info("] server jar: {}", serverJar);
log.lifecycle("] client jar: {}", clientJar);
log.lifecycle("] server jar: {}", serverJar);
log.lifecycle("] manifest index: {}", versionManifestIndexJson);
log.lifecycle("] this version manifest: {}", thisVersionManifestJson);

cleanOnRefreshDependencies(andEtags(Arrays.asList(clientJar, serverJar, thisVersionManifestJson, versionManifestIndexJson)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void doTask() throws Throwable {

getLogging().captureStandardOutput(LogLevel.LIFECYCLE);
ExecResult result = forkedJavaexec(spec -> {
//spec.setMain(ForkedFFExecutor.class.getName()); //TODO: setMain is deprecated and removed in Gradle 8
GradleSupport.setMainClass(spec, ForkedFFExecutor.class.getName());

//spec.jvmArgs("-Xms200m", "-Xmx3G"); //the defaults work on my machine :tm: and this version of minecraft is so small and cute
Expand Down

This file was deleted.

0 comments on commit 92fcb1f

Please sign in to comment.