New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typesafe project accessors not working in root build script file #16636
Comments
Looks to me like it's the same cause as for #16634, where the problem seems to not be the "root build script file" per se, but actually subprojects' blocks inside that file (either |
Yes, @tbroyer is correct. Nowadays it's considered a bad pattern to reach out to other project's state using
|
Uh, ok but why is considered bad pattern? |
There are different reasons. First it makes it difficult to decouple projects. Say you want to extract one project in a composite build, or even its own repository. If you apply cross-configuration like this, it's difficult to do. Second, if you open a build script of a project, it's difficult to figure out what has already been configured. For example, if I open
it's immediately obvious what the project is and what plugins are applied to it. We can reason about it. Except if you do cross-configuration, because then, any other project can mutate the state of this project, add more plugins, and you would never know. In the end the build breaks and it's super hard to figure out why. In other words: keeping the Another reason is ordering. By applying cross-configuration, you can never really know when something is going to be configured, which often implies dirty workarounds like Last, there's a performance and isolation aspect: by doing cross-configuration it prevents the engine from doing some optimizations. With the configuration cache we're moving away from this pattern, as it allows us to reason project per project and therefore enable optimizations like intra-project parallelism by default. |
We don't plan to fix this short term. We discourage use of cross-configuration and there are 2 workarounds:
|
@melix is this subprojects anti-pattern documented somewhere in detail? (even a blog) |
The new accessors do not work in my root build script file.
If I test them in the corresponding subproject script, then it's fine.
Current Behavior or error
The accessors are actually properly generated, but as soon as I try to use them, then the sync fails:
Steps to Reproduce
Clone this branch and sync
Your Environment
7.0 rc1 bin
Build scan URL
The text was updated successfully, but these errors were encountered: