Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed the (knot) launcher to give the intended namespace #435

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d963772
Made Knot class loaders public
coolGi69 May 30, 2024
12cad12
Allowed the launcher (knot) to give the intended namespace
coolGi69 May 30, 2024
f13a5fe
Revert "Revert "Floader 0.16.0""
EnnuiL Aug 17, 2024
5cdfbae
Update Mixin and Mixin Extras (#963)
modmuss50 Aug 15, 2024
380014e
Bump version
modmuss50 Aug 15, 2024
cab7c29
Specify full entrypoint name on crash (#928)
SHsuperCM Aug 15, 2024
702cab7
Update Mixin
modmuss50 Aug 15, 2024
7c662ec
Added support for 1.21.2 in McVersionLookup (#964)
WinPlay02 Aug 15, 2024
edeb7b4
Bump version
modmuss50 Aug 15, 2024
379172d
Fix two oversights (#1)
AlexIIL Aug 17, 2024
bcd60aa
Hardcode 0.10.0 mixin compat to Quilt mods for now
EnnuiL Aug 17, 2024
d2e4326
Merge branch 'develop' into develop
coolGi69 Aug 17, 2024
7ed7914
Set `setPluginPackages` to public
coolGi69 Aug 18, 2024
b8e7ad0
Moved target namespace from the GameProvider to the Knot
coolGi69 Aug 18, 2024
89b42d3
Made the Knot no-longer final so that it can be extended
coolGi69 Aug 18, 2024
ddfd8c8
Made the provider in the knot protected
coolGi69 Aug 18, 2024
010f14c
Fixed failure of getting Quilt Path if using a different Knot
coolGi69 Aug 18, 2024
9661e47
Merge Pull Request https://github.com/QuiltMC/quilt-loader/pull/448 (…
AlexIIL Aug 23, 2024
02c2a66
Include the list of options and rules when the solver system returns …
AlexIIL Aug 24, 2024
be5ac16
Fix the pre-processor accidently removing the output rule when mergin…
AlexIIL Aug 29, 2024
b0606ef
Fix previous fix accidently not removing rules in a slightly differen…
AlexIIL Aug 29, 2024
46ab673
Floader 0.16.3
TheGlitch76 Sep 6, 2024
9d93dc0
Floader 0.16.4
TheGlitch76 Sep 6, 2024
8931e70
Bump version
TheGlitch76 Sep 6, 2024
18658ab
Fix the plugin classloader not checking to see if a class was already…
AlexIIL Sep 7, 2024
3379b2e
0.26.4 Release & Changelog
AlexIIL Sep 13, 2024
fe82575
Port to mapping-io (Glitch's Version) (#432)
TheGlitch76 Oct 9, 2024
707a497
Made Knot class loaders public
coolGi69 May 30, 2024
c3bf5ce
Allowed the launcher (knot) to give the intended namespace
coolGi69 May 30, 2024
a0c6a81
Moved target namespace from the GameProvider to the Knot
coolGi69 Aug 18, 2024
068abbd
Made the Knot no-longer final so that it can be extended
coolGi69 Aug 18, 2024
092bb23
Made the provider in the knot protected
coolGi69 Aug 18, 2024
514d626
Fixed failure of getting Quilt Path if using a different Knot
coolGi69 Aug 18, 2024
123962c
Merge branch 'StartsMercury-develop' into develop
coolGi69 Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public interface QuiltLauncher {
String getEntrypoint();

String getTargetNamespace();
String getFinalNamespace();

List<Path> getClassPath();

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/quiltmc/loader/impl/launch/knot/Knot.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ public String getTargetNamespace() {
// TODO: Won't work outside of Yarn
return isDevelopment ? "named" : "intermediary";
}
@Override
public String getFinalNamespace() {
return "intermediary";
}

@Override
public List<Path> getClassPath() {
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why making this public?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowing for the creation of other knots

Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
import java.util.jar.Manifest;

@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
class KnotClassDelegate {
static class Metadata {
public class KnotClassDelegate {
public static class Metadata {
static final Metadata EMPTY = new Metadata(null, null);

final Manifest manifest;
public final Manifest manifest;
final CodeSourceImpl codeSource;

Metadata(Manifest manifest, CodeSourceImpl codeSource) {
Expand Down Expand Up @@ -368,7 +368,7 @@ private String computePackageDenyLoadReason(String pkgName, boolean allowFromPar
return hideReason != null ? hideReason : "";
}

Metadata getMetadata(String name, URL resourceURL) {
public Metadata getMetadata(String name, URL resourceURL) {
if (resourceURL == null) return Metadata.EMPTY;

String classFileName = LoaderUtil.getClassFileName(name);
Expand Down Expand Up @@ -427,7 +427,7 @@ public void setMod(Path loadFrom, URL codeSourceUrl, ModContainer mod) {
});
}

Metadata getMetadata(URL codeSourceUrl) {
public Metadata getMetadata(URL codeSourceUrl) {
return metadataCache.computeIfAbsent(codeSourceUrl.toString(), (codeSourceStr) -> {
Manifest manifest = null;
CodeSourceImpl codeSource = null;
Expand Down Expand Up @@ -550,31 +550,31 @@ public byte[] getRawClassByteArray(URL url, String name) throws IOException {
}
}

void setAllowedPrefixes(URL url, String... prefixes) {
public void setAllowedPrefixes(URL url, String... prefixes) {
if (prefixes.length == 0) {
allowedPrefixes.remove(url.toString());
} else {
allowedPrefixes.put(url.toString(), prefixes);
}
}

void setTransformCache(URL insideTransformCache) {
public void setTransformCache(URL insideTransformCache) {
transformCacheUrl = insideTransformCache.toString();
}

void setHiddenClasses(Set<String> hiddenClasses) {
public void setHiddenClasses(Set<String> hiddenClasses) {
Map<String, String> map = new HashMap<>();
for (String cl : hiddenClasses) {
map.put(cl, "unknown reason");
}
setHiddenClasses(map);
}

void setHiddenClasses(Map<String, String> hiddenClasses) {
public void setHiddenClasses(Map<String, String> hiddenClasses) {
this.hiddenClasses = hiddenClasses;
}

void hideParentUrl(URL parentPath) {
public void hideParentUrl(URL parentPath) {
parentHiddenUrls.add(parentPath.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import java.util.Optional;

@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
class KnotClassLoader extends SecureClassLoader implements KnotClassLoaderInterface {
public class KnotClassLoader extends SecureClassLoader implements KnotClassLoaderInterface {
private static class DynamicURLClassLoader extends URLClassLoader {
private DynamicURLClassLoader(URL[] urls) {
super(urls, new DummyClassLoader());
Expand All @@ -69,7 +69,7 @@ public void addURL(URL url) {
private final ClassLoader originalLoader;
private final KnotClassDelegate delegate;

KnotClassLoader(boolean isDevelopment, EnvType envType, GameProvider provider) {
public KnotClassLoader(boolean isDevelopment, EnvType envType, GameProvider provider) {
super(new DynamicURLClassLoader(new URL[0]));
this.originalLoader = getClass().getClassLoader();
// For compatibility we send all URLs to the fake loader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import org.quiltmc.loader.impl.util.QuiltLoaderInternalType;

@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
interface KnotClassLoaderInterface extends KnotBaseClassLoader {
KnotClassDelegate getDelegate();
public interface KnotClassLoaderInterface extends KnotBaseClassLoader {
public KnotClassDelegate getDelegate();
ClassLoader getOriginalLoader();
boolean isClassLoaded(String name);
Class<?> loadIntoTarget(String name) throws ClassNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
import java.security.CodeSource;

@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
class KnotCompatibilityClassLoader extends URLClassLoader implements KnotClassLoaderInterface {
public class KnotCompatibilityClassLoader extends URLClassLoader implements KnotClassLoaderInterface {
private final KnotClassDelegate delegate;

KnotCompatibilityClassLoader(boolean isDevelopment, EnvType envType, GameProvider provider) {
public KnotCompatibilityClassLoader(boolean isDevelopment, EnvType envType, GameProvider provider) {
super(new URL[0], KnotCompatibilityClassLoader.class.getClassLoader());
this.delegate = new KnotClassDelegate(isDevelopment, envType, this, provider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -35,10 +34,7 @@
import java.util.stream.Collectors;

import org.objectweb.asm.commons.Remapper;
import org.quiltmc.loader.api.ExtendedFiles;
import org.quiltmc.loader.api.FasterFiles;
import org.quiltmc.loader.api.plugin.solver.ModLoadOption;
import org.quiltmc.loader.impl.QuiltLoaderImpl;
import org.quiltmc.loader.impl.launch.common.QuiltLauncher;
import org.quiltmc.loader.impl.launch.common.QuiltLauncherBase;
import org.quiltmc.loader.impl.util.ManifestUtil;
Expand All @@ -51,7 +47,6 @@
import net.fabricmc.accesswidener.AccessWidenerRemapper;
import net.fabricmc.accesswidener.AccessWidenerWriter;
import net.fabricmc.tinyremapper.InputTag;
import net.fabricmc.tinyremapper.NonClassCopyMode;
import net.fabricmc.tinyremapper.OutputConsumerPath;
import net.fabricmc.tinyremapper.TinyRemapper;
import net.fabricmc.tinyremapper.extension.mixin.MixinExtension;
Expand All @@ -76,7 +71,7 @@ public static void remap(TransformCache cache) {
QuiltLauncher launcher = QuiltLauncherBase.getLauncher();

TinyRemapper remapper = TinyRemapper.newRemapper()
.withMappings(TinyRemapperMappingsHelper.create(launcher.getMappingConfiguration().getMappings(), "intermediary", launcher.getTargetNamespace()))
.withMappings(TinyRemapperMappingsHelper.create(launcher.getMappingConfiguration().getMappings(), launcher.getFinalNamespace(), launcher.getTargetNamespace()))
.renameInvalidLocals(false)
.extension(new MixinExtension(remapMixins::contains))
.build();
Expand Down Expand Up @@ -148,9 +143,9 @@ public static void remap(TransformCache cache) {

private static byte[] remapAccessWidener(byte[] input, Remapper remapper) {
AccessWidenerWriter writer = new AccessWidenerWriter();
AccessWidenerRemapper remappingDecorator = new AccessWidenerRemapper(writer, remapper, "intermediary", QuiltLauncherBase.getLauncher().getTargetNamespace());
AccessWidenerRemapper remappingDecorator = new AccessWidenerRemapper(writer, remapper, QuiltLauncherBase.getLauncher().getFinalNamespace(), QuiltLauncherBase.getLauncher().getTargetNamespace());
AccessWidenerReader accessWidenerReader = new AccessWidenerReader(remappingDecorator);
accessWidenerReader.read(input, "intermediary");
accessWidenerReader.read(input, QuiltLauncherBase.getLauncher().getFinalNamespace());
return writer.write();
}

Expand Down
Loading