Skip to content

Commit

Permalink
Fix @Requires("quilt_loader") not working because the transform cac…
Browse files Browse the repository at this point in the history
…he doesn't contain it.
  • Loading branch information
AlexIIL committed Mar 30, 2024
1 parent 3b039d5 commit c40012c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ group = org.quiltmc
description = The mod loading component of Quilt
url = https://github.com/quiltmc/quilt-loader
# Don't forget to change this in QuiltLoaderImpl as well
quilt_loader = 0.24.1-beta.1
quilt_loader = 0.24.1-beta.2

# Fabric & Quilt Libraries
asm = 9.6
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/quiltmc/loader/impl/QuiltLoaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public final class QuiltLoaderImpl {

public static final int ASM_VERSION = Opcodes.ASM9;

public static final String VERSION = "0.24.1-beta.1";
public static final String VERSION = "0.24.1-beta.2";
public static final String MOD_ID = "quilt_loader";
public static final String DEFAULT_MODS_DIR = "mods";
public static final String DEFAULT_CACHE_DIR = ".cache";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void applyChasm0(TransformCache cache) throws IOException {
Map<String, byte[]> inputClassCache = new HashMap<>();

// TODO: Move chasm searching to here!
for (ModLoadOption mod : cache.getMods()) {
for (ModLoadOption mod : cache.getModsInCache()) {
Path path2 = cache.getRoot(mod);
if (!FasterFiles.isDirectory(path2)) {
continue;
Expand Down Expand Up @@ -108,7 +108,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
}
});

for (ModLoadOption mod : cache.getMods()) {
for (ModLoadOption mod : cache.getModsInCache()) {
Path modPath = cache.getRoot(mod);
if (!FasterFiles.exists(modPath)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class QuiltTransformer {
int visitorCount = 0;

if (strip) {
ClassStrippingData data = new ClassStrippingData(QuiltLoaderImpl.ASM_VERSION, envType, cache.getMods());
ClassStrippingData data = new ClassStrippingData(QuiltLoaderImpl.ASM_VERSION, envType, cache.getAllMods());
classReader.accept(data, ClassReader.SKIP_CODE | ClassReader.SKIP_FRAMES);

if (data.stripEntireClass()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class RuntimeModRemapper {
static final boolean COPY_ON_WRITE = true;

public static void remap(TransformCache cache) {
List<ModLoadOption> modsToRemap = cache.getMods().stream()
List<ModLoadOption> modsToRemap = cache.getModsInCache().stream()
.filter(modLoadOption -> modLoadOption.namespaceMappingFrom() != null)
.collect(Collectors.toList());
Set<InputTag> remapMixins = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@
class TransformCache {
private final Path root;
private final Map<ModLoadOption, Path> modRoots = new HashMap<>();
private final List<ModLoadOption> orderedMods;
private final List<ModLoadOption> allMods;
private final List<ModLoadOption> modsInCache;
private final Map<String, String> hiddenClasses = new HashMap<>();
private static final boolean COPY_ON_WRITE = true;

public TransformCache(Path root, List<ModLoadOption> orderedMods) {
this.root = root;
this.orderedMods = orderedMods.stream().filter(mod -> mod.needsTransforming() && !QuiltLoaderImpl.MOD_ID.equals(mod.id())).collect(Collectors.toList());
this.allMods = orderedMods;
this.modsInCache = orderedMods.stream().filter(mod -> mod.needsTransforming() && !QuiltLoaderImpl.MOD_ID.equals(mod.id())).collect(Collectors.toList());

for (ModLoadOption mod : this.orderedMods) {
for (ModLoadOption mod : this.modsInCache) {
Path modSrc = mod.createTransformRoot();
Path modDst = root.resolve(mod.id());
modRoots.put(mod, modDst);
Expand Down Expand Up @@ -152,7 +154,7 @@ public TransformCache(Path root, List<ModLoadOption> orderedMods) {
}
// Populate mods that need remapped
RuntimeModRemapper.remap(this);
for (ModLoadOption orderedMod : this.orderedMods) {
for (ModLoadOption orderedMod : this.modsInCache) {
modRoots.put(orderedMod, root.resolve(orderedMod.id() + "/"));
}
}
Expand All @@ -161,8 +163,14 @@ public Path getRoot(ModLoadOption mod) {
return modRoots.get(mod);
}

public List<ModLoadOption> getMods() {
return Collections.unmodifiableList(orderedMods);
/** @return Every mod which has a {@link #getRoot(ModLoadOption)} in this cache. */
public List<ModLoadOption> getModsInCache() {
return Collections.unmodifiableList(modsInCache);
}

/** @return The original list of mods, including any which aren't directly in this cache. */
public List<ModLoadOption> getAllMods() {
return Collections.unmodifiableList(allMods);
}

public Map<String, String> getHiddenClasses() {
Expand All @@ -171,7 +179,7 @@ public Map<String, String> getHiddenClasses() {

public void forEachClassFile(ClassConsumer action)
throws IOException {
for (ModLoadOption mod : orderedMods) {
for (ModLoadOption mod : modsInCache) {
visitFolder(mod, getRoot(mod), action);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private static AccessWidener loadAccessWideners(TransformCache cache) {
AccessWidener ret = new AccessWidener();
AccessWidenerReader accessWidenerReader = new AccessWidenerReader(ret);

for (ModLoadOption mod : cache.getMods()) {
for (ModLoadOption mod : cache.getModsInCache()) {
for (String accessWidener : mod.metadata().accessWideners()) {

Path path = cache.getRoot(mod).resolve(accessWidener);
Expand Down

0 comments on commit c40012c

Please sign in to comment.