airbnb / epoxy

Epoxy is an Android library for building complex screens in a RecyclerView
https://goo.gl/eIK82p
Apache License 2.0
8.51k stars 728 forks source link

`validateEpoxyModelUsage` configuration option ignored? #1269

Closed ubuntudroid closed 2 years ago

ubuntudroid commented 2 years ago

Using Epoxy 4.6.4.

We are setting validateEpoxyModelUsage = "false" to disable model usage validation in our app's build.gradle as per the wiki.

However, it looks like the processor is ignoring this when the models are built and always generates the validation code which in turn likely slows down screen rendering from how I understand the code and the wiki.

Am I using the configuration incorrectly?

android {
   // ...
   applicationVariants.all { variant ->
        // ...
        buildType.javaCompileOptions.annotationProcessorOptions.arguments = [
                // Validation is disabled in production to remove the runtime overhead
                validateEpoxyModelUsage: "false", // IRL we are determining whether to enable or disable this via the buildType
                requireHashCodeInEpoxyModels: "true",
                requireAbstractEpoxyModels: "true",
                implicitlyAddAutoModels: "true",
                enableParallelEpoxyProcessing: "true",
                epoxyDisableGenerateOverloads: "true",
                epoxyDisableGenerateGetters: "true",
                epoxyDisableGenerateReset: "true"
        ]
    }
}

We are still using the variants API, that's why it looks a bit different from the code in the wiki, but that shouldn't be a deal breaker I think.

elihart commented 2 years ago

do you have multiple modules? are you applying this to all of your modules? your code snippet is for application variants only which makes me think library modules are excluded.

elihart commented 2 years ago

are the other options you are using being respected, or are none of them getting applied?

ubuntudroid commented 2 years ago

do you have multiple modules? are you applying this to all of your modules? your code snippet is for application variants only which makes me think library modules are excluded.

Only one module.

are the other options you are using being respected, or are none of them getting applied?

Huh, actually it doesn't look like. How could I miss this? 🤦 For instance epoxyDisableGenerateReset is enabled, but it still generates reset() functions in the models.

However, last time I modified that code is two years ago, so I'm not really sure why this isn't working anymore.

ubuntudroid commented 2 years ago

Okay, I rewrote the code to not use the variants API anymore and put it not into the android closure and now it looks like it is working. Not sure where the difference is in the end, but I'm going to close this issue now.

The wiki has it right. 👍