Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,6 @@ public boolean isToolConfiguration() {
return isExecConfiguration();
}

@Override
public boolean isToolConfigurationForStarlark(StarlarkThread thread) throws EvalException {
BuiltinRestriction.failIfCalledOutsideDefaultAllowlist(thread);
return isToolConfiguration();
}

public boolean checkVisibility() {
return options.checkVisibility;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ public interface BuildConfigurationApi extends StarlarkValue {
@StarlarkMethod(name = "stamp_binaries", documented = false, useStarlarkThread = true)
boolean stampBinariesForStarlark(StarlarkThread thread) throws EvalException;

@StarlarkMethod(name = "is_tool_configuration", documented = false, useStarlarkThread = true)
boolean isToolConfigurationForStarlark(StarlarkThread thread) throws EvalException;
@StarlarkMethod(
name = "is_tool_configuration",
doc = "Returns true when building in the tool (exec) configuration.")
boolean isToolConfiguration();

@StarlarkMethod(
name = "has_separate_genfiles_directory",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _test_rule_impl(ctx):
}

@Test
public void testIsToolConfigurationIsBlocked() throws Exception {
public void testIsToolConfiguration() throws Exception {
scratch.file(
"example/BUILD",
"""
Expand All @@ -90,15 +90,14 @@ public void testIsToolConfigurationIsBlocked() throws Exception {
"example/rule.bzl",
"""
def _impl(ctx):
ctx.configuration.is_tool_configuration()
if ctx.configuration.is_tool_configuration():
fail("should not be tool configuration")
return [DefaultInfo()]

custom_rule = rule(implementation = _impl)
""");

AssertionError e =
assertThrows(AssertionError.class, () -> getConfiguredTarget("//example:custom"));
assertThat(e).hasMessageThat().contains("file '//example:rule.bzl' cannot use private API");
getConfiguredTarget("//example:custom");
}

@Test
Expand Down
Loading