Uses the ProGuard Gradle plugin (version 7.5.0) to output all obfuscated jars (outjars) to a single directory for the purpose of demonstrating the plugin does not appear to support this feature as documented:
If you want to preserve the structure of your input jars (and/or apks, aars, wars, ears, jmods, zips, or directories), you can specify an output directory (or an apk, an aar, a war, an ear, a jmod, or a zip). For example:
-injars in1.jar -injars in2.jar -injars in3.jar -outjars out
The input jars will then be reconstructed in the directory out, with their original names.
Also note that specifying the single output directory in the ProGuard configuration file appears to work as documented above and demonstrated below.
- Execute
gradlew obfuscate
from the root project directory. - Observe the single Zip file,
build/release/obfuscated.zip
, containing the obfuscated JARs is output. - Modify the ProGuard Gradle plugin configuration,
build-logic/src/main/kotlin/my.release.proguard-convention.gradle.kts
, to output to a directory instead of a Zip file by changingoutjars(obfuscatedJarsZipFile)
tooutjars(obfuscatedJarsDir)
as marked with theFIXME
comment. - Execute
gradlew obfuscate
from the root project directory. - Observe an exception is thrown, indicating something similar to:
Expected 'C:/Demos/proguard-outjars-error/my-application/build/release/obfuscated' to be a file
- Comment out the aforementioned
outjars
line altogether - Add
-outjars my-application/build/release/obfuscated
to the ProGuard configuration file,shared-resources/obfuscation/proguard-configuration.pro
, below-basedirectory ../../
- Execute
gradlew obfuscate
from the root project directory. - Observe the single directory,
my-application/build/release/obfuscated
, containing the obfuscated JARs is output.