diff --git a/src/main/java/com/google/devtools/build/lib/analysis/WorkspaceStatusAction.java b/src/main/java/com/google/devtools/build/lib/analysis/WorkspaceStatusAction.java index 516afb12c6746d..6194ca1c9c9349 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/WorkspaceStatusAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/WorkspaceStatusAction.java @@ -39,7 +39,6 @@ import com.google.devtools.common.options.OptionEffectTag; import com.google.devtools.common.options.OptionsBase; import com.google.devtools.common.options.OptionsParsingException; -import com.google.devtools.common.options.OptionsProvider; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -60,8 +59,7 @@ * rebuilds if no other file is changed. This is useful for frequently-changing information that * does not significantly affect the build, e.g. the current time. * - *

For more information, see {@link - * com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory}. + *

For more information, see {@link Factory}. */ public abstract class WorkspaceStatusAction extends AbstractAction { @@ -91,20 +89,11 @@ public static class Options extends OptionsBase { public PathFragment workspaceStatusCommand; } - /** The type of a workspace status action key. */ - public enum KeyType { - INTEGER, - STRING, - } - /** * Action context required by the workspace status action as well as language-specific actions * that write workspace status artifacts. */ public interface Context extends ActionContext { - ImmutableMap getStableKeys(); - - ImmutableMap getVolatileKeys(); // TODO(ulfjack): Maybe move these to a separate ActionContext interface? WorkspaceStatusAction.Options getOptions(); @@ -114,36 +103,6 @@ public interface Context extends ActionContext { com.google.devtools.build.lib.shell.Command getCommand(); } - /** A key in the workspace status info file. */ - public static class Key { - private final KeyType type; - - private final String defaultValue; - private final String redactedValue; - - private Key(KeyType type, String defaultValue, String redactedValue) { - this.type = type; - this.defaultValue = defaultValue; - this.redactedValue = redactedValue; - } - - public KeyType getType() { - return type; - } - - public String getDefaultValue() { - return defaultValue; - } - - public String getRedactedValue() { - return redactedValue; - } - - public static Key of(KeyType type, String defaultValue, String redactedValue) { - return new Key(type, defaultValue, redactedValue); - } - } - /** * Parses the output of the workspace status action. * @@ -174,23 +133,6 @@ public interface Environment { Artifact createVolatileArtifact(String name); } - /** - * Environment for the {@link Factory} to create the dummy workspace status information. This is a - * subset of the information provided by CommandEnvironment. However, we cannot reference the - * CommandEnvironment from here due to layering. - */ - public interface DummyEnvironment { - Path getWorkspace(); - - /** Returns optional precomputed workspace info to include in the build info event. */ - @Nullable - WorkspaceInfoFromDiff getWorkspaceInfoFromDiff(); - - String getBuildRequestId(); - - OptionsProvider getOptions(); - } - /** Factory for {@link WorkspaceStatusAction}. */ public interface Factory { /** diff --git a/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java b/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java index 26fa38b1b5438d..254663f3206e2e 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java @@ -33,8 +33,6 @@ import com.google.devtools.build.lib.analysis.BuildInfo; import com.google.devtools.build.lib.analysis.BuildInfoEvent; import com.google.devtools.build.lib.analysis.WorkspaceStatusAction; -import com.google.devtools.build.lib.analysis.WorkspaceStatusAction.Key; -import com.google.devtools.build.lib.analysis.WorkspaceStatusAction.KeyType; import com.google.devtools.build.lib.buildtool.BuildRequest; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; @@ -315,29 +313,6 @@ private BazelWorkspaceStatusActionContext(CommandEnvironment env) { this.env = env; } - @Override - public ImmutableMap getStableKeys() { - WorkspaceStatusAction.Options options = - env.getOptions().getOptions(WorkspaceStatusAction.Options.class); - ImmutableMap.Builder builder = ImmutableMap.builder(); - builder.put( - BuildInfo.BUILD_EMBED_LABEL, Key.of(KeyType.STRING, options.embedLabel, "redacted")); - builder.put(BuildInfo.BUILD_HOST, Key.of(KeyType.STRING, "hostname", "redacted")); - builder.put(BuildInfo.BUILD_USER, Key.of(KeyType.STRING, "username", "redacted")); - return builder.buildOrThrow(); - } - - @Override - public ImmutableMap getVolatileKeys() { - return ImmutableMap.of( - BuildInfo.BUILD_TIMESTAMP, - Key.of(KeyType.INTEGER, "0", "0"), - BuildInfo.BUILD_SCM_REVISION, - Key.of(KeyType.STRING, "0", "0"), - BuildInfo.BUILD_SCM_STATUS, - Key.of(KeyType.STRING, "", "redacted")); - } - @Override public WorkspaceStatusAction.Options getOptions() { return env.getOptions().getOptions(WorkspaceStatusAction.Options.class); diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java index 776bcd1c4a04e1..c0ba6ddc4d1f8c 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java @@ -42,7 +42,6 @@ import com.google.devtools.build.lib.analysis.Runfiles; import com.google.devtools.build.lib.analysis.TopLevelArtifactContext; import com.google.devtools.build.lib.analysis.WorkspaceStatusAction; -import com.google.devtools.build.lib.analysis.WorkspaceStatusAction.Key; import com.google.devtools.build.lib.analysis.WorkspaceStatusAction.Options; import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue; import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue.RunfileSymlinksMode; @@ -287,17 +286,8 @@ public Artifact getStableStatus() { } } - /** A WorkspaceStatusAction.Context that has no stable keys and no volatile keys. */ + /** A {@link WorkspaceStatusAction.Context} that does not support any operations. */ public static class DummyWorkspaceStatusActionContext implements WorkspaceStatusAction.Context { - @Override - public ImmutableMap getStableKeys() { - return ImmutableMap.of(); - } - - @Override - public ImmutableMap getVolatileKeys() { - return ImmutableMap.of(); - } @Override public Options getOptions() { @@ -412,7 +402,7 @@ public StarlarkSemantics getStarlarkSemantics() { } @Override - public ImmutableMap getStarlarkDefinedBuiltins() throws InterruptedException { + public ImmutableMap getStarlarkDefinedBuiltins() { return null; }