shwenzhang / AndResGuard

proguard resource for Android by wechat team
Apache License 2.0
8.55k stars 1.54k forks source link

AndResGuard plugin is resolving dependencies at configuration time #482

Open runningcode opened 3 years ago

runningcode commented 3 years ago

Resolving dependencies at configuration time is a performance problem. See here: https://docs.gradle.org/current/userguide/performance.html#dont_resolve_dependencies_at_configuration_time

This is happening on this line: https://github.com/shwenzhang/AndResGuard/blob/master/AndResGuard-gradle-plugin/src/main/groovy/com/tencent/gradle/ExecutorExtension.groovy#L64

A better solution would be to use a file provider as such:

Provider<File> fileProvider = fileProvider(configurations.myconf.elements.map { files ->
        assert files.size() == 1
        return files.first().asFile
    }}

The fileProvider can then be used in place of the String path that was being used previously.

Let me know if you would like me to submit a PR for this.