• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// This Gradle build file illustrates how to process the ProGuard GUI.
3// Configuration files for typical applications will be very similar.
4// Usage:
5//     gradle -b proguardgui.gradle proguard
6//
7
8// Tell Gradle where to find the ProGuard task.
9
10buildscript {
11    repositories {
12        flatDir dirs: '../../lib'
13    }
14    dependencies {
15        classpath ':proguard'
16    }
17}
18
19// Define a ProGuard task.
20
21task proguard(type: proguard.gradle.ProGuardTask) {
22
23    // You should probably import a more compact ProGuard-style configuration
24    // file for all static settings, but we're specifying them all here, for
25    // the sake of the example.
26    //configuration 'configuration.pro'
27
28    // Specify the input jars, output jars, and library jars.
29    // The input jars will be merged in a single output jar.
30    // We'll filter out the Ant classes, Gradle classes, and WTK classes, keeping
31    // everything else.
32
33    injars  '../../lib/proguardgui.jar'
34    injars  '../../lib/proguard.jar', filter: '!META-INF/**,!proguard/ant/**,!proguard/gradle/**,!proguard/wtk/**'
35    injars  '../../lib/retrace.jar', filter: '!META-INF/**'
36    outjars 'proguardgui_out.jar'
37
38    libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
39
40    // If we wanted to reuse the previously obfuscated proguard_out.jar, we could
41    // perform incremental obfuscation based on its mapping file, and only keep the
42    // additional GUI files instead of all files.
43
44    //applymapping 'proguard.map'
45    //injars      '../../lib/proguardgui.jar'
46    //outjars     'proguardgui_out.jar'
47    //libraryjars '../../lib/proguard.jar', filter: '!proguard/ant/**,!proguard/wtk/**'
48    //libraryjars '../../lib/retrace.jar'
49    //libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
50
51
52    // Allow methods with the same signature, except for the return type,
53    // to get the same obfuscation name.
54
55    overloadaggressively
56
57    // Put all obfuscated classes into the nameless root package.
58
59    repackageclasses ''
60
61    // Adapt the names of resource files, based on the corresponding obfuscated
62    // class names. Notably, in this case, the GUI resource properties file will
63    // have to be renamed.
64
65    adaptresourcefilenames '**.properties,**.gif,**.jpg'
66
67    // The entry point: ProGuardGUI and its main method.
68
69    keep 'public class proguard.gui.ProGuardGUI { \
70        public static void main(java.lang.String[]); \
71    }'
72}
73