AndResGuard icon indicating copy to clipboard operation
AndResGuard copied to clipboard

AndResGuard plugin is resolving dependencies at configuration time

Open runningcode opened this issue 4 years ago • 0 comments

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.

runningcode avatar Aug 12 '21 07:08 runningcode