Skip to content

Commit eb1b3fc

Browse files
comiuscopybara-github
authored andcommitted
Remove rules_cc from autoloads
With all rules, providers and cc_module now in rules_cc, removing rules_cc from autoloads, now shows how much weight the flag is still bearing. PiperOrigin-RevId: 829266502 Change-Id: I148589cd0f0a814efbd4da7b635d899b205eaff7
1 parent 5b1f4bc commit eb1b3fc

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

src/main/java/com/google/devtools/build/lib/packages/semantics/FlagConstants.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ private FlagConstants() {}
2727

2828
// TODO - ilist@: once Java providers are removed, the whole line can be compressed to
2929
// "@rules_java"
30-
public static final String DEFAULT_INCOMPATIBLE_AUTOLOAD_EXTERNALLY =
31-
"+@rules_cc";
30+
public static final String DEFAULT_INCOMPATIBLE_AUTOLOAD_EXTERNALLY = "";
3231

3332
// Enable annotations, but not actual type checking, with the effect that the parser tolerates
3433
// arbitrary expressions in annotations for now.

src/test/py/bazel/bzlmod/external_repo_completion_test.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def setUp(self):
138138
]
139139

140140
self.main_registry.createLocalPathModule(
141-
'ext', '1.0', 'ext', {'rules_shell': '0.6.0'}
141+
'ext', '1.0', 'ext', {'rules_shell': '0.6.0', 'rules_cc': '0.2.13'}
142142
)
143143
scratchFile(
144144
self.projects_dir.joinpath('ext', 'BUILD'),
@@ -149,11 +149,17 @@ def setUp(self):
149149
)
150150
scratchFile(
151151
self.projects_dir.joinpath('ext', 'tools', 'BUILD'),
152-
['cc_binary(name="tool")'],
152+
[
153+
'load("@rules_cc//cc:cc_binary.bzl", "cc_binary")',
154+
'cc_binary(name="tool")'
155+
],
153156
)
154157
scratchFile(
155158
self.projects_dir.joinpath('ext', 'tools', 'zip', 'BUILD'),
156-
['cc_binary(name="zipper")'],
159+
[
160+
'load("@rules_cc//cc:cc_binary.bzl", "cc_binary")',
161+
'cc_binary(name="zipper")'
162+
],
157163
)
158164
scratchFile(self.projects_dir.joinpath('ext', 'ext.bzl'), ext_src)
159165
self.main_registry.createLocalPathModule(

src/test/shell/bazel/bazel_coverage_cc_test_llvm.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ EOF
309309
touch other_repo/REPO.bazel
310310

311311
cat > other_repo/BUILD <<'EOF'
312+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
313+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
314+
312315
cc_library(
313316
name = "a",
314317
srcs = ["a.cc"],

src/test/shell/bazel/external_files_test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ build_def() {
4747
cat > _.MODULE <<'EOF'
4848
module(name = "remote")
4949
EOF
50+
add_rules_cc "_.MODULE"
5051
mkdir src
5152
cat > _.BUILD <<'EOF'
53+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
54+
5255
cc_binary(
5356
name = "hello",
5457
srcs = ["main.c", "consts/greeting.h"],
@@ -82,6 +85,7 @@ http_archive(
8285
},
8386
)
8487
EOF
88+
add_rules_cc "MODULE.bazel"
8589

8690
bazel build @remote//src:hello || fail "Expected build to succeed"
8791
bazel run @remote//src:hello | grep 'Hello World' \
@@ -118,6 +122,7 @@ http_archive(
118122
},
119123
)
120124
EOF
125+
add_rules_cc "MODULE.bazel"
121126

122127
bazel build @remote//src:hello || fail "Expected build to succeed"
123128
bazel run @remote//src:hello | grep 'Hello World' \
@@ -156,6 +161,7 @@ http_archive(
156161
},
157162
)
158163
EOF
164+
add_rules_cc "MODULE.bazel"
159165

160166
bazel build @remote//src:hello || fail "Expected build to succeed"
161167
bazel run @remote//src:hello | grep 'Hello World' \

src/test/shell/bazel/local_repository_test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,8 @@ function test_cc_binary_in_local_repository() {
651651
mkdir $r
652652
touch $r/REPO.bazel
653653
cat > $r/BUILD <<EOF
654+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
655+
654656
cc_binary(
655657
name = "bin",
656658
srcs = ["bin.cc"],
@@ -667,6 +669,7 @@ local_repository(
667669
path = "$r",
668670
)
669671
EOF
672+
add_rules_cc "MODULE.bazel"
670673

671674
bazel build @r//:bin || fail "build failed"
672675
}

0 commit comments

Comments
 (0)