Disable more broken useLegacyMixinAp checks on Forge

This commit is contained in:
Juuz
2024-12-07 14:56:39 +02:00
parent 3c86f06d8d
commit b1061bb2d0
2 changed files with 14 additions and 6 deletions

View File

@@ -74,9 +74,20 @@ public abstract class MixinExtensionApiImpl implements MixinExtensionAPI {
return useMixinAp;
}
protected void checkMixinApEnabled() {
if (LoomGradleExtension.get(project).isForge()) {
// Arch: We need to access afterEvaluate state in useLegacyMixinAp's convention, so let's not query it.
// Otherwise, this extension can't be used in a buildscript without afterEvaluate.
// https://github.com/architectury/architectury-loom/issues/242
return;
}
if (!getUseLegacyMixinAp().get()) throw new IllegalStateException("You need to set useLegacyMixinAp = true to configure Mixin annotation processor.");
}
@Override
public Property<String> getRefmapTargetNamespace() {
if (!getUseLegacyMixinAp().get()) throw new IllegalStateException("You need to set useLegacyMixinAp = true to configure Mixin annotation processor.");
checkMixinApEnabled();
return refmapTargetNamespace;
}

View File

@@ -61,10 +61,7 @@ public class MixinExtensionImpl extends MixinExtensionApiImpl implements MixinEx
@Override
public Property<String> getDefaultRefmapName() {
// Arch: We need to access afterEvaluate state in useLegacyMixinAp's convention, so let's not query it.
// Otherwise, this property can't be set in a buildscript without afterEvaluate.
// https://github.com/architectury/architectury-loom/issues/242
// if (!super.getUseLegacyMixinAp().get()) throw new IllegalStateException("You need to set useLegacyMixinAp = true to configure Mixin annotation processor.");
checkMixinApEnabled();
return defaultRefmapName;
}
@@ -84,7 +81,7 @@ public class MixinExtensionImpl extends MixinExtensionApiImpl implements MixinEx
@Override
protected PatternSet add0(SourceSet sourceSet, Provider<String> refmapName) {
if (!super.getUseLegacyMixinAp().get()) throw new IllegalStateException("You need to set useLegacyMixinAp = true to configure Mixin annotation processor.");
checkMixinApEnabled();
PatternSet pattern = new PatternSet().setIncludes(Collections.singletonList("**/*.json"));
MixinExtension.setMixinInformationContainer(sourceSet, new MixinExtension.MixinInformationContainer(sourceSet, refmapName, pattern));