From 4f813952709a38ad4bb22323d84b9ed887a6e36f Mon Sep 17 00:00:00 2001 From: Benoit Lamarche Date: Mon, 20 Jul 2015 15:18:46 +0200 Subject: When obfuscating, drop local var debug info except when there is "-keepattributes LocalVarTable" Bug: 22596989 Change-Id: Iadf5e94fd6df95198b89a0f3833786f4b64a6e9c --- jack/src/com/android/jack/Options.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/jack/src/com/android/jack/Options.java b/jack/src/com/android/jack/Options.java index dc713f45..f1e595a1 100644 --- a/jack/src/com/android/jack/Options.java +++ b/jack/src/com/android/jack/Options.java @@ -681,6 +681,10 @@ public class Options { configBuilder.setString(SOURCES, Joiner.on(File.pathSeparator).join(inputSources)); } + if (emitLocalDebugInfo != null) { + configBuilder.set(EMIT_LOCAL_DEBUG_INFO, emitLocalDebugInfo); + } + configBuilder.pushDefaultLocation(new StringLocation("proguard flags")); if (flags != null) { @@ -693,8 +697,12 @@ public class Options { flags.keepAttribute("RuntimeVisibleParameterAnnotations")); configBuilder.set(ParameterAnnotationRemover.EMIT_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION, flags.keepAttribute("RuntimeInvisibleParameterAnnotations")); - configBuilder.set(EMIT_LINE_NUMBER_DEBUG_INFO, - flags.keepAttribute("LineNumberTable")); + + if (flags.obfuscate()) { // do not override debug info config when shrinking + configBuilder.set(EMIT_LINE_NUMBER_DEBUG_INFO, flags.keepAttribute("LineNumberTable")); + configBuilder.set(EMIT_LOCAL_DEBUG_INFO, flags.keepAttribute("LocalVariableTable")); + } + configBuilder.set(Options.FLAGS, flags); configBuilder.set( Options.USE_MIXED_CASE_CLASSNAME, flags.getUseMixedCaseClassName()); @@ -782,9 +790,6 @@ public class Options { configBuilder.popDefaultLocation(); - if (emitLocalDebugInfo != null) { - configBuilder.set(EMIT_LOCAL_DEBUG_INFO, emitLocalDebugInfo); - } if (importedLibraries != null) { configBuilder.setString(IMPORTED_LIBRARIES, Joiner.on(',').join(importedLibraries)); } -- cgit v1.2.3