Skip to content

Commit

Permalink
Disable more broken useLegacyMixinAp checks on Forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Dec 7, 2024
1 parent 3c86f06 commit b1061bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,20 @@ public Property<Boolean> getUseLegacyMixinAp() {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public MixinExtensionImpl(Project project) {

@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;
}
Expand All @@ -84,7 +81,7 @@ private String getDefaultMixinRefmapName() {

@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));
Expand Down

0 comments on commit b1061bb

Please sign in to comment.