1111// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212// See the License for the specific language governing permissions and
1313// limitations under the License.
14- package com .google .devtools .build .lib .analysis ;
14+ package com .google .devtools .build .lib .analysis . starlark ;
1515
1616import static com .google .devtools .build .lib .analysis .ToolchainCollection .DEFAULT_EXEC_GROUP_NAME ;
1717
1818import com .google .auto .value .AutoValue ;
1919import com .google .common .annotations .VisibleForTesting ;
2020import com .google .common .collect .ImmutableMap ;
21+ import com .google .devtools .build .lib .analysis .ResolvedToolchainContext ;
22+ import com .google .devtools .build .lib .analysis .ToolchainCollection ;
2123import com .google .devtools .build .lib .starlarkbuildapi .platform .ExecGroupCollectionApi ;
24+ import com .google .devtools .build .lib .starlarkbuildapi .platform .ToolchainContextApi ;
2225import java .util .List ;
2326import java .util .stream .Collectors ;
2427import net .starlark .java .eval .EvalException ;
3336 * starlark.
3437 */
3538@ AutoValue
36- public abstract class ExecGroupCollection implements ExecGroupCollectionApi {
39+ public abstract class StarlarkExecGroupCollection implements ExecGroupCollectionApi {
3740
38- /** Returns a new {@link ExecGroupCollection} backed by the given {@code toolchainCollection}. */
39- public static ExecGroupCollection create (
41+ /**
42+ * Returns a new {@link StarlarkExecGroupCollection} backed by the given {@code
43+ * toolchainCollection}.
44+ */
45+ public static StarlarkExecGroupCollection create (
4046 ToolchainCollection <ResolvedToolchainContext > toolchainCollection ) {
41- return new AutoValue_ExecGroupCollection (toolchainCollection );
47+ return new AutoValue_StarlarkExecGroupCollection (toolchainCollection );
4248 }
4349
4450 protected abstract ToolchainCollection <ResolvedToolchainContext > toolchainCollection ();
@@ -60,12 +66,13 @@ public boolean containsKey(StarlarkSemantics semantics, Object key) throws EvalE
6066 }
6167
6268 /**
63- * This creates a new {@link ExecGroupContext } object every time this is called. This seems better
64- * than pre-creating and storing all {@link ExecGroupContext }s since they're just thin wrappers
65- * around {@link ResolvedToolchainContext} objects.
69+ * This creates a new {@link StarlarkExecGroupContext } object every time this is called. This
70+ * seems better than pre-creating and storing all {@link StarlarkExecGroupContext }s since they're
71+ * just thin wrappers around {@link ResolvedToolchainContext} objects.
6672 */
6773 @ Override
68- public ExecGroupContext getIndex (StarlarkSemantics semantics , Object key ) throws EvalException {
74+ public StarlarkExecGroupContext getIndex (StarlarkSemantics semantics , Object key )
75+ throws EvalException {
6976 String execGroup = castGroupName (key );
7077 if (!containsKey (semantics , key )) {
7178 throw Starlark .errorf (
@@ -74,7 +81,8 @@ public ExecGroupContext getIndex(StarlarkSemantics semantics, Object key) throws
7481 execGroup ,
7582 String .join (", " , getScrubbedExecGroups ()));
7683 }
77- return new ExecGroupContext (toolchainCollection ().getToolchainContext (execGroup ));
84+ ToolchainContextApi toolchainContext = toolchainCollection ().getToolchainContext (execGroup );
85+ return new StarlarkExecGroupContext (toolchainContext );
7886 }
7987
8088 private static String castGroupName (Object key ) throws EvalException {
@@ -105,16 +113,16 @@ private List<String> getScrubbedExecGroups() {
105113 * The starlark object that is returned by ctx.exec_groups[<name>]. Gives information about that
106114 * exec group.
107115 */
108- public static class ExecGroupContext implements ExecGroupContextApi {
109- ResolvedToolchainContext resolvedToolchainContext ;
116+ public static class StarlarkExecGroupContext implements ExecGroupContextApi {
117+ ToolchainContextApi toolchainContext ;
110118
111- private ExecGroupContext ( ResolvedToolchainContext resolvedToolchainContext ) {
112- this .resolvedToolchainContext = resolvedToolchainContext ;
119+ private StarlarkExecGroupContext ( ToolchainContextApi toolchainContext ) {
120+ this .toolchainContext = toolchainContext ;
113121 }
114122
115123 @ Override
116- public ResolvedToolchainContext toolchains () {
117- return resolvedToolchainContext ;
124+ public ToolchainContextApi toolchains () {
125+ return toolchainContext ;
118126 }
119127
120128 @ Override
0 commit comments