Home | History | Annotate | Download | only in manual
      1 <!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      2 <html>
      3 <head>
      4 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
      5 <meta http-equiv="content-style-type" content="text/css">
      6 <link rel="stylesheet" type="text/css" href="style.css">
      7 <title>Ant Task</title>
      8 </head>
      9 <body>
     10 
     11 <script type="text/javascript" language="JavaScript">
     12 <!--
     13 if (window.self==window.top)
     14   document.write('<a class="largebutton" target="_top" href="../index.html#manual/ant.html">ProGuard index</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/dexguard">DexGuard</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/">Saikoa</a> <a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a>')
     15 //-->
     16 </script>
     17 <noscript>
     18 <a class="largebutton" target="_top"  href="../index.html#manual/ant.html">ProGuard index</a>
     19 <a class="largebutton" target="_top"  href="http://www.saikoa.com/dexguard">DexGuard</a>
     20 <a class="largebutton" target="_top"  href="http://www.saikoa.com/">Saikoa</a>
     21 <a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a>
     22 </noscript>
     23 
     24 <h2>Ant Task</h2>
     25 
     26 <b>ProGuard</b> can be run as a task in the Java-based build tool Ant (version
     27 1.8 or higher).
     28 <p>
     29 
     30 Before you can use the <code>proguard</code> task, you have to tell Ant about
     31 this new task. The easiest way is to add the following line to your
     32 <code>build.xml</code> file:
     33 <p>
     34 
     35 <pre>
     36 &lt;taskdef resource="proguard/ant/task.properties"
     37          classpath="/usr/local/java/proguard/lib/proguard.jar" /&gt;
     38 </pre>
     39 <p>
     40 
     41 Please make sure the class path is set correctly for your system.
     42 <p>
     43 
     44 There are three ways to configure the ProGuard task:
     45 <ol>
     46 <li>using an external configuration file,</li>
     47 <li>using embedded ProGuard configuration options, or</li>
     48 <li>using the equivalent XML configuration tags.</li>
     49 </ol>
     50 These three ways can be combined, depending on practical circumstances and
     51 personal preference.
     52 <p>
     53 
     54 <h3>1. An external ProGuard configuration file</h3>
     55 
     56 The simplest way to use the ProGuard task in an Ant build file is to keep your
     57 ProGuard configuration file, and include it from Ant. You can include your
     58 ProGuard configuration file by setting
     59 the <a href="#configuration_attribute"><code>configuration</code></a>
     60 attribute of your
     61 <code>proguard</code> task. Your ant build file will then look like this:
     62 <p>
     63 
     64 <pre>
     65 &lt;taskdef resource="proguard/ant/task.properties"
     66          classpath="/usr/local/java/proguard/lib/proguard.jar" /&gt;
     67 &lt;proguard configuration="myconfigfile.pro"/&gt;
     68 </pre>
     69 <p>
     70 
     71 This is a convenient option if you prefer ProGuard's configuration style over
     72 XML, if you want to keep your build file small, or if you have to share your
     73 configuration with developers who don't use Ant.
     74 <p>
     75 
     76 <h3>2. Embedded ProGuard configuration options</h3>
     77 
     78 Instead of keeping an external ProGuard configuration file, you can also copy
     79 the contents of the file into the nested text of the <code>proguard</code> task
     80 (the PCDATA area). Your Ant build file will then look like this:
     81 <p>
     82 
     83 <pre>
     84 &lt;taskdef resource="proguard/ant/task.properties"
     85          classpath="/usr/local/java/proguard/lib/proguard.jar" /&gt;
     86 &lt;proguard&gt;
     87   -libraryjars ${java.home}/lib/rt.jar
     88   -injars      in.jar
     89   -outjars     out.jar
     90 
     91   -keepclasseswithmembers public class * {
     92       public static void main(java.lang.String[]);
     93   }
     94 &lt;/proguard&gt;
     95 </pre>
     96 <p>
     97 
     98 Some minor syntactical changes are required in order to conform with the XML
     99 standard.
    100 <p>
    101 
    102 Firstly, the <code>#</code> character cannot be used for comments in an XML
    103 file. Comments must be enclosed by an opening <code>&lt;!--</code> and a
    104 closing <code>--&gt;</code>. All occurrences of the <code>#</code> character
    105 can be removed.
    106 <p>
    107 
    108 Secondly, the use of <code>&lt;</code> and <code>&gt;</code> characters would
    109 upset the structure of the XML build file. Environment variables can be
    110 specified with the usual Ant style <code>${...}</code>, instead of the ProGuard
    111 style <code>&lt;...&gt;</code>.  Other occurrences of <code>&lt;</code> and
    112 <code>&gt;</code> have to be encoded as <code>&amp;lt;</code> and
    113 <code>&amp;gt;</code> respectively.
    114 <p>
    115 
    116 <h3>3. XML configuration tags</h3>
    117 
    118 If you really prefer a full-blown XML configuration, you can replace the
    119 ProGuard configuration options by XML configuration tags. The resulting
    120 configuration will be equivalent, but much more verbose and difficult to read,
    121 as XML goes. The remainder of this page presents the supported tags. For a
    122 more extensive discussion of their meaning, please consult the traditional <a
    123 href="usage.html">Usage</a> section. You can find some sample configuration
    124 files in the <code>examples/ant</code> directory of the ProGuard distribution.
    125 <p>
    126 
    127 <h2><a name="proguard">Task Attributes and Nested Elements</a></h2>
    128 
    129 The <code><b>&lt;proguard&gt;</b></code> task and the
    130 <code><b>&lt;proguardconfiguration&gt;</b></code> task can have the following
    131 attributes (only for <code>&lt;proguard&gt;</code>) and nested
    132 elements:
    133 
    134 <dl>
    135 
    136 <dt><a name="configuration_attribute"><code><b>configuration</b></code></a>
    137     = "<i>filename</i>"</dt>
    138 <dd>Read and merge options from the given ProGuard-style configuration
    139     file. Note: for reading multiple configuration files or XML-style
    140     configurations, use the <a
    141     href="#configuration_element"><code>configuration</code></a>
    142     <i>element</i>.</dd>
    143 
    144 <dt><a href="usage.html#skipnonpubliclibraryclasses"><code><b>skipnonpubliclibraryclasses</b></code></a>
    145     = "<i>boolean</i>"
    146     (default = false)</dt>
    147 <dd>Ignore non-public library classes.</dd>
    148 
    149 <dt><a href="usage.html#dontskipnonpubliclibraryclassmembers"><code><b>skipnonpubliclibraryclassmembers</b></code></a>
    150     = "<i>boolean</i>"
    151     (default = true)</dt>
    152 <dd>Ignore package visible library class members.</dd>
    153 
    154 <dt><a href="usage.html#target"><code><b>target</b></code></a>
    155     = "<i>version</i>"
    156     (default = none)</dt>
    157 <dd>Set the given version number in the processed classes.</dd>
    158 
    159 <dt><a href="usage.html#forceprocessing"><code><b>forceprocessing</b></code></a>
    160     = "<i>boolean</i>"
    161     (default = false)</dt>
    162 <dd>Process the input, even if the output seems up to date.</dd>
    163 
    164 <dt><a href="usage.html#printseeds"><code><b>printseeds</b></code></a>
    165     = "<i>boolean or filename</i>"
    166     (default = false)</dt>
    167 <dd>List classes and class members matched by the various <code>keep</code>
    168     commands, to the standard output or to the given file.</dd>
    169 
    170 <dt><a href="usage.html#dontshrink"><code><b>shrink</b></code></a>
    171     = "<i>boolean</i>"
    172     (default = true)</dt>
    173 <dd>Shrink the input class files.</dd>
    174 
    175 <dt><a href="usage.html#printusage"><code><b>printusage</b></code></a>
    176     = "<i>boolean or filename</i>"
    177     (default = false)</dt>
    178 <dd>List dead code of the input class files, to the standard output or to the
    179     given file.</dd>
    180 
    181 <dt><a href="usage.html#dontoptimize"><code><b>optimize</b></code></a>
    182     = "<i>boolean</i>"
    183     (default = true)</dt>
    184 <dd>Optimize the input class files.</dd>
    185 
    186 <dt><a href="usage.html#optimizationpasses"><code><b>optimizationpasses</b></code></a>
    187     = "<i>n</i>"
    188     (default = 1)</dt>
    189 <dd>The number of optimization passes to be performed.</dd>
    190 
    191 <dt><a href="usage.html#allowaccessmodification"><code><b>allowaccessmodification</b></code></a>
    192     = "<i>boolean</i>"
    193     (default = false)</dt>
    194 <dd>Allow the access modifiers of classes and class members to be modified,
    195     while optimizing.</dd>
    196 
    197 <dt><a href="usage.html#mergeinterfacesaggressively"><code><b>mergeinterfacesaggressively</b></code></a>
    198     = "<i>boolean</i>"
    199     (default = false)</dt>
    200 <dd>Allow any interfaces to be merged, while optimizing.</dd>
    201 
    202 <dt><a href="usage.html#dontobfuscate"><code><b>obfuscate</b></code></a>
    203     = "<i>boolean</i>"
    204    (default = true)</dt>
    205 <dd>Obfuscate the input class files.</dd>
    206 
    207 <dt><a href="usage.html#printmapping"><code><b>printmapping</b></code></a>
    208     = "<i>boolean or filename</i>"
    209     (default = false)</dt>
    210 <dd>Print the mapping from old names to new names for classes and class members
    211     that have been renamed, to the standard output or to the given file.</dd>
    212 
    213 <dt><a href="usage.html#applymapping"><code><b>applymapping</b></code></a>
    214     = "<i>filename</i>"
    215     (default = none)</dt>
    216 <dd>Reuse the given mapping, for incremental obfuscation.</dd>
    217 
    218 <dt><a href="usage.html#obfuscationdictionary"><code><b>obfuscationdictionary</b></code></a>
    219     = "<i>filename</i>"
    220     (default = none)</dt>
    221 <dd>Use the words in the given text file as obfuscated field names and method
    222     names.</dd>
    223 
    224 <dt><a href="usage.html#classobfuscationdictionary"><code><b>classobfuscationdictionary</b></code></a>
    225     = "<i>filename</i>"
    226     (default = none)</dt>
    227 <dd>Use the words in the given text file as obfuscated class names.</dd>
    228 
    229 <dt><a href="usage.html#packageobfuscationdictionary"><code><b>packageobfuscationdictionary</b></code></a>
    230     = "<i>filename</i>"
    231     (default = none)</dt>
    232 <dd>Use the words in the given text file as obfuscated package names.</dd>
    233 
    234 <dt><a href="usage.html#overloadaggressively"><code><b>overloadaggressively</b></code></a>
    235     = "<i>boolean</i>"
    236     (default = false)</dt>
    237 <dd>Apply aggressive overloading while obfuscating.</dd>
    238 
    239 <dt><a href="usage.html#useuniqueclassmembernames"><code><b>useuniqueclassmembernames</b></code></a>
    240     = "<i>boolean</i>"
    241     (default = false)</dt>
    242 <dd>Ensure uniform obfuscated class member names for subsequent incremental
    243     obfuscation.</dd>
    244 
    245 <dt><a href="usage.html#dontusemixedcaseclassnames"><code><b>usemixedcaseclassnames</b></code></a>
    246     = "<i>boolean</i>"
    247     (default = true)</dt>
    248 <dd>Generate mixed-case class names while obfuscating.</dd>
    249 
    250 <dt><a href="usage.html#flattenpackagehierarchy"><code><b>flattenpackagehierarchy</b></code></a>
    251     = "<i>package_name</i>"
    252     (default = none)</dt>
    253 <dd>Repackage all packages that are renamed into the single given parent
    254     package.</dd>
    255 
    256 <dt><a href="usage.html#repackageclasses"><code><b>repackageclasses</b></code></a>
    257     = "<i>package_name</i>"
    258     (default = none)</dt>
    259 <dd>Repackage all class files that are renamed into the single given
    260     package.</dd>
    261 
    262 <dt><a href="usage.html#keepparameternames"><code><b>keepparameternames</b></code></a>
    263     = "<i>boolean</i>"
    264    (default = false)</dt>
    265 <dd>Keep the parameter names and types of methods that are kept.</dd>
    266 
    267 <dt><a href="usage.html#renamesourcefileattribute"><code><b>renamesourcefileattribute</b></code></a>
    268     = "<i>string</i>"
    269     (default = none)</dt>
    270 <dd>Put the given constant string in the <code>SourceFile</code>
    271     attributes.</dd>
    272 
    273 <dt><a href="usage.html#dontpreverify"><code><b>preverify</b></code></a>
    274     = "<i>boolean</i>"
    275     (default = true)</dt>
    276 <dd>Preverify the processed class files if they are targeted at Java Micro
    277     Edition or at Java 6 or higher.</dd>
    278 
    279 <dt><a href="usage.html#microedition"><code><b>microedition</b></code></a>
    280     = "<i>boolean</i>"
    281     (default = false)</dt>
    282 <dd>Target the processed class files at Java Micro Edition.</dd>
    283 
    284 <dt><a href="usage.html#verbose"><code><b>verbose</b></code></a>
    285     = "<i>boolean</i>"
    286     (default = false)</dt>
    287 <dd>Write out some more information during processing.</dd>
    288 
    289 <dt><a href="usage.html#dontnote"><code><b>note</b></code></a>
    290     = "<i>boolean</i>"
    291    (default = true)</dt>
    292 <dd>Print notes about potential mistakes or omissions in the configuration.
    293     Use the nested element <a href="#dontnote">dontnote</a> for more
    294     fine-grained control.</dd>
    295 
    296 <dt><a href="usage.html#dontwarn"><code><b>warn</b></code></a>
    297     = "<i>boolean</i>"
    298     (default = true)</dt>
    299 <dd>Print warnings about unresolved references. Use the nested
    300     element <a href="#dontwarn">dontwarn</a> for more fine-grained
    301     control. <i>Only use this option if you know what you're doing!</i></dd>
    302 
    303 <dt><a href="usage.html#ignorewarnings"><code><b>ignorewarnings</b></code></a>
    304     = "<i>boolean</i>"
    305     (default = false)</dt>
    306 <dd>Print warnings about unresolved references, but continue processing
    307     anyhow. <i>Only use this option if you know what you're doing!</i></dd>
    308 
    309 <dt><a href="usage.html#printconfiguration"><code><b>printconfiguration</b></code></a>
    310     = "<i>boolean or filename</i>"
    311     (default = false)</dt>
    312 <dd>Write out the entire configuration in traditional ProGuard style, to the
    313     standard output or to the given file. Useful to replace unreadable
    314     XML configurations.</dd>
    315 
    316 <dt><a href="usage.html#dump"><code><b>dump</b></code></a>
    317     = "<i>boolean or filename</i>"
    318     (default = false)</dt>
    319 <dd>Write out the internal structure of the processed class files, to the
    320     standard output or to the given file.</dd>
    321 
    322 <dt><a href="usage.html#injars"><code><b>&lt;injar</b></code></a>
    323     <a href="#classpath"><i>class_path</i></a>
    324     <code><b>/&gt;</b></code></dt>
    325 <dd>Specifies the program jars (or aars, wars, ears, zips, apks, or
    326     directories).</dd>
    327 
    328 <dt><a href="usage.html#outjars"><code><b>&lt;outjar</b></code></a>
    329     <a href="#classpath"><i>class_path</i></a>
    330     <code><b>/&gt;</b></code></dt>
    331 <dd>Specifies the names of the output jars (or aars, wars, ears, zips, apks, or
    332     directories).</dd>
    333 
    334 <dt><a href="usage.html#libraryjars"><code><b>&lt;libraryjar</b></code></a>
    335     <a href="#classpath"><i>class_path</i></a>
    336     <code><b>/&gt;</b></code></dt>
    337 <dd>Specifies the library jars (or aars, wars, ears, zips, apks, or
    338     directories).</dd>
    339 
    340 <dt><a href="usage.html#keepdirectories"><code><b>&lt;keepdirectory name = </b></code></a>"<i>directory_name</i>"
    341     <code><b>/&gt;</b></code><br/>
    342     <a href="usage.html#keepdirectories"><code><b>&lt;keepdirectories filter = </b></code></a>"<a href="usage.html#filefilters"><i>directory_filter</i></a>"
    343     <code><b>/&gt;</b></code></dt>
    344 <dd>Keep the specified directories in the output jars (or aars, wars, ears,
    345     zips, apks, or directories).</dd>
    346 
    347 <dt><a href="usage.html#keep"><code><b>&lt;keep</b></code></a>
    348     <a href="#keepmodifier"><i>modifiers</i></a>
    349     <a href="#classspecification"><i>class_specification</i></a>
    350     <code><b>&gt;</b></code>
    351     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    352     <code><b>&lt;/keep&gt;</b></code></dt>
    353 <dd>Preserve the specified classes <i>and</i> class members.</dd>
    354 
    355 <dt><a href="usage.html#keepclassmembers"><code><b>&lt;keepclassmembers</b></code></a>
    356     <a href="#keepmodifier"><i>modifiers</i></a>
    357     <a href="#classspecification"><i>class_specification</i></a>
    358     <code><b>&gt;</b></code>
    359     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    360     <code><b>&lt;/keepclassmembers&gt;</b></code></dt>
    361 <dd>Preserve the specified class members, if their classes are preserved as
    362     well.</dd>
    363 
    364 <dt><a href="usage.html#keepclasseswithmembers"><code><b>&lt;keepclasseswithmembers</b></code></a>
    365     <a href="#keepmodifier"><i>modifiers</i></a>
    366     <a href="#classspecification"><i>class_specification</i></a>
    367     <code><b>&gt;</b></code>
    368     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    369     <code><b>&lt;/keepclasseswithmembers&gt;</b></code></dt>
    370 <dd>Preserve the specified classes <i>and</i> class members, if all of the
    371     specified class members are present.</dd>
    372 
    373 <dt><a href="usage.html#keepnames"><code><b>&lt;keepnames</b></code></a>
    374     <a href="#classspecification"><i>class_specification</i></a>
    375     <code><b>&gt;</b></code>
    376     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    377     <code><b>&lt;/keepnames&gt;</b></code></dt>
    378 <dd>Preserve the names of the specified classes <i>and</i> class members (if
    379     they aren't removed in the shrinking step).</dd>
    380 
    381 <dt><a href="usage.html#keepclassmembernames"><code><b>&lt;keepclassmembernames</b></code></a>
    382     <a href="#classspecification"><i>class_specification</i></a>
    383     <code><b>&gt;</b></code>
    384     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    385     <code><b>&lt;/keepclassmembernames&gt;</b></code></dt>
    386 <dd>Preserve the names of the specified class members (if they aren't removed
    387     in the shrinking step).</dd>
    388 
    389 <dt><a href="usage.html#keepclasseswithmembernames"><code><b>&lt;keepclasseswithmembernames</b></code></a>
    390     <a href="#classspecification"><i>class_specification</i></a>
    391     <code><b>&gt;</b></code>
    392     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    393     <code><b>&lt;/keepclasseswithmembernames&gt;</b></code></dt>
    394 <dd>Preserve the names of the specified classes <i>and</i> class members, if
    395     all of the specified class members are present (after the shrinking
    396     step).</dd>
    397 
    398 <dt><a href="usage.html#whyareyoukeeping"><code><b>&lt;whyareyoukeeping</b></code></a>
    399     <a href="#classspecification"><i>class_specification</i></a>
    400     <code><b>&gt;</b></code>
    401     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    402     <code><b>&lt;/whyareyoukeeping&gt;</b></code></dt>
    403 <dd>Print details on why the given classes and class members are being kept in
    404     the shrinking step.</dd>
    405 
    406 <dt><a href="usage.html#assumenosideeffects"><code><b>&lt;assumenosideeffects</b></code></a>
    407     <a href="#classspecification"><i>class_specification</i></a>
    408     <code><b>&gt;</b></code>
    409     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    410     <code><b>&lt;/assumenosideeffects&gt;</b></code></dt>
    411 <dd>Assume that the specified methods don't have any side effects, while
    412     optimizing. <i>Only use this option if you know what you're
    413     doing!</i></dd>
    414 
    415 <dt><a href="usage.html#optimizations"><code><b>&lt;optimization name = </b></code></a>"<a href="optimizations.html"><i>optimization_name</i></a>"
    416     <code><b>/&gt;</b></code><br/>
    417     <a href="usage.html#optimizations"><code><b>&lt;optimizations filter = </b></code></a>""<a href="optimizations.html"><i>optimization_filter</i></a>"
    418     <code><b>/&gt;</b></code></dt>
    419 <dd>Perform only the specified optimizations.</dd>
    420 
    421 <dt><a href="usage.html#keeppackagenames"><code><b>&lt;keeppackagename name = </b></code></a>"<i>package_name</i>"
    422     <code><b>/&gt;</b></code><br/>
    423     <a href="usage.html#keeppackagenames"><code><b>&lt;keeppackagenames filter = </b></code></a>"<a href="usage.html#filters"><i>package_filter</i></a>"
    424     <code><b>/&gt;</b></code></dt>
    425 <dd>Keep the specified package names from being obfuscated. If no name is
    426     given, all package names are preserved.</dd>
    427 
    428 <dt><a href="usage.html#keepattributes"><code><b>&lt;keepattribute name = </b></code></a>"<i>attribute_name</i>"
    429     <code><b>/&gt;</b></code><br/>
    430     <a href="usage.html#keepattributes"><code><b>&lt;keepattributes filter = </b></code></a>"<a href="usage.html#filters"><i>attribute_filter</i></a>"
    431     <code><b>/&gt;</b></code></dt>
    432 <dd>Preserve the specified optional Java bytecode attributes, with optional
    433     wildcards. If no name is given, all attributes are preserved.</dd>
    434 
    435 <dt><a href="usage.html#adaptclassstrings"><code><b>&lt;adaptclassstrings filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
    436     <code><b>/&gt;</b></code></dt>
    437 <dd>Adapt string constants in the specified classes, based on the obfuscated
    438     names of any corresponding classes.</dd>
    439 
    440 <dt><a href="usage.html#adaptresourcefilenames"><code><b>&lt;adaptresourcefilenames filter = </b></code></a>"<a href="usage.html#filefilters"><i>file_filter</i></a>"
    441     <code><b>/&gt;</b></code></dt>
    442 <dd>Rename the specified resource files, based on the obfuscated names of the
    443     corresponding class files.</dd>
    444 
    445 <dt><a href="usage.html#adaptresourcefilecontents"><code><b>&lt;adaptresourcefilecontents filter = </b></code></a>"<a href="usage.html#filefilters"><i>file_filter</i></a>"
    446     <code><b>/&gt;</b></code></dt>
    447 <dd>Update the contents of the specified resource files, based on the
    448     obfuscated names of the processed classes.</dd>
    449 
    450 <dt><a name="dontnote" />
    451     <a href="usage.html#dontnote"><code><b>&lt;dontnote filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
    452     <code><b>/&gt;</b></code></dt>
    453 <dd>Don't print notes about classes matching the specified class name
    454     filter.</dd>
    455 
    456 <dt><a name="dontwarn" />
    457     <a href="usage.html#dontwarn"><code><b>&lt;dontwarn filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
    458     <code><b>/&gt;</b></code></dt>
    459 <dd>Don't print warnings about classes matching the specified class name
    460     filter. <i>Only use this option if you know what you're doing!</i></dd>
    461 
    462 <dt><a name="configuration_element"><code><b>&lt;configuration refid = </b></code></a>"<i>ref_id</i>"
    463     <code><b>/&gt;</b></code><br/>
    464     <code><b>&lt;configuration file = </b></code>"<i>name</i>"
    465     <code><b>/&gt;</b></code></dt>
    466 <dd>The first form includes the XML-style configuration specified in a
    467     <code>&lt;proguardconfiguration&gt;</code> task (or
    468     <code>&lt;proguard&gt;</code> task) with attribute <code>id</code> =
    469     "<i>ref_id</i>". Only the nested elements of this configuration are
    470     considered, not the attributes.
    471     <p>
    472     The second form includes the ProGuard-style configuration from the specified
    473     file. The element is actually a <code>fileset</code> element and supports
    474     all of its attributes and nested elements, including multiple files.
    475     </dd>
    476 
    477 </dl>
    478 
    479 <h2><a name="classpath">Class Path Attributes and Nested Elements</a></h2>
    480 
    481 The jar elements are <code>path</code> elements, so they can have any of the
    482 standard <code>path</code> attributes and nested elements. The most common
    483 attributes are:
    484 
    485 <dl>
    486 
    487 <dt><code><b>path</b></code> = "<i>path</i>"</dt>
    488 <dd>The names of the jars (or aars, wars, ears, zips, apks, or directories),
    489     separated by the path separator.</dd>
    490 
    491 <dt><code><b>location</b></code> = "<i>name</i>" (or <code><b>file</b></code>
    492     = "<i>name</i>", or <code><b>dir</b></code> = "<i>name</i>", or
    493     <code><b>name</b></code> = "<i>name</i>")</dt>
    494 <dd>Alternatively, the name of a single jar (or aar, war, ear, zip, or
    495     directory).</dd>
    496 
    497 <dt><code><b>refid</b></code> = "<i>ref_id</i>"</dt>
    498 <dd>Alternatively, a reference to the path or file set with the attribute
    499     <code>id</code> = "<i>ref_id</i>".</dd>
    500 
    501 </dl>
    502 
    503 In addition, the jar elements can have ProGuard-style filter attributes:
    504 
    505 <dl>
    506 
    507 <dt><code><b>filter</b></code> =
    508     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    509 <dd>An optional filter for all class file names and resource file names that
    510     are encountered.</dd>
    511 
    512 <dt><code><b>apkfilter</b></code> =
    513     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    514 <dd>An optional filter for all apk names that are encountered.</dd>
    515 
    516 <dt><code><b>jarfilter</b></code> =
    517     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    518 <dd>An optional filter for all jar names that are encountered.</dd>
    519 
    520 <dt><code><b>aarfilter</b></code> =
    521     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    522 <dd>An optional filter for all aar names that are encountered.</dd>
    523 
    524 <dt><code><b>warfilter</b></code> =
    525     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    526 <dd>An optional filter for all war names that are encountered.</dd>
    527 
    528 <dt><code><b>earfilter</b></code> =
    529     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    530 <dd>An optional filter for all ear names that are encountered.</dd>
    531 
    532 <dt><code><b>zipfilter</b></code> =
    533     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    534 <dd>An optional filter for all zip names that are encountered.</dd>
    535 
    536 </dl>
    537 
    538 <h2><a name="keepmodifier">Keep Modifier Attributes</a></h2>
    539 
    540 The keep tags can have the following <i>modifier</i> attributes:
    541 
    542 <dl>
    543 
    544 <dt><a href="usage.html#includedescriptorclasses"><code><b>includedescriptorclasses</b></code></a>
    545     = "<i>boolean</i>"
    546     (default = false)</dt>
    547 <dd>Specifies whether the classes of the fields and methods specified in the
    548     keep tag must be kept as well.</dd>
    549 
    550 <dt><a href="usage.html#allowshrinking"><code><b>allowshrinking</b></code></a>
    551     = "<i>boolean</i>"
    552     (default = false)</dt>
    553 <dd>Specifies whether the entry points specified in the keep tag may be
    554     shrunk.</dd>
    555 
    556 <dt><a href="usage.html#allowoptimization"><code><b>allowoptimization</b></code></a>
    557     = "<i>boolean</i>"
    558     (default = false)</dt>
    559 <dd>Specifies whether the entry points specified in the keep tag may be
    560     optimized.</dd>
    561 
    562 <dt><a href="usage.html#allowobfuscation"><code><b>allowobfuscation</b></code></a>
    563     = "<i>boolean</i>"
    564     (default = false)</dt>
    565 <dd>Specifies whether the entry points specified in the keep tag may be
    566     obfuscated.</dd>
    567 
    568 </dl>
    569 
    570 <h2><a name="classspecification">Class Specification Attributes and Nested Elements</a></h2>
    571 
    572 The keep tags can have the following <i>class_specification</i> attributes and
    573 <i>class_member_specifications</i> nested elements:
    574 
    575 <dl>
    576 
    577 <dt><code><b>access</b></code> = "<i>access_modifiers</i>"</dt>
    578 <dd>The optional access modifiers of the class. Any space-separated list of
    579     "public", "final", and "abstract", with optional negators "!".</dd>
    580 
    581 <dt><code><b>annotation</b></code> = "<i>annotation_name</i>"</dt>
    582 <dd>The optional fully qualified name of an annotation of the class, with
    583     optional wildcards.</dd>
    584 
    585 <dt><code><b>type</b></code> = "<i>type</i>"</dt>
    586 <dd>The optional type of the class: one of "class", "interface", or
    587     "!interface".</dd>
    588 
    589 <dt><code><b>name</b></code> = "<i>class_name</i>"</dt>
    590 <dd>The optional fully qualified name of the class, with optional
    591     wildcards.</dd>
    592 
    593 <dt><code><b>extendsannotation</b></code> = "<i>annotation_name</i>"</dt>
    594 <dd>The optional fully qualified name of an annotation of the the class that
    595     the specified classes must extend, with optional wildcards.</dd>
    596 
    597 <dt><code><b>extends</b></code> = "<i>class_name</i>"</dt>
    598 <dd>The optional fully qualified name of the class the specified classes
    599     must extend, with optional wildcards.</dd>
    600 
    601 <dt><code><b>implements</b></code> = "<i>class_name</i>"</dt>
    602 <dd>The optional fully qualified name of the class the specified classes
    603     must implement, with optional wildcards.</dd>
    604 
    605 <dt><code><b>&lt;field</b></code>
    606     <a href="#classmemberspecification"><i>class_member_specification</i></a>
    607     <code><b>/&gt;</b></code></dt>
    608 <dd>Specifies a field.</dd>
    609 
    610 <dt><code><b>&lt;method</b></code>
    611     <a href="#classmemberspecification"><i>class_member_specification</i></a>
    612     <code><b>/&gt;</b></code></dt>
    613 <dd>Specifies a method.</dd>
    614 
    615 <dt><code><b>&lt;constructor</b></code>
    616     <a href="#classmemberspecification"><i>class_member_specification</i></a>
    617     <code><b>/&gt;</b></code></dt>
    618 <dd>Specifies a constructor.</dd>
    619 
    620 </dl>
    621 
    622 <h2><a name="classmemberspecification">Class Member Specification Attributes</a></h2>
    623 
    624 The class member tags can have the following <i>class_member_specification</i>
    625 attributes:
    626 
    627 <dl>
    628 
    629 <dt><code><b>access</b></code> = "<i>access_modifiers</i>"</dt>
    630 <dd>The optional access modifiers of the class. Any space-separated list of
    631     "public", "protected", "private", "static", etc., with optional negators
    632     "!".</dd>
    633 
    634 <dt><code><b>annotation</b></code> = "<i>annotation_name</i>"</dt>
    635 <dd>The optional fully qualified name of an annotation of the class member,
    636     with optional wildcards.</dd>
    637 
    638 <dt><code><b>type</b></code> = "<i>type</i>"</dt>
    639 <dd>The optional fully qualified type of the class member, with optional
    640     wildcards. Not applicable for constructors, but required for methods for
    641     which the <code>parameters</code> attribute is specified.</dd>
    642 
    643 <dt><code><b>name</b></code> = "<i>name</i>"</dt>
    644 <dd>The optional name of the class member, with optional wildcards. Not
    645     applicable for constructors.</dd>
    646 
    647 <dt><code><b>parameters</b></code> = "<i>parameters</i>"</dt>
    648 <dd>The optional comma-separated list of fully qualified method parameters,
    649     with optional wildcards. Not applicable for fields, but required for
    650     constructors, and for methods for which the <code>type</code> attribute is
    651     specified.</dd>
    652 
    653 </dl>
    654 
    655 <hr />
    656 <address>
    657 Copyright &copy; 2002-2014
    658 <a target="other" href="http://www.lafortune.eu/">Eric Lafortune</a> @ <a target="top" href="http://www.saikoa.com/">Saikoa</a>.
    659 </address>
    660 </body>
    661 </html>
    662