summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Kozák <kozakcsabi@gmail.com>2014-10-31 16:01:51 +0100
committerBenoit Lamarche <benoitlamarche@google.com>2015-04-07 18:54:19 +0200
commite345a3565597b76ee5bf6bfbf2c84ce9271be079 (patch)
tree78cf74590e1daf78ad9b6270a5567c83d4d0864c
parent008da7d42d529761ab85b8e92d3dd366f1fad195 (diff)
downloadandroid_dalvik-e345a3565597b76ee5bf6bfbf2c84ce9271be079.tar.gz
android_dalvik-e345a3565597b76ee5bf6bfbf2c84ce9271be079.tar.bz2
android_dalvik-e345a3565597b76ee5bf6bfbf2c84ce9271be079.zip
Command line option for disabling warnings
This commit adds a new command line option to dx: --no-warning. If the caller appends this to the arguments, dx won't print warnings to System.err. This can be useful if the user dexes external jars with old class format, so dx would print lot of warning about those. Bug: https://code.google.com/p/android/issues/detail?id=78285 Signed-off-by: Csaba Kozák <kozakcsabi@gmail.com> (cherry picked from commit ef1de423e70704c478ee77956f44b0a040d8bede) Change-Id: I6d09c684b5eb97aa28e0b12e3ef44b46293c7dec
-rw-r--r--dx/src/com/android/dx/command/DxConsole.java13
-rw-r--r--dx/src/com/android/dx/command/Main.java2
-rw-r--r--dx/src/com/android/dx/command/dexer/Main.java12
3 files changed, 25 insertions, 2 deletions
diff --git a/dx/src/com/android/dx/command/DxConsole.java b/dx/src/com/android/dx/command/DxConsole.java
index 9ce9836ef..919de8c80 100644
--- a/dx/src/com/android/dx/command/DxConsole.java
+++ b/dx/src/com/android/dx/command/DxConsole.java
@@ -16,6 +16,8 @@
package com.android.dx.command;
+import java.io.IOException;
+import java.io.OutputStream;
import java.io.PrintStream;
/**
@@ -34,4 +36,15 @@ public class DxConsole {
* Error output stream. Links to {@code System.err} by default.
*/
public static PrintStream err = System.err;
+
+ /**
+ * Output stream which prints to nowhere.
+ */
+ public static final PrintStream noop = new PrintStream(new OutputStream() {
+
+ @Override
+ public void write(int b) throws IOException {
+ // noop
+ }
+ });
}
diff --git a/dx/src/com/android/dx/command/Main.java b/dx/src/com/android/dx/command/Main.java
index 9834987e5..a0be5bd51 100644
--- a/dx/src/com/android/dx/command/Main.java
+++ b/dx/src/com/android/dx/command/Main.java
@@ -33,7 +33,7 @@ public class Main {
"[--dump-width=<n>]\n" +
" [--dump-method=<name>[*]] [--verbose-dump] [--no-files] " +
"[--core-library]\n" +
- " [--num-threads=<n>] [--incremental] [--force-jumbo]\n" +
+ " [--num-threads=<n>] [--incremental] [--force-jumbo] [--no-warning]\n" +
" [--multi-dex [--main-dex-list=<file> [--minimal-main-dex]]\n" +
" [--input-list=<file>]\n" +
" [<file>.class | <file>.{zip,jar,apk} | <directory>] ...\n" +
diff --git a/dx/src/com/android/dx/command/dexer/Main.java b/dx/src/com/android/dx/command/dexer/Main.java
index 4a3d1952f..563a93c39 100644
--- a/dx/src/com/android/dx/command/dexer/Main.java
+++ b/dx/src/com/android/dx/command/dexer/Main.java
@@ -1199,6 +1199,9 @@ public class Main {
/** whether to run in debug mode */
public boolean debug = false;
+ /** whether to emit warning messages */
+ public boolean warnings = true;
+
/** whether to emit high-level verbose human-oriented output */
public boolean verbose = false;
@@ -1409,6 +1412,8 @@ public class Main {
while(parser.getNext()) {
if (parser.isArg("--debug")) {
debug = true;
+ } else if (parser.isArg("--no-warning")) {
+ warnings = false;
} else if (parser.isArg("--verbose")) {
verbose = true;
} else if (parser.isArg("--verbose-dump")) {
@@ -1580,7 +1585,12 @@ public class Main {
cfOptions.optimizeListFile = optimizeListFile;
cfOptions.dontOptimizeListFile = dontOptimizeListFile;
cfOptions.statistics = statistics;
- cfOptions.warn = DxConsole.err;
+
+ if (warnings) {
+ cfOptions.warn = DxConsole.err;
+ } else {
+ cfOptions.warn = DxConsole.noop;
+ }
dexOptions = new DexOptions();
dexOptions.forceJumbo = forceJumbo;