blob: 62cd026cd5288c26877d331c654ce4ac8b87c386 [file] [log] [blame]
//
// This Gradle build file illustrates how to process the ProGuard GUI.
// Configuration files for typical applications will be very similar.
// Usage:
// gradle -b proguardgui.gradle proguard
//
// Tell Gradle where to find the ProGuard task.
buildscript {
repositories {
flatDir dirs: '../../lib'
}
dependencies {
classpath ':proguard'
}
}
// Define a ProGuard task.
task ('proguard', type: proguard.gradle.ProGuardTask) {
// You should probably import a more compact ProGuard-style configuration
// file for all static settings, but we're specifying them all here, for
// the sake of the example.
//configuration 'configuration.pro'
verbose
// Specify the input jars, output jars, and library jars.
// The input jars will be merged in a single output jar.
// We'll filter out the Ant classes, Gradle classes, and WTK classes, keeping
// everything else.
injars '../../lib/proguardgui.jar'
injars '../../lib/proguard.jar', filter: '!META-INF/**,!proguard/gradle/**,!proguard/ant/**,!proguard/wtk/**'
injars '../../lib/retrace.jar ', filter: '!META-INF/**'
outjars 'proguardgui_out.jar'
// Automatically handle the Java version of this build.
if (System.getProperty('java.version').startsWith('1.')) {
// Before Java 9, the runtime classes were packaged in a single jar file.
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
} else {
// As of Java 9, the runtime classes are packaged in modular jmod files.
libraryjars "${System.getProperty('java.home')}/jmods/java.base.jmod ", jarfilter: '!**.jar', filter: '!module-info.class'
libraryjars "${System.getProperty('java.home')}/jmods/java.desktop.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
}
// If we wanted to reuse the previously obfuscated proguard_out.jar, we could
// perform incremental obfuscation based on its mapping file, and only keep the
// additional GUI files instead of all files.
//applymapping 'proguard.map'
//injars '../../lib/proguardgui.jar'
//outjars 'proguardgui_out.jar'
//libraryjars '../../lib/proguard.jar', filter: '!proguard/ant/**,!proguard/wtk/**'
//libraryjars '../../lib/retrace.jar'
//libraryjars "${System.getProperty('java.home')}/jmods/java.base.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
//libraryjars "${System.getProperty('java.home')}/jmods/java.desktop.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
// Don't print notes about reflection in injected code.
dontnote 'proguard.configuration.ConfigurationLogger'
// Allow methods with the same signature, except for the return type,
// to get the same obfuscation name.
overloadaggressively
// Put all obfuscated classes into the nameless root package.
repackageclasses ''
// Adapt the names of resource files, based on the corresponding obfuscated
// class names. Notably, in this case, the GUI resource properties file will
// have to be renamed.
adaptresourcefilenames '**.properties,**.gif,**.jpg'
// The entry point: ProGuardGUI and its main method.
keep 'public class proguard.gui.ProGuardGUI { \
public static void main(java.lang.String[]); \
}'
}