mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-20 20:22:31 +00:00
Check mixingradle version in AP so we can notify if mixin ver is ahead
This commit is contained in:
1 parent
11e71bc3f2
commit
dd89e23215
2 files changed
+24
-1
No files matched your search
@@ -59,6 +59,7 @@ import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
import org.spongepowered.asm.util.ITokenProvider;
|
||||
import org.spongepowered.asm.util.VersionNumber;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IJavadocProvider;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IMixinAnnotationProcessor;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IMixinValidator;
|
||||
@@ -83,6 +84,8 @@ import com.google.common.collect.ImmutableList.Builder;
|
||||
final class AnnotatedMixins implements IMixinAnnotationProcessor, ITokenProvider, ITypeHandleProvider, IJavadocProvider {
|
||||
|
||||
private static final String MAPID_SYSTEM_PROPERTY = "mixin.target.mapid";
|
||||
|
||||
private static final String RECOMMENDED_MIXINGRADLE_VERSION = "0.7";
|
||||
|
||||
/**
|
||||
* Singleton instances for each ProcessingEnvironment
|
||||
@@ -143,6 +146,7 @@ final class AnnotatedMixins implements IMixinAnnotationProcessor, ITokenProvider
|
||||
this.processingEnv = processingEnv;
|
||||
|
||||
this.printMessage(Kind.NOTE, "SpongePowered MIXIN Annotation Processor Version=" + MixinBootstrap.VERSION);
|
||||
this.checkPluginVersion(this.getOption(SupportedOptions.PLUGIN_VERSION));
|
||||
|
||||
this.targets = this.initTargetMap();
|
||||
this.obf = new ObfuscationManager(this);
|
||||
@@ -152,10 +156,28 @@ final class AnnotatedMixins implements IMixinAnnotationProcessor, ITokenProvider
|
||||
new ParentValidator(this),
|
||||
new TargetValidator(this)
|
||||
);
|
||||
|
||||
|
||||
this.initTokenCache(this.getOption(SupportedOptions.TOKENS));
|
||||
}
|
||||
|
||||
/**
|
||||
* If MixinGradle is in use, check the version. This will allow us to notify
|
||||
* the user if the version of MixinGradle is out of date relative to the
|
||||
* Mixin library version
|
||||
*/
|
||||
private void checkPluginVersion(String version) {
|
||||
if (version == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
VersionNumber pluginVersion = VersionNumber.parse(version);
|
||||
VersionNumber recommendedVersion = VersionNumber.parse(AnnotatedMixins.RECOMMENDED_MIXINGRADLE_VERSION);
|
||||
if (pluginVersion.compareTo(recommendedVersion) < 0) {
|
||||
this.printMessage(Kind.WARNING, String.format("MixinGradle version %s is out of date. Update to the recommended version %s",
|
||||
pluginVersion, recommendedVersion));
|
||||
}
|
||||
}
|
||||
|
||||
protected TargetMap initTargetMap() {
|
||||
TargetMap targets = TargetMap.create(System.getProperty(AnnotatedMixins.MAPID_SYSTEM_PROPERTY));
|
||||
System.setProperty(AnnotatedMixins.MAPID_SYSTEM_PROPERTY, targets.getSessionId());
|
||||
|
||||
@@ -46,6 +46,7 @@ public final class SupportedOptions {
|
||||
public static final String DEFAULT_OBFUSCATION_ENV = "defaultObfuscationEnv";
|
||||
public static final String DEPENDENCY_TARGETS_FILE = "dependencyTargetsFile";
|
||||
public static final String MAPPING_TYPES = "mappingTypes";
|
||||
public static final String PLUGIN_VERSION = "pluginVersion";
|
||||
|
||||
private SupportedOptions() {}
|
||||
|
||||
|
||||
Reference in new issue
Block a user