001: /*
002: * ProGuard -- shrinking, optimization, obfuscation, and preverification
003: * of Java bytecode.
004: *
005: * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the Free
009: * Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful, but WITHOUT
013: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
015: * more details.
016: *
017: * You should have received a copy of the GNU General Public License along
018: * with this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: package proguard;
022:
023: import java.io.File;
024: import java.util.List;
025:
026: /**
027: * The ProGuard configuration.
028: *
029: * @see ProGuard
030: *
031: * @author Eric Lafortune
032: */
033: public class Configuration {
034: ///////////////////////////////////////////////////////////////////////////
035: // Input and output options.
036: ///////////////////////////////////////////////////////////////////////////
037:
038: /**
039: * A list of input and output entries (jars, wars, ears, zips, and directories).
040: */
041: public ClassPath programJars;
042:
043: /**
044: * A list of library entries (jars, wars, ears, zips, and directories).
045: */
046: public ClassPath libraryJars;
047:
048: /**
049: * Specifies whether to skip non-public library classes while reading
050: * library jars.
051: */
052: public boolean skipNonPublicLibraryClasses = true;
053:
054: /**
055: * Specifies whether to skip non-public library class members while reading
056: * library classes.
057: */
058: public boolean skipNonPublicLibraryClassMembers = true;
059:
060: /**
061: * Specifies the version number of the output classes, or 0 if the version
062: * number can be left unchanged.
063: */
064: public int targetClassVersion;
065:
066: /**
067: * Specifies the last modification time of this configuration. This time
068: * is necessary to check whether the input has to be processed. Setting it
069: * to Long.MAX_VALUE forces processing, even if the modification times
070: * of the output appear more recent than the modification times of the
071: * input.
072: */
073: public long lastModified = 0L;
074:
075: ///////////////////////////////////////////////////////////////////////////
076: // Keep options.
077: ///////////////////////////////////////////////////////////////////////////
078:
079: /**
080: * A list of {@link KeepSpecification} instances, whose class names and
081: * class member names are to be kept from shrinking, optimization, and/or
082: * obfuscation.
083: */
084: public List keep;
085:
086: /**
087: * An optional output file for listing the kept seeds.
088: * An empty file name means the standard output.
089: */
090: public File printSeeds;
091:
092: ///////////////////////////////////////////////////////////////////////////
093: // Shrinking options.
094: ///////////////////////////////////////////////////////////////////////////
095:
096: /**
097: * Specifies whether the code should be shrunk.
098: */
099: public boolean shrink = true;
100:
101: /**
102: * An optional output file for listing the unused classes and class
103: * members. An empty file name means the standard output.
104: */
105: public File printUsage;
106:
107: /**
108: * A list of {@link ClassSpecification} instances, for which an explanation
109: * is to be printed, why they are kept in the shrinking step.
110: */
111: public List whyAreYouKeeping;
112:
113: ///////////////////////////////////////////////////////////////////////////
114: // Optimization options.
115: ///////////////////////////////////////////////////////////////////////////
116:
117: /**
118: * Specifies whether the code should be optimized.
119: */
120: public boolean optimize = true;
121:
122: /**
123: * Specifies the number of optimization passes.
124: */
125: public int optimizationPasses = 1;
126:
127: /**
128: * A list of {@link ClassSpecification} instances, whose methods are
129: * assumed to have no side effects.
130: */
131: public List assumeNoSideEffects;
132:
133: /**
134: * Specifies whether the access of class members can be modified.
135: */
136: public boolean allowAccessModification = false;
137:
138: ///////////////////////////////////////////////////////////////////////////
139: // Obfuscation options.
140: ///////////////////////////////////////////////////////////////////////////
141:
142: /**
143: * Specifies whether the code should be obfuscated.
144: */
145: public boolean obfuscate = true;
146:
147: /**
148: * An optional output file for listing the obfuscation mapping.
149: * An empty file name means the standard output.
150: */
151: public File printMapping;
152:
153: /**
154: * An optional input file for reading an obfuscation mapping.
155: */
156: public File applyMapping;
157:
158: /**
159: * An optional name of a file containing obfuscated class member names.
160: */
161: public File obfuscationDictionary;
162:
163: /**
164: * Specifies whether to apply aggressive name overloading on class members.
165: */
166: public boolean overloadAggressively = false;
167:
168: /**
169: * Specifies whether to generate globally unique class member names.
170: */
171: public boolean useUniqueClassMemberNames = false;
172:
173: /**
174: * Specifies whether obfuscated packages and classes can get mixed-case names.
175: */
176: public boolean useMixedCaseClassNames = true;
177:
178: /**
179: * An optional base package if the obfuscated package hierarchy is to be
180: * flattened, <code>null</code> otherwise.
181: */
182: public String flattenPackageHierarchy;
183:
184: /**
185: * An optional base package if the obfuscated classes are to be repackaged
186: * into a single package, <code>null</code> otherwise.
187: */
188: public String repackageClasses;
189:
190: /**
191: * A list of <code>String</code>s specifying optional attributes to be kept.
192: * A <code>null</code> list means no attributes. An empty list means all
193: * attributes. The attribute names may contain "*" or "?" wildcards, and
194: * they may be preceded by the "!" negator.
195: */
196: public List keepAttributes;
197:
198: /**
199: * An optional replacement for all SourceFile attributes.
200: */
201: public String newSourceFileAttribute;
202:
203: /**
204: * A list of <code>String</code>s specifying a filter for files whose
205: * names are to be adapted, based on corresponding obfuscated class names.
206: */
207: public List adaptResourceFileNames;
208:
209: /**
210: * A list of <code>String</code>s specifying a filter for files whose
211: * contents are to be adapted, based on obfuscated class names.
212: */
213: public List adaptResourceFileContents;
214:
215: ///////////////////////////////////////////////////////////////////////////
216: // Preverification options.
217: ///////////////////////////////////////////////////////////////////////////
218:
219: /**
220: * Specifies whether the code should be preverified.
221: */
222: public boolean preverify = true;
223:
224: /**
225: * Specifies whether the code should be preverified for Java Micro Edition
226: * (creating StackMap attributes) instead of for Java Standard Edition
227: * (creating StackMapTable attributes).
228: */
229: public boolean microEdition = false;
230:
231: ///////////////////////////////////////////////////////////////////////////
232: // General options.
233: ///////////////////////////////////////////////////////////////////////////
234:
235: /**
236: * Specifies whether to print verbose messages.
237: */
238: public boolean verbose = false;
239:
240: /**
241: * Specifies whether to print any notes.
242: */
243: public boolean note = true;
244:
245: /**
246: * Specifies whether to print any warnings.
247: */
248: public boolean warn = true;
249:
250: /**
251: * Specifies whether to ignore any warnings.
252: */
253: public boolean ignoreWarnings = false;
254:
255: /**
256: * An optional output file for printing out the configuration that ProGuard
257: * is using (with included files and replaced variables).
258: * An empty file name means the standard output.
259: */
260: public File printConfiguration;
261:
262: /**
263: * An optional output file for printing out the processed code in a more
264: * or less readable form. An empty file name means the standard output.
265: */
266: public File dump;
267: }
|