Skip to content

Commit

Permalink
Make ActionTemplate implement the interface StarlarkValue.
Browse files Browse the repository at this point in the history
When creating an Action provider in /analysis/ActionsProvider.java the function Dict.immutableCopyOf(map) is called, which checks that all values are starlark values.  If one of the values is a LTOBackendActionTemplate, the following error is thrown: InvalidStarlarkValueException: invalid Starlark value: class LtoBackendActionTemplate

PiperOrigin-RevId: 553498116
Change-Id: Iad7bfe5b68fd766fc90b688f4fa4c469becdf9f0
  • Loading branch information
Googler authored and copybara-github committed Aug 3, 2023
1 parent 3d941be commit a6d04d8
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
import javax.annotation.Nullable;
import net.starlark.java.eval.Printer;
import net.starlark.java.eval.StarlarkValue;

/**
* A placeholder action that, at execution time, expands into a list of {@link Action}s to be
Expand Down Expand Up @@ -54,7 +56,7 @@
* not have artifact or artifact path prefix conflicts.
* </ol>
*/
public interface ActionTemplate<T extends Action> extends ActionAnalysisMetadata {
public interface ActionTemplate<T extends Action> extends ActionAnalysisMetadata, StarlarkValue {
/**
* Given a set of input TreeFileArtifacts resolved at execution time, returns a list of expanded
* actions to be executed.
Expand Down Expand Up @@ -108,4 +110,14 @@ default ImmutableMap<String, String> getExecProperties() {
default PlatformInfo getExecutionPlatform() {
return null;
}

@Override
default void repr(Printer printer) {
printer.append(prettyPrint());
}

@Override
default boolean isImmutable() {
return true;
}
}

0 comments on commit a6d04d8

Please sign in to comment.