quaint-telephone-89068
10/28/2022, 7:24 PMdetermine_bootstrap_environment is called to compute a "default" EnvironmentName before the rule graph is entered, such that all `@goal_rule`s have one in scope automatically.
While this was useful for getting things going and proving out our cross-compilation capabilities (demonstrated in #11148 and #13682), it is error prone. The environment design has been trending toward (eventually) giving all targets an environment= field (even if the vast majority of the time it is only set via __defaults__). And in a world where ~all targets have an environment= field, ever accidentally using the default would definitely represent an issue.
Instead, we'd like to put the onus on each @goal_rule to select the relevant environment (usually via targets). Additionally, to resolve the open question in Appendix A in the design doc, we will pin effectively all calculations in graph.py to the __local__ environment (to eventually potentially be made configurable). This will mean that graph-introspection goals won't need to choose environments, and other `@goal_rule`s won't need to select an environment while computing the graph.
pantsbuild/pantsuser
10/28/2022, 7:24 PM