From 8a5c69134d5c74a0b856ee83dff6ee35745d0fd6 Mon Sep 17 00:00:00 2001 From: Mumfrey Date: Thu, 15 Apr 2021 18:05:10 +0100 Subject: [PATCH] Add 'quiet' option to AP to silence informational messages --- .../spongepowered/tools/obfuscation/AnnotatedMixins.java | 8 +++++++- .../spongepowered/tools/obfuscation/SupportedOptions.java | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixins.java b/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixins.java index d4845674..f9ddfaff 100644 --- a/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixins.java +++ b/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixins.java @@ -138,6 +138,11 @@ final class AnnotatedMixins implements IMixinAnnotationProcessor, ITokenProvider * configured via the build script (eg. when using AP with MCP) */ private Properties properties; + + /** + * No informational messages, I'm hunting wabbits + */ + private boolean beVewyVewyQuiet; /** * Private constructor, get instances using {@link #getMixinsForEnvironment} @@ -145,6 +150,7 @@ final class AnnotatedMixins implements IMixinAnnotationProcessor, ITokenProvider private AnnotatedMixins(ProcessingEnvironment processingEnv) { this.env = this.detectEnvironment(processingEnv); this.processingEnv = processingEnv; + this.beVewyVewyQuiet = this.env == CompilerEnvironment.JDT || "true".equalsIgnoreCase(this.getOption(SupportedOptions.QUIET)); MessageRouter.setMessager(processingEnv.getMessager()); @@ -555,7 +561,7 @@ final class AnnotatedMixins implements IMixinAnnotationProcessor, ITokenProvider */ @Override public void printMessage(Kind kind, CharSequence msg) { - if (this.env == CompilerEnvironment.JAVAC || kind != Kind.NOTE) { + if (!this.beVewyVewyQuiet || kind != Kind.NOTE) { this.processingEnv.getMessager().printMessage(kind, msg); } } diff --git a/src/ap/java/org/spongepowered/tools/obfuscation/SupportedOptions.java b/src/ap/java/org/spongepowered/tools/obfuscation/SupportedOptions.java index 7369df7f..dbe88ca2 100644 --- a/src/ap/java/org/spongepowered/tools/obfuscation/SupportedOptions.java +++ b/src/ap/java/org/spongepowered/tools/obfuscation/SupportedOptions.java @@ -47,6 +47,7 @@ public final class SupportedOptions { public static final String DEPENDENCY_TARGETS_FILE = "dependencyTargetsFile"; public static final String MAPPING_TYPES = "mappingTypes"; public static final String PLUGIN_VERSION = "pluginVersion"; + public static final String QUIET = "quiet"; private SupportedOptions() {} @@ -65,7 +66,8 @@ public final class SupportedOptions { SupportedOptions.DEFAULT_OBFUSCATION_ENV, SupportedOptions.DEPENDENCY_TARGETS_FILE, SupportedOptions.MAPPING_TYPES, - SupportedOptions.PLUGIN_VERSION + SupportedOptions.PLUGIN_VERSION, + SupportedOptions.QUIET ); options.addAll( ObfuscationServices.getInstance().getSupportedOptions()