Skip to content

Conversation

@bric3
Copy link
Contributor

@bric3 bric3 commented Oct 14, 2025

What Does This Do

Removes instrumentation module's afterEvaluate.

This looks like it is reducing sync time to ~1min on my M1
image

Motivation

Using afterEvaluate is a bad practice and has tighter restriction in Gradle 9+.

https://docs.gradle.org/9.1.0/userguide/task_configuration_avoidance.html#8_some_apis_may_be_disallowed_if_you_try_to_access_them_from_the_new_apis_configuration_blocks

It introduces subtle ordering issues which can be very challenging to debug.

From my notes:

  1. Anyone wanting to use code in an afterEvaluate {} now also needs to use afterEvaluate {} all the way down.
  2. It becomes even more complicated as more plugins/scripts are involved
  3. More generally, it makes dependencies between plugins/scripts implicit and error prone

Abusing afterEvaluate causes many things that will try to run later and later after each other when order is not guaranteed. In almost all situations, afterEvaluate is a work-around that introduces timing problems and race conditions and just treats symptoms.

Usually, afterEvaluate {} is good in this occasion:

  • consistency checks, i.e. ensure that something is not misconfigured.

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@bric3 bric3 requested a review from a team as a code owner October 14, 2025 14:57
@bric3 bric3 added type: enhancement Enhancements and improvements tag: no release notes Changes to exclude from release notes comp: tooling Build & Tooling labels Oct 14, 2025
@bric3 bric3 marked this pull request as draft October 14, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: no release notes Changes to exclude from release notes type: enhancement Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants