-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make StarlarkDefinedConfigTransition immutable.
Generally speaking, it's not safe for config transitions to keep state because a transition instance may be shared across multiple rule instances. Rules should not be able to affect each other through shared transitions. This particular case removes an event handler that stores errors (like trying to load invalid build settings) which the configuration machinery replays later to communicate to the user. The risk trajectory is that a transition that fails on a badly formed rule might repeat the same error for a well-formed rule becuase of the shared state. The most likely user-visible output of this problem is non-deterministic build errors on rules using Starlark build settings and transitions. i.e. repeat the same build twice and get different results. This is a huge change (apologies), but conceptually straightforward. We simply add an EventHandler parameter to ConfigurationTransition.apply to provide an alternative place to record errors. This lifts StarlarkDefinedConfigTransition of the burden to define its own. Most of the hugeness in this change is that the ConfigurationTransition interface is used in many places, so we have to pass / define this parameter everywhere. A less invavise alternative could be to use Java interface defaults, but I think the current approach is a better API (and the pain is limited just to this change: there's no real extra API burden as a result). Testing note: I'm impressed that this change only broke one test: StarlarkRuleTransitionProviderTest#testAliasedBuildSetting, and for straightforward reasons. See new comments in ConfigurationResolver for details. PiperOrigin-RevId: 304043250
- Loading branch information
1 parent
0a75645
commit f0a40ac
Showing
50 changed files
with
277 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.