This is a service mapper for the ProGuard Java bytecode obfuscator.
It fixes the issue that files in the META-INF/services
directory are not renamed or adapted to the new class names.
It replaces the original Jar file with a new one that contains the renamed services.
It consists of the following modules:
proguard-service-mapper
: The service mapper itself.proguard-service-mapper-cli
: The command line interface.proguard-service-mapper-maven
: The Maven plugin.proguard-service-mapper-gradle
: The Gradle plugin.
For convenience, the service mapper can be run from the command line. Withouth any additional arguments, it will print help information.
$ java -jar proguard-service-mapper-cli-<version>.jar -i <input-file> -m <mapping-file>
This plugin is intended to be integrated into your Maven build process and run after the ProGuard Maven plugin.
<plugin>
<groupId>com.github.gianttreelp.proguardservicesmapper</groupId>
<artifactId>proguard-service-mapper-maven-plugin</artifactId>
<version>1.2-SNAPSHOT</version> <!-- Update with the version you want to use, preferably the latest -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>map-proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<input><!-- The obfuscated input file --></input>
<mapping><!-- The mapping file from ProGuard --></mapping>
</configuration>
</plugin>
This plugin is intended to be integrated into your Gradle build process and run after the ProGuard Gradle plugin.
buildscript {
dependencies {
classpath("com.github.gianttreelp.proguardservicesmapper:proguard-services-mapper-gradle:1.2-SNAPSHOT")
}
}
register<com.github.gianttreelp.proguardservicesmapper.gradle.ProguardServicesMapperTask>("mapServices") {
this.dependsOn("proguard")
val shadowTask = project.tasks.shadowJar.orNull ?: throw IllegalStateException("No shadow jar task found")
this.mappingFile.set(project.buildDir.resolve("mapping.txt"))
this.inputFile.set(shadowTask.outputs.files.files.single().let {
File(it.path.substringBeforeLast('.') + "-obf." + it.path.substringAfterLast('.'))
})
}