diff options
author | 2015-10-15 05:28:05 +0000 | |
---|---|---|
committer | 2015-10-15 10:59:34 +0000 | |
commit | c82224f4945118392488e508f179cdf1918491bd (patch) | |
tree | 2726a6a57cefbd6065f7b61cee5816207c46a325 /src/main/java/com | |
parent | c3738b1d20c9a105729031beab2952889014e05b (diff) |
Remove command_helper, use resolve_command instead
Eliminate side-effect in command_line_srcs and hide the internal class.
--
MOS_MIGRATED_REVID=105480701
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java | 9 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java | 38 |
2 files changed, 0 insertions, 47 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java index 0a48b2c50f..61e88e1565 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java @@ -25,8 +25,6 @@ import com.google.devtools.build.lib.actions.BaseSpawn; import com.google.devtools.build.lib.analysis.actions.FileWriteAction; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; -import com.google.devtools.build.lib.syntax.SkylarkCallable; -import com.google.devtools.build.lib.syntax.SkylarkModule; import com.google.devtools.build.lib.syntax.Type; import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.vfs.PathFragment; @@ -51,9 +49,6 @@ import javax.annotation.Nullable; * that will contain the same commands, * at which point the shell script is added to the list of inputs. */ -@SkylarkModule(name = "command_helper", - doc = "Experimental. The API will change in the future.<br>" - + "A helper class to create shell commands.") public final class CommandHelper { /** @@ -146,12 +141,10 @@ public final class CommandHelper { this.labelMap = labelMapBuilder.build(); } - @SkylarkCallable(name = "resolved_tools", doc = "Experimental.", structField = true) public List<Artifact> getResolvedTools() { return resolvedTools; } - @SkylarkCallable(name = "runfiles_manifests", doc = "Experimental.", structField = true) public ImmutableMap<PathFragment, Artifact> getRemoteRunfileManifestMap() { return remoteRunfileManifestMap; } @@ -195,7 +188,6 @@ public final class CommandHelper { * Resolves the 'cmd' attribute, and expands known locations for $(location) * variables. */ - @SkylarkCallable(doc = "Experimental.") public String resolveCommandAndExpandLabels( Boolean supportLegacyExpansion, Boolean allowDataInLabel) { return resolveCommandAndExpandLabels( @@ -292,7 +284,6 @@ public final class CommandHelper { * command line is longer than the allowed maximum {@link #maxCommandLength}. * Fixes up the input artifact list with the created bash script when required. */ - @SkylarkCallable(doc = "Experimental.") public List<String> buildCommandLine( String command, List<Artifact> inputs, String scriptPostFix) { Pair<List<String>, Artifact> argvAndScriptFile = buildCommandLineMaybeWithScriptFile( diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java index 5bf0ac617d..cecf3f5c7a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java @@ -522,44 +522,6 @@ public class SkylarkRuleImplementationFunctions { } @SkylarkSignature( - name = "command_helper", - doc = "Experimental. Creates a command helper class.", - objectType = SkylarkRuleContext.class, - returnType = CommandHelper.class, - mandatoryPositionals = { - @Param(name = "self", type = SkylarkRuleContext.class, doc = "this RuleContext"), - @Param( - name = "tools", - type = SkylarkList.class, - generic1 = TransitiveInfoCollection.class, - doc = "list of tools (list of targets)" - ), - @Param( - name = "label_dict", - type = Map.class, - defaultValue = "{}", - doc = - "dictionary of resolved labels and the corresponding list of Files " - + "(a dict of Label : list of Files)" - ) - } - ) - private static final BuiltinFunction createCommandHelper = - new BuiltinFunction("command_helper") { - @SuppressWarnings("unchecked") - // TODO(bazel-team): this cast to Map is unchecked and is not safe. - // The best way to fix this probably is to convert CommandHelper to Skylark. - public CommandHelper invoke( - SkylarkRuleContext ctx, SkylarkList tools, Map<Label, Iterable<Artifact>> labelDict) - throws ConversionException, EvalException { - return new CommandHelper( - ctx.getRuleContext(), - castList(tools, TransitiveInfoCollection.class), - ImmutableMap.copyOf(labelDict)); - } - }; - - @SkylarkSignature( name = "resolve_command", doc = "Experimental." + "Returns a tuple of the list of resolved inputs, " |