Add 'quiet' option to AP to silence informational messages

This commit is contained in:
Mumfrey committed 2021-04-15 18:05:10 +01:00
1 parent b496c02efe
commit 8a5c69134d
2 files changed
+10 -2

No files matched your search

@@ -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);
}
}
@@ -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()