Skip to content

Commit

Permalink
Add 'quiet' option to AP to silence informational messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Mumfrey committed Apr 15, 2021
1 parent b496c02 commit 8a5c691
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,19 @@ 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}
*/
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());

Expand Down Expand Up @@ -555,7 +561,7 @@ private static boolean shouldSuppress(Element element, SuppressedBy suppressedBy
*/
@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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -65,7 +66,8 @@ public static Set<String> getAllOptions() {
SupportedOptions.DEFAULT_OBFUSCATION_ENV,
SupportedOptions.DEPENDENCY_TARGETS_FILE,
SupportedOptions.MAPPING_TYPES,
SupportedOptions.PLUGIN_VERSION
SupportedOptions.PLUGIN_VERSION,
SupportedOptions.QUIET
);
options.addAll(
ObfuscationServices.getInstance().getSupportedOptions()
Expand Down

0 comments on commit 8a5c691

Please sign in to comment.