mirror of
https://github.com/Guardsquare/proguard.git
synced 2026-03-13 09:50:34 +08:00
Parse -maximumremovedandroidloglevel
This commit is contained in:
@@ -118,6 +118,8 @@ public class ConfigurationConstants
|
||||
|
||||
public static final String ALWAYS_INLINE = "-alwaysinline";
|
||||
public static final String IDENTIFIER_NAME_STRING = "-identifiernamestring";
|
||||
public static final String MAXIMUM_REMOVED_ANDROID_LOG_LEVEL = "-maximumremovedandroidloglevel";
|
||||
|
||||
|
||||
public static final String ANY_FILE_KEYWORD = "**";
|
||||
|
||||
|
||||
@@ -260,6 +260,7 @@ public class ConfigurationParser implements AutoCloseable
|
||||
else if (ConfigurationConstants.OPTIMIZE_AGGRESSIVELY .startsWith(nextWord)) configuration.optimizeConservatively = parseNoArgument(false);
|
||||
else if (ConfigurationConstants.ALWAYS_INLINE .startsWith(nextWord)) parseUnsupportedR8Rules(ConfigurationConstants.ALWAYS_INLINE, true);
|
||||
else if (ConfigurationConstants.IDENTIFIER_NAME_STRING .startsWith(nextWord)) parseUnsupportedR8Rules(ConfigurationConstants.IDENTIFIER_NAME_STRING, true);
|
||||
else if (ConfigurationConstants.MAXIMUM_REMOVED_ANDROID_LOG_LEVEL .equals(nextWord)) parseMaximumRemovedAndroidLogLevel();
|
||||
else
|
||||
{
|
||||
if (unknownOptionHandler != null) {
|
||||
@@ -2087,9 +2088,22 @@ public class ConfigurationParser implements AutoCloseable
|
||||
parseClassSpecificationArguments();
|
||||
}
|
||||
|
||||
System.out.println("Warning: The R8 option " + option + " is currently not supported by ProGuard.\n" +
|
||||
"This option will have no effect on the optimized artifact.");
|
||||
|
||||
warnUnsupportedR8Option(option);
|
||||
}
|
||||
|
||||
private void parseMaximumRemovedAndroidLogLevel() throws IOException, ParseException {
|
||||
parseIntegerArgument();
|
||||
if (!configurationEnd(true)) {
|
||||
parseClassSpecificationArguments();
|
||||
}
|
||||
|
||||
warnUnsupportedR8Option(ConfigurationConstants.MAXIMUM_REMOVED_ANDROID_LOG_LEVEL);
|
||||
}
|
||||
|
||||
private static void warnUnsupportedR8Option(String option) {
|
||||
System.out.println("Warning: The R8 option " + option + " is currently not supported by ProGuard.\n" +
|
||||
"This option will have no effect on the optimized artifact.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -200,6 +200,55 @@ class ConfigurationParserTest : FreeSpec({
|
||||
}
|
||||
}
|
||||
}
|
||||
"Testing -maximumremovedandroidloglevel parsing" - {
|
||||
"Given an empty configuration" - {
|
||||
val savedPrintStream = System.out
|
||||
val customOutputStream = ByteArrayOutputStream()
|
||||
System.setOut(PrintStream(customOutputStream))
|
||||
|
||||
parseConfiguration("")
|
||||
|
||||
"The option does not print anything" {
|
||||
customOutputStream.toString() shouldContain ""
|
||||
System.setOut(savedPrintStream)
|
||||
}
|
||||
}
|
||||
|
||||
"Given a configuration with -maximumremovedandroidloglevel without a class specification" - {
|
||||
val savedPrintStream = System.out
|
||||
val customOutputStream = ByteArrayOutputStream()
|
||||
System.setOut(PrintStream(customOutputStream))
|
||||
|
||||
parseConfiguration("-maximumremovedandroidloglevel 1")
|
||||
|
||||
"The option prints out a warning" {
|
||||
customOutputStream.toString() shouldContain "Warning: The R8 option -maximumremovedandroidloglevel is currently not supported by ProGuard.\n" +
|
||||
"This option will have no effect on the optimized artifact."
|
||||
System.setOut(savedPrintStream)
|
||||
}
|
||||
}
|
||||
|
||||
"Given a configuration with -maximumremovedandroidloglevel with a class specification" - {
|
||||
val savedPrintStream = System.out
|
||||
val customOutputStream = ByteArrayOutputStream()
|
||||
System.setOut(PrintStream(customOutputStream))
|
||||
|
||||
parseConfiguration(
|
||||
"""
|
||||
-maximumremovedandroidloglevel 1 @org.chromium.build.annotations.DoNotStripLogs class ** {
|
||||
<methods>;
|
||||
}
|
||||
""".trimIndent(),
|
||||
)
|
||||
|
||||
"The option prints out a warning" {
|
||||
customOutputStream.toString() shouldContain "Warning: The R8 option -maximumremovedandroidloglevel is currently not supported by ProGuard.\n" +
|
||||
"This option will have no effect on the optimized artifact."
|
||||
System.setOut(savedPrintStream)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
"Wildcard type tests" - {
|
||||
class TestConfig(
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
### Bugfixes
|
||||
|
||||
- Prevent unwanted name collision leading to missing methods in Kotlin DefaultImpls classes.
|
||||
- Prevent `ParseException` when consumer rules contain `-maximumremovedandroidloglevel` rules.
|
||||
|
||||
## Version 7.4.2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user