Skip to content

Commit

Permalink
Make StarlarkExecGroupContext use AutoValue.
Browse files Browse the repository at this point in the history
This gives reasonable equals and hashCode behavior.

PiperOrigin-RevId: 367493368
  • Loading branch information
katre authored and copybara-github committed Apr 8, 2021
1 parent 91483e8 commit b9519f9
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public StarlarkExecGroupContext getIndex(StarlarkSemantics semantics, Object key
String.join(", ", getScrubbedExecGroups()));
}
ToolchainContextApi toolchainContext = toolchainCollection().getToolchainContext(execGroup);
return new StarlarkExecGroupContext(toolchainContext);
return new AutoValue_StarlarkExecGroupCollection_StarlarkExecGroupContext(toolchainContext);
}

private static String castGroupName(Object key) throws EvalException {
Expand Down Expand Up @@ -113,17 +113,10 @@ private List<String> getScrubbedExecGroups() {
* The starlark object that is returned by ctx.exec_groups[<name>]. Gives information about that
* exec group.
*/
public static class StarlarkExecGroupContext implements ExecGroupContextApi {
ToolchainContextApi toolchainContext;

private StarlarkExecGroupContext(ToolchainContextApi toolchainContext) {
this.toolchainContext = toolchainContext;
}

@AutoValue
public abstract static class StarlarkExecGroupContext implements ExecGroupContextApi {
@Override
public ToolchainContextApi toolchains() {
return toolchainContext;
}
public abstract ToolchainContextApi toolchains();

@Override
public void repr(Printer printer) {
Expand Down

0 comments on commit b9519f9

Please sign in to comment.