aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java
diff options
context:
space:
mode:
authorGravatar Laurent Le Brun <laurentlb@google.com>2017-01-16 14:01:03 +0000
committerGravatar Vladimir Moskva <vladmos@google.com>2017-01-16 14:41:39 +0000
commit106f9e95c3d88209c5f1873b9718dc63ca1ad6f3 (patch)
tree7d94560dc45a45d8818987917a72b859a50cc8c2 /src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java
parenta1dd398f2a7a022d8d04d4ce0d2d2934dd355195 (diff)
Delete the cmd_helper.template function.
cmd_helper is deprecated and planned for deletion. RELNOTES[INC]: Removed the cmd_helper.template function. The function was equivalent to: def template(items, template): return [template.format(path = i.path, short_path = i.short_path) for i in items] -- PiperOrigin-RevId: 144628429 MOS_MIGRATED_REVID=144628429
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java
index 6267493cd5..3237ec8b14 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkCommandLine.java
@@ -14,8 +14,6 @@
package com.google.devtools.build.lib.rules;
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.skylarkinterface.Param;
@@ -23,8 +21,6 @@ import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
import com.google.devtools.build.lib.skylarkinterface.SkylarkSignature;
import com.google.devtools.build.lib.syntax.BuiltinFunction;
-import com.google.devtools.build.lib.syntax.Environment;
-import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
import com.google.devtools.build.lib.syntax.SkylarkNestedSet;
import com.google.devtools.build.lib.syntax.SkylarkSignatureProcessor;
@@ -33,7 +29,7 @@ import com.google.devtools.build.lib.syntax.SkylarkSignatureProcessor;
name = "cmd_helper",
namespace = true,
category = SkylarkModuleCategory.BUILTIN,
- doc = "Module for creating memory efficient command lines."
+ doc = "Deprecated. Module for creating memory efficient command lines."
)
public class SkylarkCommandLine {
@@ -42,7 +38,7 @@ public class SkylarkCommandLine {
objectType = SkylarkCommandLine.class,
returnType = String.class,
doc =
- "Creates a single command line argument joining the paths of a set "
+ "Deprecated. Creates a single command line argument joining the paths of a set "
+ "of files on the separator string.",
parameters = {
@Param(name = "separator", type = String.class, doc = "the separator string to join on."),
@@ -63,34 +59,6 @@ public class SkylarkCommandLine {
}
};
- // TODO(bazel-team): this method should support sets of objects and substitute all struct fields.
- @SkylarkSignature(name = "template",
- doc = "Transforms a set of files to a list of strings using the template string.",
- objectType = SkylarkCommandLine.class,
- returnType = MutableList.class,
- parameters = {
- @Param(name = "items", type = SkylarkNestedSet.class, generic1 = Artifact.class,
- doc = "The set of structs to transform."),
- @Param(name = "template", type = String.class,
- doc = "The template to use for the transformation, <code>%{path}</code> and "
- + "<code>%{short_path}</code> being substituted with the corresponding fields of each"
- + " file.")},
- useEnvironment = true)
- private static BuiltinFunction template = new BuiltinFunction("template") {
- public MutableList invoke(final SkylarkNestedSet items, final String template,
- Environment env) {
- return new MutableList(Iterables.transform(items, new Function<Object, String>() {
- @Override
- public String apply(Object input) {
- Artifact artifact = (Artifact) input;
- return template
- .replace("%{path}", artifact.getExecPathString())
- .replace("%{short_path}", artifact.getRootRelativePathString());
- }
- }), env);
- }
- };
-
static {
SkylarkSignatureProcessor.configureSkylarkFunctions(SkylarkCommandLine.class);
}