Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental obfuscation functionality #73

Merged
merged 2 commits into from
May 25, 2019

Conversation

aasakawa
Copy link
Contributor

Since ProGuard supports incremental obfuscation by specifying -applymapping, I propose adding a functionality to incrementally obfuscate projects with multiple modules.

  • root:pom
    • test1:jar
      • test.Class1
        • void method(test.Class1)
      • test.Keep1
    • test2:jar
      • test.Class2
        • void method(test.Class1)
      • test.Keep2

(An example of projects that actually work: incremental-obfuscation.zip)

In the project of the above layout, If you specify proguard_map.txt which is the result of obfuscating test1:jar with -applymapping when obfuscating test2:jar, ProGuard will consider the result of changing the identifier in test1:jar, so test.Class1 and test.Class2 will not change to the same name.

In order to support such incremental obfuscation, I introduce the following two parameters.

  • File applyMappingFile (default: none)
    • If specified, specify that file as -applymapping parameter
  • boolean incremental (default: false)
    • Specify whether to perform incremental obfuscation
    • In the case of true, the following behavior changes
      1. Even if applyMappingFile is specified, if the file does not exist, omit -applymapping (i.e. there is no mapping file to be applied to the originating project)
      2. If the file exists, merge the mapping file of the execution result of ProGuard into the file specified by applyMappingFile

In other words, if you set incremental = true, you will be able to obfuscate individual modules one by one in projects with multiple modules.

Note that this functionality does not work properly in versions prior to ProGuard 5.3.

Version 5.3 (Sep. 2016)

  • Avoiding obfuscated name clashes with library classes.

Copy link
Owner

@wvengen wvengen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't used this feature before, but the code looks fine. Thanks for adding this feature. @cmorty does this look ok to you as well?

@lasselindqvist
Copy link
Collaborator

@aasakawa seems good to me, but as this a somewhat complex functionality, it would benefit from good documentation, maybe an example. The explanation in this pull request is good, could it be added in some form to the site (index.apt)?

@MarcMil
Copy link

MarcMil commented May 23, 2019

@lasselindqvist
Copy link
Collaborator

I will add the documentation later in #85

@lasselindqvist lasselindqvist merged commit abfad85 into wvengen:master May 25, 2019
@aasakawa aasakawa deleted the incremental_obfuscation branch February 7, 2020 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants