Skip to content

Commit

Permalink
Remove nocopts attribute from cc_library.bzl
Browse files Browse the repository at this point in the history
Using this attribute was disabled, see #8706. It was added to the Starlark rule definition although it wasn't working. It is now moved to semantics while we do the necessary internal migration to remove it completely.

output_filter_test doesn't make sense in Bazel since nocopts is not available. The file must remain while we migrate internally away from nocopts though.

RELNOTES:none
PiperOrigin-RevId: 503155992
Change-Id: I43184941c9cb9ee97d5229cf37062b346643a48a
  • Loading branch information
oquenchil authored and hvadehra committed Feb 14, 2023
1 parent 1de34f1 commit b7ff827
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/starlark/builtins_bzl/common/cc/cc_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ attrs = {
),
"linkstamp": attr.label(allow_single_file = True),
"linkopts": attr.string_list(),
"nocopts": attr.string(),
"includes": attr.string_list(),
"defines": attr.string_list(),
"copts": attr.string_list(),
Expand Down Expand Up @@ -610,6 +609,7 @@ attrs = {
attrs.update(semantics.get_distribs_attr())
attrs.update(semantics.get_loose_mode_in_hdrs_check_allowed_attr())
attrs.update(semantics.get_implementation_deps_allowed_attr())
attrs.update(semantics.get_nocopts_attr())

cc_library = rule(
implementation = _cc_library_impl,
Expand Down
4 changes: 4 additions & 0 deletions src/main/starlark/builtins_bzl/common/cc/semantics.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def _get_linkstatic_default(ctx):
# Binaries link statically.
return True

def _get_nocopts_attr():
return {}

semantics = struct(
ALLOWED_RULES_IN_DEPS = [
"cc_library",
Expand Down Expand Up @@ -201,4 +204,5 @@ semantics = struct(
get_coverage_attrs = _get_coverage_attrs,
get_coverage_env = _get_coverage_env,
get_proto_aspects = _get_proto_aspects,
get_nocopts_attr = _get_nocopts_attr,
)
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,9 @@ private static String removeOutDirectory(String s) {

@Test
public void testNoCoptsDisabled() throws Exception {
if (analysisMock.isThisBazel()) {
return;
}
reporter.removeHandler(failFastHandler);
scratch.file("x/BUILD", "cc_library(name = 'foo', srcs = ['a.cc'], nocopts = 'abc')");
useConfiguration("--incompatible_disable_nocopts");
Expand Down
10 changes: 0 additions & 10 deletions src/test/shell/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,6 @@ sh_test(
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
)

sh_test(
name = "output_filter_test",
size = "large",
srcs = ["output_filter_test.sh"],
data = [
":test-deps",
"@bazel_tools//tools/bash/runfiles",
],
)

sh_test(
name = "bazel_testjobs_test",
srcs = ["bazel_testjobs_test.sh"],
Expand Down

0 comments on commit b7ff827

Please sign in to comment.