Proguard, keep all reference classes

Suppose I have a structure:

import some.other.Clazz;

public class A {

    Clazz clazz;
    B b;

    public class B {
        C c;
        //...
    }

    public static class C {
        //...
    }
}

Is there any great proguard trick that would allow me recursively to keep all classes used by my class A? Thus, also all classes referenced internally B, Cand Clazz?

+6
source share
1 answer

I don't think you can only do this with proguard, and I really doubt that there is a direct solution (a plugin that you can use) with mvn \ gradle \ sbt \ for this.

, , , , , , .


:

(1) jdeps ( jdk) ( ) .class , .

some.class ( root_package) :

jdeps -v -R -e "root_package.*" some.class

(2) jdeps proguard ( -keep).

(3) proguard include, (2).


(2) -.

, , jdeps .

Maven, , , groovy .

, :

  • pipe jdeps :

    grep -Po classname_regex

    ... , ( classname_regex).

  • grep - :

    awk '{print "-keep class " $0}

    ... proguard .

+2

All Articles