Skip to content

Commit

Permalink
Rollback context.actions.args() functionality.
Browse files Browse the repository at this point in the history
This will be rolled forward with a different API.

PiperOrigin-RevId: 168566666
  • Loading branch information
tomlu authored and philwo committed Sep 14, 2017
1 parent 73bd3fd commit a615d28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,11 @@ public void write(Artifact output, String content, Boolean isExecutable) throws
type = Object.class,
allowedTypes = {
@ParamType(type = SkylarkList.class),
@ParamType(type = Args.class),
},
defaultValue = "[]",
named = true,
positional = false,
doc =
"command line arguments of the action. "
+ "May be either a list or an actions.args() object. "
+ "See <a href=\"actions.html#args\">ctx.actions.args()</a>."
doc = "command line arguments of the action."
),
@Param(
name = "mnemonic",
Expand Down Expand Up @@ -442,14 +438,12 @@ public void run(
name = "arguments",
allowedTypes = {
@ParamType(type = SkylarkList.class),
@ParamType(type = Args.class),
},
defaultValue = "[]",
named = true,
positional = false,
doc =
"command line arguments of the action. "
+ "May be either a list or an actions.args() object.<br><br>"
+ "Blaze passes the elements in this attribute as arguments to the command."
+ "The command can access these arguments as <code>$1</code>, <code>$2</code>, "
+ "etc. See <a href=\"actions.html#args\">ctx.actions.args()</a>."
Expand Down Expand Up @@ -972,15 +966,6 @@ public SkylarkCustomCommandLine build() {
}
}

@SkylarkCallable(
name = "args",
doc = "returns an Args object that can be used to build memory-efficient command lines."
)
public Args args() {
return new Args(
skylarkSemanticsOptions, ruleContext.getAnalysisEnvironment().getEventHandler());
}

@Override
public boolean isImmutable() {
return context.isImmutable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.RunfilesProvider;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.skylark.SkylarkActionFactory.Args;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.skylarkinterface.Param;
Expand Down Expand Up @@ -120,14 +119,12 @@ public class SkylarkRuleImplementationFunctions {
name = "arguments",
allowedTypes = {
@ParamType(type = SkylarkList.class),
@ParamType(type = Args.class),
},
defaultValue = "[]",
named = true,
positional = false,
doc =
"command line arguments of the action."
+ "May be either a list or an actions.args() object."
),
@Param(
name = "mnemonic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import java.util.Map;
import java.util.regex.Pattern;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand Down Expand Up @@ -1736,6 +1737,7 @@ public void testBuiltInFunctionAsRuleImplementation() throws Exception {
getConfiguredTarget("//test:silly");
}

@Ignore
@Test
public void testLazyArgs() throws Exception {
SkylarkRuleContext ruleContext = createRuleContext("//foo:foo");
Expand Down Expand Up @@ -1790,6 +1792,7 @@ public void testLazyArgs() throws Exception {
.inOrder();
}

@Ignore
@Test
public void testScalarJoinWithErrorMessage() throws Exception {
SkylarkRuleContext ruleContext = createRuleContext("//foo:foo");
Expand All @@ -1799,6 +1802,7 @@ public void testScalarJoinWithErrorMessage() throws Exception {
"args = ruleContext.actions.args()\n" + "args.add(1, join_with=':')");
}

@Ignore
@Test
public void testScalarBeforeEachErrorMessage() throws Exception {
SkylarkRuleContext ruleContext = createRuleContext("//foo:foo");
Expand All @@ -1808,6 +1812,7 @@ public void testScalarBeforeEachErrorMessage() throws Exception {
"args = ruleContext.actions.args()\n" + "args.add(1, before_each='illegal')");
}

@Ignore
@Test
public void testLazyArgIllegalFormatString() throws Exception {
SkylarkRuleContext ruleContext = createRuleContext("//foo:foo");
Expand All @@ -1833,6 +1838,7 @@ public void testLazyArgIllegalFormatString() throws Exception {
}
}

@Ignore
@Test
public void testLazyArgBadMapFn() throws Exception {
SkylarkRuleContext ruleContext = createRuleContext("//foo:foo");
Expand All @@ -1859,6 +1865,7 @@ public void testLazyArgBadMapFn() throws Exception {
}
}

@Ignore
@Test
public void testLazyArgMapFnReturnsWrongType() throws Exception {
SkylarkRuleContext ruleContext = createRuleContext("//foo:foo");
Expand All @@ -1885,6 +1892,7 @@ public void testLazyArgMapFnReturnsWrongType() throws Exception {
}
}

@Ignore
@Test
public void createShellWithLazyArgs() throws Exception {
SkylarkRuleContext ruleContext = createRuleContext("//foo:foo");
Expand Down

0 comments on commit a615d28

Please sign in to comment.