Hey, Can someone give advice on configuration avoi...
# gradle
u
Hey, Can someone give advice on configuration avoidance? I have this code where I need a task per variant/output. I use the
configureEach
and
register
to achieve config. avoidance
Copy code
applicationVariants.configureEach { variant ->
    variant.outputs.configureEach { output ->
        def abi = output.getFilter(com.android.build.OutputFile.ABI)
        def abiName = abi.replace("_", "").replace("-", "")

        tasks.register("appAutomateUpload${abiName.capitalize()}${variant.name.capitalize()}", AppAutomateUpload) {
            group = "browserstack"

            ...

            dependsOn "assemble${variant.name.capitalize()}"
        }
    }
}
My question is, if only few variants-tasks are actually used, i.e. I for sure don't need all the variant tasks. Should I 1. just do a if ( variant = "...) then return? to not generate a task for that variant at all 2. or, since this is config avoidance, it doesn't matter, since from what I understand, it will be configured lazily, meaning the unused ones won't get configured ever Performance is what I'm after
v
I'd say just compare both variants with build scans or with the Gradle profiler. I guess performance is not much different. I think you should register them if someone might ever want to call it.