aboutsummaryrefslogtreecommitdiffstats
path: root/src/proguard/Configuration.java
blob: d513e2c49241a4504403618d0a5be1b8441fd607 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
/*
 * ProGuard -- shrinking, optimization, obfuscation, and preverification
 *             of Java bytecode.
 *
 * Copyright (c) 2002-2009 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
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package proguard;

import java.io.File;
import java.util.List;

/**
 * The ProGuard configuration.
 *
 * @see ProGuard
 *
 * @author Eric Lafortune
 */
public class Configuration
{
    ///////////////////////////////////////////////////////////////////////////
    // Input and output options.
    ///////////////////////////////////////////////////////////////////////////

    /**
     * A list of input and output entries (jars, wars, ears, zips, and directories).
     */
    public ClassPath programJars;

    /**
     * A list of library entries (jars, wars, ears, zips, and directories).
     */
    public ClassPath libraryJars;

    /**
     * Specifies whether to skip non-public library classes while reading
     * library jars.
     */
    public boolean   skipNonPublicLibraryClasses      = true;

    /**
     * Specifies whether to skip non-public library class members while reading
     * library classes.
     */
    public boolean   skipNonPublicLibraryClassMembers = true;

    /**
     * A list of <code>String</code>s specifying directories to be kept in
     * the output directories or the output jars. A <code>null</code> list
     * means no directories. An empty list means all directories. The directory
     * names may contain "**", "*", or "?" wildcards, and they may be preceded
     * by the "!" negator.
     */
    public List      keepDirectories;

    /**
     * Specifies the version number of the output classes, or 0 if the version
     * number can be left unchanged.
     */
    public int       targetClassVersion;

    /**
     * Specifies the last modification time of this configuration. This time
     * is necessary to check whether the input has to be processed. Setting it
     * to Long.MAX_VALUE forces processing, even if the modification times
     * of the output appear more recent than the modification times of the
     * input.
     */
    public long      lastModified                     = 0L;

    ///////////////////////////////////////////////////////////////////////////
    // Keep options.
    ///////////////////////////////////////////////////////////////////////////

    /**
     * A list of {@link KeepClassSpecification} instances, whose class names and
     * class member names are to be kept from shrinking, optimization, and/or
     * obfuscation.
     */
    public List      keep;

    /**
     * An optional output file for listing the kept seeds.
     * An empty file name means the standard output.
     */
    public File      printSeeds;

    ///////////////////////////////////////////////////////////////////////////
    // Shrinking options.
    ///////////////////////////////////////////////////////////////////////////

    /**
     * Specifies whether the code should be shrunk.
     */
    public boolean   shrink                           = true;

    /**
     * An optional output file for listing the unused classes and class
     * members. An empty file name means the standard output.
     */
    public File      printUsage;

    /**
     * A list of {@link ClassSpecification} instances, for which an explanation
     * is to be printed, why they are kept in the shrinking step.
     */
    public List      whyAreYouKeeping;

    ///////////////////////////////////////////////////////////////////////////
    // Optimization options.
    ///////////////////////////////////////////////////////////////////////////

    /**
     * Specifies whether the code should be optimized.
     */
    public boolean   optimize                         = true;

    /**
     * A list of <code>String</code>s specifying the optimizations to be
     * performed. A <code>null</code> list means all optimizations. The
     * optimization names may contain "*" or "?" wildcards, and they may
     * be preceded by the "!" negator.
     */
    public List      optimizations;

    /**
     * Specifies the number of optimization passes.
     */
    public int       optimizationPasses               = 1;

    /**
     * A list of {@link ClassSpecification} instances, whose methods are
     * assumed to have no side effects.
     */
    public List      assumeNoSideEffects;

    /**
     * Specifies whether the access of class members can be modified.
     */
    public boolean   allowAccessModification          = false;

    /**
     * Specifies whether interfaces may be merged aggressively.
     */
    public boolean   mergeInterfacesAggressively      = false;

    ///////////////////////////////////////////////////////////////////////////
    // Obfuscation options.
    ///////////////////////////////////////////////////////////////////////////

    /**
     * Specifies whether the code should be obfuscated.
     */
    public boolean   obfuscate                        = true;

    /**
     * An optional output file for listing the obfuscation mapping.
     * An empty file name means the standard output.
     */
    public File      printMapping;

    /**
     * An optional input file for reading an obfuscation mapping.
     */
    public File      applyMapping;

    /**
     * An optional name of a file containing obfuscated class member names.
     */
    public File      obfuscationDictionary;

    /**
     * An optional name of a file containing obfuscated class names.
     */
    public File      classObfuscationDictionary;

    /**
     * An optional name of a file containing obfuscated package names.
     */
    public File      packageObfuscationDictionary;

    /**
     * Specifies whether to apply aggressive name overloading on class members.
     */
    public boolean   overloadAggressively             = false;

    /**
     * Specifies whether to generate globally unique class member names.
     */
    public boolean   useUniqueClassMemberNames        = false;

    /**
     * Specifies whether obfuscated packages and classes can get mixed-case names.
     */
    public boolean   useMixedCaseClassNames           = true;

    /**
     * A list of <code>String</code>s specifying package names to be kept.
     * A <code>null</code> list means no names. An empty list means all
     * names. The package names may contain "**", "*", or "?" wildcards, and
     * they may be preceded by the "!" negator.
     */
    public List      keepPackageNames;

    /**
     * An optional base package if the obfuscated package hierarchy is to be
     * flattened, <code>null</code> otherwise.
     */
    public String    flattenPackageHierarchy;

    /**
     * An optional base package if the obfuscated classes are to be repackaged
     * into a single package, <code>null</code> otherwise.
     */
    public String    repackageClasses;

    /**
     * A list of <code>String</code>s specifying optional attributes to be kept.
     * A <code>null</code> list means no attributes. An empty list means all
     * attributes. The attribute names may contain "*" or "?" wildcards, and
     * they may be preceded by the "!" negator.
     */
    public List      keepAttributes;

    /**
     * An optional replacement for all SourceFile attributes.
     */
    public String    newSourceFileAttribute;

    /**
     * A list of <code>String</code>s specifying a filter for clases whose
     * string constants are to be adapted, based on corresponding obfuscated
     * class names.
     */
    public List      adaptClassStrings;

    /**
     * A list of <code>String</code>s specifying a filter for files whose
     * names are to be adapted, based on corresponding obfuscated class names.
     */
    public List      adaptResourceFileNames;

    /**
     * A list of <code>String</code>s specifying a filter for files whose
     * contents are to be adapted, based on obfuscated class names.
     */
    public List      adaptResourceFileContents;

    ///////////////////////////////////////////////////////////////////////////
    // Preverification options.
    ///////////////////////////////////////////////////////////////////////////

    /**
     * Specifies whether the code should be preverified.
     */
    public boolean   preverify                        = true;

    /**
     * Specifies whether the code should be preverified for Java Micro Edition
     * (creating StackMap attributes) instead of for Java Standard Edition
     * (creating StackMapTable attributes).
     */
    public boolean   microEdition                     = false;

    ///////////////////////////////////////////////////////////////////////////
    // General options.
    ///////////////////////////////////////////////////////////////////////////

    /**
     * Specifies whether to print verbose messages.
     */
    public boolean   verbose                          = false;

    /**
     * A list of <code>String</code>s specifying a filter for the classes for
     * which not to print notes, if there are noteworthy potential problems.
     * A <code>null</code> list means all classes. The class names may contain
     * "**", "*", or "?" wildcards, and they may be preceded by the "!" negator.
     */
    public List      note                             = null;

    /**
     * A list of <code>String</code>s specifying a filter for the classes for
     * which not to print warnings, if there are any problems.
     * A <code>null</code> list means all classes. The class names may contain
     * "**", "*", or "?" wildcards, and they may be preceded by the "!" negator.
     */
    public List      warn                             = null;

    /**
     * Specifies whether to ignore any warnings.
     */
    public boolean   ignoreWarnings                   = false;

    /**
     * An optional output file for printing out the configuration that ProGuard
     * is using (with included files and replaced variables).
     * An empty file name means the standard output.
     */
    public File      printConfiguration;

    /**
     * An optional output file for printing out the processed code in a more
     * or less readable form. An empty file name means the standard output.
     */
    public File      dump;
}