gradle / gradle

Adaptable, fast automation for all
https://gradle.org
Apache License 2.0
16.69k stars 4.67k forks source link

Gradle should warn when someone tries to use Project.getProperties() #25053

Open liutikas opened 1 year ago

liutikas commented 1 year ago

Expected Behavior

Gradle should deprecated or at least warn developers that Project.getProperties() is a non-lazy, and that they likely want to call hasProperty/getProperty.

Current Behavior (optional)

Calling Project.getProperties() is quite expensive and can trigger going through all the properties unnecessarily, for example see https://youtrack.jetbrains.com/issue/KT-56421 / https://github.com/JetBrains/kotlin/commit/0ab8d07 that was causing 300ms in our configuration time since it was called a lot.

Context

It is a constant cause for papercut performance issues across the plugin ecosystem.

liutikas commented 1 year ago

We hit it in our own plug in as well

https://r.android.com/2108265

jbartok commented 1 year ago

Thank you for your interest in Gradle!

This issue needs a decision from the team responsible for that area. They have been informed. Response time may vary.

mlopatkin commented 5 months ago

This feature request is in the backlog of the relevant team and is prioritized by them.


We probably cannot make the call itself lazy at this point, and we'll have to add some other way to enumerate properties if we decide to deprecate it.

Isolated projects may also influence the shape of the solution, as the current API might be problematic there.