diff options
Diffstat (limited to 'src/proguard/ant')
-rw-r--r-- | src/proguard/ant/ClassPathElement.java | 18 | ||||
-rw-r--r-- | src/proguard/ant/ClassSpecificationElement.java | 29 | ||||
-rw-r--r-- | src/proguard/ant/ConfigurationElement.java | 3 | ||||
-rw-r--r-- | src/proguard/ant/ConfigurationTask.java | 2 | ||||
-rw-r--r-- | src/proguard/ant/FilterElement.java | 2 | ||||
-rw-r--r-- | src/proguard/ant/KeepSpecificationElement.java | 10 | ||||
-rw-r--r-- | src/proguard/ant/MemberSpecificationElement.java | 38 | ||||
-rw-r--r-- | src/proguard/ant/ProGuardTask.java | 14 |
8 files changed, 70 insertions, 46 deletions
diff --git a/src/proguard/ant/ClassPathElement.java b/src/proguard/ant/ClassPathElement.java index b496123..ef5b510 100644 --- a/src/proguard/ant/ClassPathElement.java +++ b/src/proguard/ant/ClassPathElement.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -36,7 +36,9 @@ import java.io.File; public class ClassPathElement extends Path { private String filter; + private String apkFilter; private String jarFilter; + private String aarFilter; private String warFilter; private String earFilter; private String zipFilter; @@ -120,7 +122,9 @@ public class ClassPathElement extends Path new ClassPathEntry(file.isAbsolute() ? file : new File(baseDir, fileName), output); entry.setFilter(ListUtil.commaSeparatedList(filter)); + entry.setApkFilter(ListUtil.commaSeparatedList(apkFilter)); entry.setJarFilter(ListUtil.commaSeparatedList(jarFilter)); + entry.setAarFilter(ListUtil.commaSeparatedList(aarFilter)); entry.setWarFilter(ListUtil.commaSeparatedList(warFilter)); entry.setEarFilter(ListUtil.commaSeparatedList(earFilter)); entry.setZipFilter(ListUtil.commaSeparatedList(zipFilter)); @@ -166,12 +170,24 @@ public class ClassPathElement extends Path } + public void setApkfilter(String apkFilter) + { + this.apkFilter = apkFilter; + } + + public void setJarfilter(String jarFilter) { this.jarFilter = jarFilter; } + public void setAarfilter(String aarFilter) + { + this.aarFilter = aarFilter; + } + + public void setWarfilter(String warFilter) { this.warFilter = warFilter; diff --git a/src/proguard/ant/ClassSpecificationElement.java b/src/proguard/ant/ClassSpecificationElement.java index c07e101..146bf09 100644 --- a/src/proguard/ant/ClassSpecificationElement.java +++ b/src/proguard/ant/ClassSpecificationElement.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -23,7 +23,7 @@ package proguard.ant; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.DataType; import proguard.*; -import proguard.classfile.ClassConstants; +import proguard.classfile.*; import proguard.classfile.util.ClassUtil; import java.util.*; @@ -219,12 +219,12 @@ public class ClassSpecificationElement extends DataType token; int accessFlag = - strippedToken.equals(ClassConstants.EXTERNAL_ACC_PUBLIC) ? ClassConstants.INTERNAL_ACC_PUBLIC : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_FINAL) ? ClassConstants.INTERNAL_ACC_FINAL : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_ABSTRACT) ? ClassConstants.INTERNAL_ACC_ABSTRACT : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_SYNTHETIC) ? ClassConstants.INTERNAL_ACC_SYNTHETIC : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_ANNOTATION) ? ClassConstants.INTERNAL_ACC_ANNOTATTION : - 0; + strippedToken.equals(JavaConstants.ACC_PUBLIC) ? ClassConstants.ACC_PUBLIC : + strippedToken.equals(JavaConstants.ACC_FINAL) ? ClassConstants.ACC_FINAL : + strippedToken.equals(JavaConstants.ACC_ABSTRACT) ? ClassConstants.ACC_ABSTRACT : + strippedToken.equals(JavaConstants.ACC_SYNTHETIC) ? ClassConstants.ACC_SYNTHETIC : + strippedToken.equals(JavaConstants.ACC_ANNOTATION) ? ClassConstants.ACC_ANNOTATTION : + 0; if (accessFlag == 0) { @@ -239,12 +239,13 @@ public class ClassSpecificationElement extends DataType if (type != null && (type.startsWith("!") ^ set)) { int accessFlag = - type.equals("class") ? 0 : - type.equals( ClassConstants.EXTERNAL_ACC_INTERFACE) || - type.equals("!" + ClassConstants.EXTERNAL_ACC_INTERFACE) ? ClassConstants.INTERNAL_ACC_INTERFACE : - type.equals( ClassConstants.EXTERNAL_ACC_ENUM) || - type.equals("!" + ClassConstants.EXTERNAL_ACC_ENUM) ? ClassConstants.INTERNAL_ACC_ENUM : - -1; + type.equals("class") ? 0 : + type.equals( JavaConstants.ACC_INTERFACE) || + type.equals("!" + JavaConstants.ACC_INTERFACE) ? ClassConstants.ACC_INTERFACE : + type.equals( JavaConstants.ACC_ENUM) || + type.equals("!" + JavaConstants.ACC_ENUM) ? ClassConstants.ACC_ENUM : + -1; + if (accessFlag == -1) { throw new BuildException("Incorrect class type ["+type+"]"); diff --git a/src/proguard/ant/ConfigurationElement.java b/src/proguard/ant/ConfigurationElement.java index d184aef..f6e7be8 100644 --- a/src/proguard/ant/ConfigurationElement.java +++ b/src/proguard/ant/ConfigurationElement.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -23,7 +23,6 @@ package proguard.ant; import org.apache.tools.ant.*; import org.apache.tools.ant.types.*; import proguard.*; -import proguard.util.ListUtil; import java.io.*; import java.util.Properties; diff --git a/src/proguard/ant/ConfigurationTask.java b/src/proguard/ant/ConfigurationTask.java index 376a1a1..0bd1b35 100644 --- a/src/proguard/ant/ConfigurationTask.java +++ b/src/proguard/ant/ConfigurationTask.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/ant/FilterElement.java b/src/proguard/ant/FilterElement.java index ab3364a..b31313f 100644 --- a/src/proguard/ant/FilterElement.java +++ b/src/proguard/ant/FilterElement.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/ant/KeepSpecificationElement.java b/src/proguard/ant/KeepSpecificationElement.java index feabc18..06c3ff0 100644 --- a/src/proguard/ant/KeepSpecificationElement.java +++ b/src/proguard/ant/KeepSpecificationElement.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -31,6 +31,7 @@ import java.util.List; */ public class KeepSpecificationElement extends ClassSpecificationElement { + private boolean markDescriptorClasses; private boolean allowShrinking; private boolean allowOptimization; private boolean allowObfuscation; @@ -56,6 +57,7 @@ public class KeepSpecificationElement extends ClassSpecificationElement KeepClassSpecification keepClassSpecification = new KeepClassSpecification(markClasses, markConditionally, + markDescriptorClasses, allowShrinking, allowOptimization, allowObfuscation, @@ -68,6 +70,12 @@ public class KeepSpecificationElement extends ClassSpecificationElement // Ant task attributes. + public void setIncludedescriptorclasses(boolean markDescriptorClasses) + { + this.markDescriptorClasses = markDescriptorClasses; + } + + public void setAllowshrinking(boolean allowShrinking) { this.allowShrinking = allowShrinking; diff --git a/src/proguard/ant/MemberSpecificationElement.java b/src/proguard/ant/MemberSpecificationElement.java index 9762009..2cfa697 100644 --- a/src/proguard/ant/MemberSpecificationElement.java +++ b/src/proguard/ant/MemberSpecificationElement.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -23,7 +23,7 @@ package proguard.ant; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.DataType; import proguard.MemberSpecification; -import proguard.classfile.ClassConstants; +import proguard.classfile.*; import proguard.classfile.util.ClassUtil; import proguard.util.ListUtil; @@ -87,10 +87,10 @@ public class MemberSpecificationElement extends DataType if (parameters != null) { - type = ClassConstants.EXTERNAL_TYPE_VOID; + type = JavaConstants.TYPE_VOID; } - name = ClassConstants.INTERNAL_METHOD_NAME_INIT; + name = ClassConstants.METHOD_NAME_INIT; } else if ((type != null) ^ (parameters != null)) { @@ -187,21 +187,21 @@ public class MemberSpecificationElement extends DataType token; int accessFlag = - strippedToken.equals(ClassConstants.EXTERNAL_ACC_PUBLIC) ? ClassConstants.INTERNAL_ACC_PUBLIC : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_PRIVATE) ? ClassConstants.INTERNAL_ACC_PRIVATE : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_PROTECTED) ? ClassConstants.INTERNAL_ACC_PROTECTED : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_STATIC) ? ClassConstants.INTERNAL_ACC_STATIC : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_FINAL) ? ClassConstants.INTERNAL_ACC_FINAL : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_SYNCHRONIZED) ? ClassConstants.INTERNAL_ACC_SYNCHRONIZED : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_VOLATILE) ? ClassConstants.INTERNAL_ACC_VOLATILE : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_TRANSIENT) ? ClassConstants.INTERNAL_ACC_TRANSIENT : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_BRIDGE) ? ClassConstants.INTERNAL_ACC_BRIDGE : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_VARARGS) ? ClassConstants.INTERNAL_ACC_VARARGS : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_NATIVE) ? ClassConstants.INTERNAL_ACC_NATIVE : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_ABSTRACT) ? ClassConstants.INTERNAL_ACC_ABSTRACT : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_STRICT) ? ClassConstants.INTERNAL_ACC_STRICT : - strippedToken.equals(ClassConstants.EXTERNAL_ACC_SYNTHETIC) ? ClassConstants.INTERNAL_ACC_SYNTHETIC : - 0; + strippedToken.equals(JavaConstants.ACC_PUBLIC) ? ClassConstants.ACC_PUBLIC : + strippedToken.equals(JavaConstants.ACC_PRIVATE) ? ClassConstants.ACC_PRIVATE : + strippedToken.equals(JavaConstants.ACC_PROTECTED) ? ClassConstants.ACC_PROTECTED : + strippedToken.equals(JavaConstants.ACC_STATIC) ? ClassConstants.ACC_STATIC : + strippedToken.equals(JavaConstants.ACC_FINAL) ? ClassConstants.ACC_FINAL : + strippedToken.equals(JavaConstants.ACC_SYNCHRONIZED) ? ClassConstants.ACC_SYNCHRONIZED : + strippedToken.equals(JavaConstants.ACC_VOLATILE) ? ClassConstants.ACC_VOLATILE : + strippedToken.equals(JavaConstants.ACC_TRANSIENT) ? ClassConstants.ACC_TRANSIENT : + strippedToken.equals(JavaConstants.ACC_BRIDGE) ? ClassConstants.ACC_BRIDGE : + strippedToken.equals(JavaConstants.ACC_VARARGS) ? ClassConstants.ACC_VARARGS : + strippedToken.equals(JavaConstants.ACC_NATIVE) ? ClassConstants.ACC_NATIVE : + strippedToken.equals(JavaConstants.ACC_ABSTRACT) ? ClassConstants.ACC_ABSTRACT : + strippedToken.equals(JavaConstants.ACC_STRICT) ? ClassConstants.ACC_STRICT : + strippedToken.equals(JavaConstants.ACC_SYNTHETIC) ? ClassConstants.ACC_SYNTHETIC : + 0; if (accessFlag == 0) { diff --git a/src/proguard/ant/ProGuardTask.java b/src/proguard/ant/ProGuardTask.java index 7ab1cdf..f26f1b2 100644 --- a/src/proguard/ant/ProGuardTask.java +++ b/src/proguard/ant/ProGuardTask.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -51,18 +51,18 @@ public class ProGuardTask extends ConfigurationTask { parser.parse(configuration); } - catch (ParseException ex) + catch (ParseException e) { - throw new BuildException(ex.getMessage()); + throw new BuildException(e.getMessage(), e); } finally { parser.close(); } } - catch (IOException ex) + catch (IOException e) { - throw new BuildException(ex.getMessage()); + throw new BuildException(e.getMessage(), e); } } @@ -315,9 +315,9 @@ public class ProGuardTask extends ConfigurationTask ProGuard proGuard = new ProGuard(configuration); proGuard.execute(); } - catch (IOException ex) + catch (IOException e) { - throw new BuildException(ex.getMessage()); + throw new BuildException(e.getMessage(), e); } } |