Modular program and proguard

I have modular program. When I obfuscated program, I added parameters -keep class module-info; -keepattributes Module*. It’s working but I decompiled jar and saw module-info contained original files names. I tried to add allowobfuscation, but it’s obfuscate only name module-info. How can I obfuscate containment module-info?

Dear @AsfhtgkDavid ,

First of all, welcome to the community!

It looks like you are trying to keep certain information so that it won’t be shrunk but you still would like name obfuscation to be applied to this part of the code. You are correct to specify a keep,allowobfuscation rule for the module-info class. However, ProGuard does not apply name obfuscation to resources. Depending on how the file names are specified in the module-info, it might therefore be expected behaviour that these file names are not obfuscated.

Hope this helps.

Kind regards,

Ewout

Thank you for help, I think you didn’t understand me. I created package structure, and I added -repackageclasses to config. In module-info remind 2 packages: root and 1 child. If I repackage classes, children packages delete. But after obfuscation module-info continue containing children packages. How to fix it?

Hi @AsfhtgkDavid ,

Thanks for your reply.

Can you please let me know if the following is the correct understanding of the problem?:

  • Before using ProGuard, you see in the module-info.java file that there is a root package and a child package.
  • When you use ProGuard on your artefact with the -repackageclasses option, you can see in the module info, that only 1 package remains (the root package).
  • When you use ProGuard on your artefact without the -repackageclasses option, you can see in the module info.java, that both packages remain present (root & child).

Is this the correct understanding of the problem?

1, 3 variants correct, but in 2 when my artifact with the -repackageclasses option, the module info continue contain both packages

Dear @AsfhtgkDavid,
Thanks for your swift reply.

In the third variant, you did use the allowobfuscation keyword correct? If so, were the child package names obfuscated? Or were they visible in the original format?

Kind regards,

Ewout

I stopped using allowobfuscation to module-info because it’s obfuscate only file name module-info. Package names obfuscated, but module-info continue contain original names.
P.S I edited last message.

@ewoutd What do you think? I tried this:

-keep, allowobfuscation class module-info
-keepnames class module-info
-keepattributes Module*

0 results. Module-info saves deleted packages

Dear @AsfhtgkDavid

The issue you are running into sounds like a known proguard issue; Module and ModulePackages attributes are not obfuscated consistently · Issue #122 · Guardsquare/proguard · GitHub

Please let us know if this would not answer your question.

Kr,
Ewout

Not really. 1) I don’t want use -keeppackagenames ** 2) I use -repackageclasses, and Proguad DOESN’T DELETE deleted packages from module-info

Best wishes,
David

Dear @AsfhtgkDavid,

In that case, can you please create a sample project so we can see what the actual issue looks like?

Kind regards,

Ewout

GitHub - AsfhtgkDavid/ProguardExample simple example. Main task is completeBuild

I understand. I found only 1 ‘crutch’. Before compile need delete all in module-info, keep only root.