admin管理员组

文章数量:1122846

i have a yGuard config in gradle.kotlin.dsl, which is working only in parts and i can't figure out why. Building a library with thirdparty dependencies i want to obfuscate my private code only and keep all the rest.

This is the config:

"yguard" {
            "inoutpair"("in" to unobfJar, "out" to archivePath)

            // Prevent yGuard from removing "Deprecated" attributes from .class files.
            "attribute"("name" to "Deprecated")

            "externalclasses" {
                "pathelement"("path" to sourceSets["main"]pileClasspath.asPath)
            }

            "rename"("logfile" to "${projectDir}/build/${rootProject.name}_renamelog.xml") {
                "keep" { 
                      
                    "class"(
                        "name" to "my.pack.MyClass",
                        "methods" to "public",
                    )

                    "class" {
                        "classes" to "private"
                        "methods" to "private"
                        "fields" to "private"
                        "patternset" {
                            "include"("name" to "kotlin.*")
                            "include"("name" to "kotlin.**")
                            "include"("name" to "kotlin.**$*")
                            "include"("name" to "kotlin.**$*$*")
                            "include"("name" to "kotlin.**.*")
                            // here are more includes for classes in 
                            // "com.fasterxml.*" and more
                        }
                    }
                }
           }
}

Expecting that everything is kept but my class. Instead there are still class obfuscated, which should by kept by the config in patternset.

</expose>
<map>
   <method class="kotlin.random.jdk8.PlatformThreadLocalRandom" name="double nextDouble(double)" map="A"/>
...
    <field class="kotlin.enums.EnumEntriesList" name="entries" map="d"/>
...and more other classes in different packages

I do not understand, why yGuard is missing the classes.
Anybody else did this with gradle and kotlin?
Or just knows why yGuard is behaving this way?

(On a sidenote... i also do not understand the "externalclasses" attribute. Tried to use it like in the example with no success)

Thanks in advance.

本文标签: yGuard configuration in gradlekotlindsl does miss elementsStack Overflow