Improve loom.mixin error message now that the AP is disabled by default. (#1383)

This commit is contained in:
modmuss
2025-10-05 16:26:37 +01:00
committed by GitHub
parent c97f9e4454
commit e2639f9e27
2 changed files with 5 additions and 3 deletions

View File

@@ -40,6 +40,8 @@ import net.fabricmc.loom.api.MixinExtensionAPI;
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
public abstract class MixinExtensionApiImpl implements MixinExtensionAPI {
static final String MIXIN_AP_DISABLED_ERROR = "The mixin annotation is no longer enabled by default, you should remove any loom.mixin configuration. If you wish to continue to use the mixin AP you can set useLegacyMixinAp = true.";
protected final Project project;
protected final Property<Boolean> useMixinAp;
private final Property<String> refmapTargetNamespace;
@@ -75,7 +77,7 @@ public abstract class MixinExtensionApiImpl implements MixinExtensionAPI {
@Override
public Property<String> getRefmapTargetNamespace() {
if (!getUseLegacyMixinAp().get()) throw new IllegalStateException("You need to set useLegacyMixinAp = true to configure Mixin annotation processor.");
if (!getUseLegacyMixinAp().get()) throw new IllegalStateException(MIXIN_AP_DISABLED_ERROR);
return refmapTargetNamespace;
}

View File

@@ -68,7 +68,7 @@ public class MixinExtensionImpl extends MixinExtensionApiImpl implements MixinEx
@Override
public Property<String> getDefaultRefmapName() {
if (!super.getUseLegacyMixinAp().get()) throw new IllegalStateException("You need to set useLegacyMixinAp = true to configure Mixin annotation processor.");
if (!super.getUseLegacyMixinAp().get()) throw new IllegalStateException(MIXIN_AP_DISABLED_ERROR);
return defaultRefmapName;
}
@@ -81,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.");
if (!super.getUseLegacyMixinAp().get()) throw new IllegalStateException(MIXIN_AP_DISABLED_ERROR);
PatternSet pattern = new PatternSet().setIncludes(Collections.singletonList("**/*.json"));
MixinExtension.setMixinInformationContainer(sourceSet, new MixinExtension.MixinInformationContainer(sourceSet, refmapName, pattern));