662 строки
28 KiB
HTML
662 строки
28 KiB
HTML
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
|
<meta http-equiv="content-style-type" content="text/css">
|
|
<link rel="stylesheet" type="text/css" href="style.css">
|
|
<title>Ant Task</title>
|
|
</head>
|
|
<body>
|
|
|
|
<script type="text/javascript" language="JavaScript">
|
|
<!--
|
|
if (window.self==window.top)
|
|
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>')
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<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>
|
|
</noscript>
|
|
|
|
<h2>Ant Task</h2>
|
|
|
|
<b>ProGuard</b> can be run as a task in the Java-based build tool Ant (version
|
|
1.8 or higher).
|
|
<p>
|
|
|
|
Before you can use the <code>proguard</code> task, you have to tell Ant about
|
|
this new task. The easiest way is to add the following line to your
|
|
<code>build.xml</code> file:
|
|
<p>
|
|
|
|
<pre>
|
|
<taskdef resource="proguard/ant/task.properties"
|
|
classpath="/usr/local/java/proguard/lib/proguard.jar" />
|
|
</pre>
|
|
<p>
|
|
|
|
Please make sure the class path is set correctly for your system.
|
|
<p>
|
|
|
|
There are three ways to configure the ProGuard task:
|
|
<ol>
|
|
<li>using an external configuration file,</li>
|
|
<li>using embedded ProGuard configuration options, or</li>
|
|
<li>using the equivalent XML configuration tags.</li>
|
|
</ol>
|
|
These three ways can be combined, depending on practical circumstances and
|
|
personal preference.
|
|
<p>
|
|
|
|
<h3>1. An external ProGuard configuration file</h3>
|
|
|
|
The simplest way to use the ProGuard task in an Ant build file is to keep your
|
|
ProGuard configuration file, and include it from Ant. You can include your
|
|
ProGuard configuration file by setting
|
|
the <a href="#configuration_attribute"><code>configuration</code></a>
|
|
attribute of your
|
|
<code>proguard</code> task. Your ant build file will then look like this:
|
|
<p>
|
|
|
|
<pre>
|
|
<taskdef resource="proguard/ant/task.properties"
|
|
classpath="/usr/local/java/proguard/lib/proguard.jar" />
|
|
<proguard configuration="myconfigfile.pro"/>
|
|
</pre>
|
|
<p>
|
|
|
|
This is a convenient option if you prefer ProGuard's configuration style over
|
|
XML, if you want to keep your build file small, or if you have to share your
|
|
configuration with developers who don't use Ant.
|
|
<p>
|
|
|
|
<h3>2. Embedded ProGuard configuration options</h3>
|
|
|
|
Instead of keeping an external ProGuard configuration file, you can also copy
|
|
the contents of the file into the nested text of the <code>proguard</code> task
|
|
(the PCDATA area). Your Ant build file will then look like this:
|
|
<p>
|
|
|
|
<pre>
|
|
<taskdef resource="proguard/ant/task.properties"
|
|
classpath="/usr/local/java/proguard/lib/proguard.jar" />
|
|
<proguard>
|
|
-libraryjars ${java.home}/lib/rt.jar
|
|
-injars in.jar
|
|
-outjars out.jar
|
|
|
|
-keepclasseswithmembers public class * {
|
|
public static void main(java.lang.String[]);
|
|
}
|
|
</proguard>
|
|
</pre>
|
|
<p>
|
|
|
|
Some minor syntactical changes are required in order to conform with the XML
|
|
standard.
|
|
<p>
|
|
|
|
Firstly, the <code>#</code> character cannot be used for comments in an XML
|
|
file. Comments must be enclosed by an opening <code><!--</code> and a
|
|
closing <code>--></code>. All occurrences of the <code>#</code> character
|
|
can be removed.
|
|
<p>
|
|
|
|
Secondly, the use of <code><</code> and <code>></code> characters would
|
|
upset the structure of the XML build file. Environment variables can be
|
|
specified with the usual Ant style <code>${...}</code>, instead of the ProGuard
|
|
style <code><...></code>. Other occurrences of <code><</code> and
|
|
<code>></code> have to be encoded as <code>&lt;</code> and
|
|
<code>&gt;</code> respectively.
|
|
<p>
|
|
|
|
<h3>3. XML configuration tags</h3>
|
|
|
|
If you really prefer a full-blown XML configuration, you can replace the
|
|
ProGuard configuration options by XML configuration tags. The resulting
|
|
configuration will be equivalent, but much more verbose and difficult to read,
|
|
as XML goes. The remainder of this page presents the supported tags. For a
|
|
more extensive discussion of their meaning, please consult the traditional <a
|
|
href="usage.html">Usage</a> section. You can find some sample configuration
|
|
files in the <code>examples/ant</code> directory of the ProGuard distribution.
|
|
<p>
|
|
|
|
<h2><a name="proguard">Task Attributes and Nested Elements</a></h2>
|
|
|
|
The <code><b><proguard></b></code> task and the
|
|
<code><b><proguardconfiguration></b></code> task can have the following
|
|
attributes (only for <code><proguard></code>) and nested
|
|
elements:
|
|
|
|
<dl>
|
|
|
|
<dt><a name="configuration_attribute"><code><b>configuration</b></code></a>
|
|
= "<i>filename</i>"</dt>
|
|
<dd>Read and merge options from the given ProGuard-style configuration
|
|
file. Note: for reading multiple configuration files or XML-style
|
|
configurations, use the <a
|
|
href="#configuration_element"><code>configuration</code></a>
|
|
<i>element</i>.</dd>
|
|
|
|
<dt><a href="usage.html#skipnonpubliclibraryclasses"><code><b>skipnonpubliclibraryclasses</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Ignore non-public library classes.</dd>
|
|
|
|
<dt><a href="usage.html#dontskipnonpubliclibraryclassmembers"><code><b>skipnonpubliclibraryclassmembers</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Ignore package visible library class members.</dd>
|
|
|
|
<dt><a href="usage.html#target"><code><b>target</b></code></a>
|
|
= "<i>version</i>"
|
|
(default = none)</dt>
|
|
<dd>Set the given version number in the processed classes.</dd>
|
|
|
|
<dt><a href="usage.html#forceprocessing"><code><b>forceprocessing</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Process the input, even if the output seems up to date.</dd>
|
|
|
|
<dt><a href="usage.html#printseeds"><code><b>printseeds</b></code></a>
|
|
= "<i>boolean or filename</i>"
|
|
(default = false)</dt>
|
|
<dd>List classes and class members matched by the various <code>keep</code>
|
|
commands, to the standard output or to the given file.</dd>
|
|
|
|
<dt><a href="usage.html#dontshrink"><code><b>shrink</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Shrink the input class files.</dd>
|
|
|
|
<dt><a href="usage.html#printusage"><code><b>printusage</b></code></a>
|
|
= "<i>boolean or filename</i>"
|
|
(default = false)</dt>
|
|
<dd>List dead code of the input class files, to the standard output or to the
|
|
given file.</dd>
|
|
|
|
<dt><a href="usage.html#dontoptimize"><code><b>optimize</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Optimize the input class files.</dd>
|
|
|
|
<dt><a href="usage.html#optimizationpasses"><code><b>optimizationpasses</b></code></a>
|
|
= "<i>n</i>"
|
|
(default = 1)</dt>
|
|
<dd>The number of optimization passes to be performed.</dd>
|
|
|
|
<dt><a href="usage.html#allowaccessmodification"><code><b>allowaccessmodification</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Allow the access modifiers of classes and class members to be modified,
|
|
while optimizing.</dd>
|
|
|
|
<dt><a href="usage.html#mergeinterfacesaggressively"><code><b>mergeinterfacesaggressively</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Allow any interfaces to be merged, while optimizing.</dd>
|
|
|
|
<dt><a href="usage.html#dontobfuscate"><code><b>obfuscate</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Obfuscate the input class files.</dd>
|
|
|
|
<dt><a href="usage.html#printmapping"><code><b>printmapping</b></code></a>
|
|
= "<i>boolean or filename</i>"
|
|
(default = false)</dt>
|
|
<dd>Print the mapping from old names to new names for classes and class members
|
|
that have been renamed, to the standard output or to the given file.</dd>
|
|
|
|
<dt><a href="usage.html#applymapping"><code><b>applymapping</b></code></a>
|
|
= "<i>filename</i>"
|
|
(default = none)</dt>
|
|
<dd>Reuse the given mapping, for incremental obfuscation.</dd>
|
|
|
|
<dt><a href="usage.html#obfuscationdictionary"><code><b>obfuscationdictionary</b></code></a>
|
|
= "<i>filename</i>"
|
|
(default = none)</dt>
|
|
<dd>Use the words in the given text file as obfuscated field names and method
|
|
names.</dd>
|
|
|
|
<dt><a href="usage.html#classobfuscationdictionary"><code><b>classobfuscationdictionary</b></code></a>
|
|
= "<i>filename</i>"
|
|
(default = none)</dt>
|
|
<dd>Use the words in the given text file as obfuscated class names.</dd>
|
|
|
|
<dt><a href="usage.html#packageobfuscationdictionary"><code><b>packageobfuscationdictionary</b></code></a>
|
|
= "<i>filename</i>"
|
|
(default = none)</dt>
|
|
<dd>Use the words in the given text file as obfuscated package names.</dd>
|
|
|
|
<dt><a href="usage.html#overloadaggressively"><code><b>overloadaggressively</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Apply aggressive overloading while obfuscating.</dd>
|
|
|
|
<dt><a href="usage.html#useuniqueclassmembernames"><code><b>useuniqueclassmembernames</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Ensure uniform obfuscated class member names for subsequent incremental
|
|
obfuscation.</dd>
|
|
|
|
<dt><a href="usage.html#dontusemixedcaseclassnames"><code><b>usemixedcaseclassnames</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Generate mixed-case class names while obfuscating.</dd>
|
|
|
|
<dt><a href="usage.html#flattenpackagehierarchy"><code><b>flattenpackagehierarchy</b></code></a>
|
|
= "<i>package_name</i>"
|
|
(default = none)</dt>
|
|
<dd>Repackage all packages that are renamed into the single given parent
|
|
package.</dd>
|
|
|
|
<dt><a href="usage.html#repackageclasses"><code><b>repackageclasses</b></code></a>
|
|
= "<i>package_name</i>"
|
|
(default = none)</dt>
|
|
<dd>Repackage all class files that are renamed into the single given
|
|
package.</dd>
|
|
|
|
<dt><a href="usage.html#keepparameternames"><code><b>keepparameternames</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Keep the parameter names and types of methods that are kept.</dd>
|
|
|
|
<dt><a href="usage.html#renamesourcefileattribute"><code><b>renamesourcefileattribute</b></code></a>
|
|
= "<i>string</i>"
|
|
(default = none)</dt>
|
|
<dd>Put the given constant string in the <code>SourceFile</code>
|
|
attributes.</dd>
|
|
|
|
<dt><a href="usage.html#dontpreverify"><code><b>preverify</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Preverify the processed class files if they are targeted at Java Micro
|
|
Edition or at Java 6 or higher.</dd>
|
|
|
|
<dt><a href="usage.html#microedition"><code><b>microedition</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Target the processed class files at Java Micro Edition.</dd>
|
|
|
|
<dt><a href="usage.html#verbose"><code><b>verbose</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Write out some more information during processing.</dd>
|
|
|
|
<dt><a href="usage.html#dontnote"><code><b>note</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Print notes about potential mistakes or omissions in the configuration.
|
|
Use the nested element <a href="#dontnote">dontnote</a> for more
|
|
fine-grained control.</dd>
|
|
|
|
<dt><a href="usage.html#dontwarn"><code><b>warn</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = true)</dt>
|
|
<dd>Print warnings about unresolved references. Use the nested
|
|
element <a href="#dontwarn">dontwarn</a> for more fine-grained
|
|
control. <i>Only use this option if you know what you're doing!</i></dd>
|
|
|
|
<dt><a href="usage.html#ignorewarnings"><code><b>ignorewarnings</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Print warnings about unresolved references, but continue processing
|
|
anyhow. <i>Only use this option if you know what you're doing!</i></dd>
|
|
|
|
<dt><a href="usage.html#printconfiguration"><code><b>printconfiguration</b></code></a>
|
|
= "<i>boolean or filename</i>"
|
|
(default = false)</dt>
|
|
<dd>Write out the entire configuration in traditional ProGuard style, to the
|
|
standard output or to the given file. Useful to replace unreadable
|
|
XML configurations.</dd>
|
|
|
|
<dt><a href="usage.html#dump"><code><b>dump</b></code></a>
|
|
= "<i>boolean or filename</i>"
|
|
(default = false)</dt>
|
|
<dd>Write out the internal structure of the processed class files, to the
|
|
standard output or to the given file.</dd>
|
|
|
|
<dt><a href="usage.html#injars"><code><b><injar</b></code></a>
|
|
<a href="#classpath"><i>class_path</i></a>
|
|
<code><b>/></b></code></dt>
|
|
<dd>Specifies the program jars (or aars, wars, ears, zips, apks, or
|
|
directories).</dd>
|
|
|
|
<dt><a href="usage.html#outjars"><code><b><outjar</b></code></a>
|
|
<a href="#classpath"><i>class_path</i></a>
|
|
<code><b>/></b></code></dt>
|
|
<dd>Specifies the names of the output jars (or aars, wars, ears, zips, apks, or
|
|
directories).</dd>
|
|
|
|
<dt><a href="usage.html#libraryjars"><code><b><libraryjar</b></code></a>
|
|
<a href="#classpath"><i>class_path</i></a>
|
|
<code><b>/></b></code></dt>
|
|
<dd>Specifies the library jars (or aars, wars, ears, zips, apks, or
|
|
directories).</dd>
|
|
|
|
<dt><a href="usage.html#keepdirectories"><code><b><keepdirectory name = </b></code></a>"<i>directory_name</i>"
|
|
<code><b>/></b></code><br/>
|
|
<a href="usage.html#keepdirectories"><code><b><keepdirectories filter = </b></code></a>"<a href="usage.html#filefilters"><i>directory_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Keep the specified directories in the output jars (or aars, wars, ears,
|
|
zips, apks, or directories).</dd>
|
|
|
|
<dt><a href="usage.html#keep"><code><b><keep</b></code></a>
|
|
<a href="#keepmodifier"><i>modifiers</i></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></keep></b></code></dt>
|
|
<dd>Preserve the specified classes <i>and</i> class members.</dd>
|
|
|
|
<dt><a href="usage.html#keepclassmembers"><code><b><keepclassmembers</b></code></a>
|
|
<a href="#keepmodifier"><i>modifiers</i></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></keepclassmembers></b></code></dt>
|
|
<dd>Preserve the specified class members, if their classes are preserved as
|
|
well.</dd>
|
|
|
|
<dt><a href="usage.html#keepclasseswithmembers"><code><b><keepclasseswithmembers</b></code></a>
|
|
<a href="#keepmodifier"><i>modifiers</i></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></keepclasseswithmembers></b></code></dt>
|
|
<dd>Preserve the specified classes <i>and</i> class members, if all of the
|
|
specified class members are present.</dd>
|
|
|
|
<dt><a href="usage.html#keepnames"><code><b><keepnames</b></code></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></keepnames></b></code></dt>
|
|
<dd>Preserve the names of the specified classes <i>and</i> class members (if
|
|
they aren't removed in the shrinking step).</dd>
|
|
|
|
<dt><a href="usage.html#keepclassmembernames"><code><b><keepclassmembernames</b></code></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></keepclassmembernames></b></code></dt>
|
|
<dd>Preserve the names of the specified class members (if they aren't removed
|
|
in the shrinking step).</dd>
|
|
|
|
<dt><a href="usage.html#keepclasseswithmembernames"><code><b><keepclasseswithmembernames</b></code></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></keepclasseswithmembernames></b></code></dt>
|
|
<dd>Preserve the names of the specified classes <i>and</i> class members, if
|
|
all of the specified class members are present (after the shrinking
|
|
step).</dd>
|
|
|
|
<dt><a href="usage.html#whyareyoukeeping"><code><b><whyareyoukeeping</b></code></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></whyareyoukeeping></b></code></dt>
|
|
<dd>Print details on why the given classes and class members are being kept in
|
|
the shrinking step.</dd>
|
|
|
|
<dt><a href="usage.html#assumenosideeffects"><code><b><assumenosideeffects</b></code></a>
|
|
<a href="#classspecification"><i>class_specification</i></a>
|
|
<code><b>></b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specifications</i></a>
|
|
<code><b></assumenosideeffects></b></code></dt>
|
|
<dd>Assume that the specified methods don't have any side effects, while
|
|
optimizing. <i>Only use this option if you know what you're
|
|
doing!</i></dd>
|
|
|
|
<dt><a href="usage.html#optimizations"><code><b><optimization name = </b></code></a>"<a href="optimizations.html"><i>optimization_name</i></a>"
|
|
<code><b>/></b></code><br/>
|
|
<a href="usage.html#optimizations"><code><b><optimizations filter = </b></code></a>""<a href="optimizations.html"><i>optimization_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Perform only the specified optimizations.</dd>
|
|
|
|
<dt><a href="usage.html#keeppackagenames"><code><b><keeppackagename name = </b></code></a>"<i>package_name</i>"
|
|
<code><b>/></b></code><br/>
|
|
<a href="usage.html#keeppackagenames"><code><b><keeppackagenames filter = </b></code></a>"<a href="usage.html#filters"><i>package_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Keep the specified package names from being obfuscated. If no name is
|
|
given, all package names are preserved.</dd>
|
|
|
|
<dt><a href="usage.html#keepattributes"><code><b><keepattribute name = </b></code></a>"<i>attribute_name</i>"
|
|
<code><b>/></b></code><br/>
|
|
<a href="usage.html#keepattributes"><code><b><keepattributes filter = </b></code></a>"<a href="usage.html#filters"><i>attribute_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Preserve the specified optional Java bytecode attributes, with optional
|
|
wildcards. If no name is given, all attributes are preserved.</dd>
|
|
|
|
<dt><a href="usage.html#adaptclassstrings"><code><b><adaptclassstrings filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Adapt string constants in the specified classes, based on the obfuscated
|
|
names of any corresponding classes.</dd>
|
|
|
|
<dt><a href="usage.html#adaptresourcefilenames"><code><b><adaptresourcefilenames filter = </b></code></a>"<a href="usage.html#filefilters"><i>file_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Rename the specified resource files, based on the obfuscated names of the
|
|
corresponding class files.</dd>
|
|
|
|
<dt><a href="usage.html#adaptresourcefilecontents"><code><b><adaptresourcefilecontents filter = </b></code></a>"<a href="usage.html#filefilters"><i>file_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Update the contents of the specified resource files, based on the
|
|
obfuscated names of the processed classes.</dd>
|
|
|
|
<dt><a name="dontnote" />
|
|
<a href="usage.html#dontnote"><code><b><dontnote filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Don't print notes about classes matching the specified class name
|
|
filter.</dd>
|
|
|
|
<dt><a name="dontwarn" />
|
|
<a href="usage.html#dontwarn"><code><b><dontwarn filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>Don't print warnings about classes matching the specified class name
|
|
filter. <i>Only use this option if you know what you're doing!</i></dd>
|
|
|
|
<dt><a name="configuration_element"><code><b><configuration refid = </b></code></a>"<i>ref_id</i>"
|
|
<code><b>/></b></code><br/>
|
|
<code><b><configuration file = </b></code>"<i>name</i>"
|
|
<code><b>/></b></code></dt>
|
|
<dd>The first form includes the XML-style configuration specified in a
|
|
<code><proguardconfiguration></code> task (or
|
|
<code><proguard></code> task) with attribute <code>id</code> =
|
|
"<i>ref_id</i>". Only the nested elements of this configuration are
|
|
considered, not the attributes.
|
|
<p>
|
|
The second form includes the ProGuard-style configuration from the specified
|
|
file. The element is actually a <code>fileset</code> element and supports
|
|
all of its attributes and nested elements, including multiple files.
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
<h2><a name="classpath">Class Path Attributes and Nested Elements</a></h2>
|
|
|
|
The jar elements are <code>path</code> elements, so they can have any of the
|
|
standard <code>path</code> attributes and nested elements. The most common
|
|
attributes are:
|
|
|
|
<dl>
|
|
|
|
<dt><code><b>path</b></code> = "<i>path</i>"</dt>
|
|
<dd>The names of the jars (or aars, wars, ears, zips, apks, or directories),
|
|
separated by the path separator.</dd>
|
|
|
|
<dt><code><b>location</b></code> = "<i>name</i>" (or <code><b>file</b></code>
|
|
= "<i>name</i>", or <code><b>dir</b></code> = "<i>name</i>", or
|
|
<code><b>name</b></code> = "<i>name</i>")</dt>
|
|
<dd>Alternatively, the name of a single jar (or aar, war, ear, zip, or
|
|
directory).</dd>
|
|
|
|
<dt><code><b>refid</b></code> = "<i>ref_id</i>"</dt>
|
|
<dd>Alternatively, a reference to the path or file set with the attribute
|
|
<code>id</code> = "<i>ref_id</i>".</dd>
|
|
|
|
</dl>
|
|
|
|
In addition, the jar elements can have ProGuard-style filter attributes:
|
|
|
|
<dl>
|
|
|
|
<dt><code><b>filter</b></code> =
|
|
"<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
|
|
<dd>An optional filter for all class file names and resource file names that
|
|
are encountered.</dd>
|
|
|
|
<dt><code><b>apkfilter</b></code> =
|
|
"<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
|
|
<dd>An optional filter for all apk names that are encountered.</dd>
|
|
|
|
<dt><code><b>jarfilter</b></code> =
|
|
"<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
|
|
<dd>An optional filter for all jar names that are encountered.</dd>
|
|
|
|
<dt><code><b>aarfilter</b></code> =
|
|
"<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
|
|
<dd>An optional filter for all aar names that are encountered.</dd>
|
|
|
|
<dt><code><b>warfilter</b></code> =
|
|
"<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
|
|
<dd>An optional filter for all war names that are encountered.</dd>
|
|
|
|
<dt><code><b>earfilter</b></code> =
|
|
"<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
|
|
<dd>An optional filter for all ear names that are encountered.</dd>
|
|
|
|
<dt><code><b>zipfilter</b></code> =
|
|
"<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
|
|
<dd>An optional filter for all zip names that are encountered.</dd>
|
|
|
|
</dl>
|
|
|
|
<h2><a name="keepmodifier">Keep Modifier Attributes</a></h2>
|
|
|
|
The keep tags can have the following <i>modifier</i> attributes:
|
|
|
|
<dl>
|
|
|
|
<dt><a href="usage.html#includedescriptorclasses"><code><b>includedescriptorclasses</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Specifies whether the classes of the fields and methods specified in the
|
|
keep tag must be kept as well.</dd>
|
|
|
|
<dt><a href="usage.html#allowshrinking"><code><b>allowshrinking</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Specifies whether the entry points specified in the keep tag may be
|
|
shrunk.</dd>
|
|
|
|
<dt><a href="usage.html#allowoptimization"><code><b>allowoptimization</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Specifies whether the entry points specified in the keep tag may be
|
|
optimized.</dd>
|
|
|
|
<dt><a href="usage.html#allowobfuscation"><code><b>allowobfuscation</b></code></a>
|
|
= "<i>boolean</i>"
|
|
(default = false)</dt>
|
|
<dd>Specifies whether the entry points specified in the keep tag may be
|
|
obfuscated.</dd>
|
|
|
|
</dl>
|
|
|
|
<h2><a name="classspecification">Class Specification Attributes and Nested Elements</a></h2>
|
|
|
|
The keep tags can have the following <i>class_specification</i> attributes and
|
|
<i>class_member_specifications</i> nested elements:
|
|
|
|
<dl>
|
|
|
|
<dt><code><b>access</b></code> = "<i>access_modifiers</i>"</dt>
|
|
<dd>The optional access modifiers of the class. Any space-separated list of
|
|
"public", "final", and "abstract", with optional negators "!".</dd>
|
|
|
|
<dt><code><b>annotation</b></code> = "<i>annotation_name</i>"</dt>
|
|
<dd>The optional fully qualified name of an annotation of the class, with
|
|
optional wildcards.</dd>
|
|
|
|
<dt><code><b>type</b></code> = "<i>type</i>"</dt>
|
|
<dd>The optional type of the class: one of "class", "interface", or
|
|
"!interface".</dd>
|
|
|
|
<dt><code><b>name</b></code> = "<i>class_name</i>"</dt>
|
|
<dd>The optional fully qualified name of the class, with optional
|
|
wildcards.</dd>
|
|
|
|
<dt><code><b>extendsannotation</b></code> = "<i>annotation_name</i>"</dt>
|
|
<dd>The optional fully qualified name of an annotation of the the class that
|
|
the specified classes must extend, with optional wildcards.</dd>
|
|
|
|
<dt><code><b>extends</b></code> = "<i>class_name</i>"</dt>
|
|
<dd>The optional fully qualified name of the class the specified classes
|
|
must extend, with optional wildcards.</dd>
|
|
|
|
<dt><code><b>implements</b></code> = "<i>class_name</i>"</dt>
|
|
<dd>The optional fully qualified name of the class the specified classes
|
|
must implement, with optional wildcards.</dd>
|
|
|
|
<dt><code><b><field</b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specification</i></a>
|
|
<code><b>/></b></code></dt>
|
|
<dd>Specifies a field.</dd>
|
|
|
|
<dt><code><b><method</b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specification</i></a>
|
|
<code><b>/></b></code></dt>
|
|
<dd>Specifies a method.</dd>
|
|
|
|
<dt><code><b><constructor</b></code>
|
|
<a href="#classmemberspecification"><i>class_member_specification</i></a>
|
|
<code><b>/></b></code></dt>
|
|
<dd>Specifies a constructor.</dd>
|
|
|
|
</dl>
|
|
|
|
<h2><a name="classmemberspecification">Class Member Specification Attributes</a></h2>
|
|
|
|
The class member tags can have the following <i>class_member_specification</i>
|
|
attributes:
|
|
|
|
<dl>
|
|
|
|
<dt><code><b>access</b></code> = "<i>access_modifiers</i>"</dt>
|
|
<dd>The optional access modifiers of the class. Any space-separated list of
|
|
"public", "protected", "private", "static", etc., with optional negators
|
|
"!".</dd>
|
|
|
|
<dt><code><b>annotation</b></code> = "<i>annotation_name</i>"</dt>
|
|
<dd>The optional fully qualified name of an annotation of the class member,
|
|
with optional wildcards.</dd>
|
|
|
|
<dt><code><b>type</b></code> = "<i>type</i>"</dt>
|
|
<dd>The optional fully qualified type of the class member, with optional
|
|
wildcards. Not applicable for constructors, but required for methods for
|
|
which the <code>parameters</code> attribute is specified.</dd>
|
|
|
|
<dt><code><b>name</b></code> = "<i>name</i>"</dt>
|
|
<dd>The optional name of the class member, with optional wildcards. Not
|
|
applicable for constructors.</dd>
|
|
|
|
<dt><code><b>parameters</b></code> = "<i>parameters</i>"</dt>
|
|
<dd>The optional comma-separated list of fully qualified method parameters,
|
|
with optional wildcards. Not applicable for fields, but required for
|
|
constructors, and for methods for which the <code>type</code> attribute is
|
|
specified.</dd>
|
|
|
|
</dl>
|
|
|
|
<hr />
|
|
<address>
|
|
Copyright © 2002-2014
|
|
<a target="other" href="http://www.lafortune.eu/">Eric Lafortune</a> @ <a target="top" href="http://www.saikoa.com/">Saikoa</a>.
|
|
</address>
|
|
</body>
|
|
</html>
|