Skip to content

Commit a50cca5

Browse files
zhengwei143copybara-github
authored andcommitted
Automated rollback of commit d56dc18.
*** Reason for rollback *** Breaks builds internally. *** Original change description *** Move Apple toolchain setup to apple_support This moves the CC toolchain for building Apple platforms besides macOS to the apple_support repo bazelbuild/apple_support#113 The default unix toolchain is now used if someone wants to build for macOS without the apple_support toolchain, but it doesn't handle as many platform specific features as the previous toolchain. Fixes #1... *** PiperOrigin-RevId: 516486823 Change-Id: If9b2542699cf8704e0a511e684d8519468ddd937
1 parent 6d004a3 commit a50cca5

26 files changed

Lines changed: 4536 additions & 110 deletions

.bazelci/postsubmit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ tasks:
202202
- "//third_party/ijar/..."
203203
- "//tools/android/..."
204204
- "//tools/aquery_differ/..."
205+
- "//tools/osx/crosstool/..."
205206
- "//tools/python/..."
206207
# C++ coverage is not supported on macOS yet.
207208
- "-//src/test/shell/bazel:bazel_cc_code_coverage_test"
@@ -265,6 +266,7 @@ tasks:
265266
- "//third_party/ijar/..."
266267
- "//tools/android/..."
267268
- "//tools/aquery_differ/..."
269+
- "//tools/osx/crosstool/..."
268270
- "//tools/python/..."
269271
# C++ coverage is not supported on macOS yet.
270272
- "-//src/test/shell/bazel:bazel_cc_code_coverage_test"

.bazelci/presubmit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ tasks:
192192
- "//third_party/ijar/..."
193193
- "//tools/android/..."
194194
- "//tools/aquery_differ/..."
195+
- "//tools/osx/crosstool/..."
195196
- "//tools/python/..."
196197
# Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162
197198
- "-//src/java_tools/buildjar/..."
@@ -255,6 +256,7 @@ tasks:
255256
- "//third_party/ijar/..."
256257
- "//tools/android/..."
257258
- "//tools/aquery_differ/..."
259+
- "//tools/osx/crosstool/..."
258260
- "//tools/python/..."
259261
# Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162
260262
- "-//src/java_tools/buildjar/..."

src/create_embedded_tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
('*def_parser.exe', lambda x: 'tools/def_parser/def_parser.exe'),
4343
('*zipper.exe', lambda x: 'tools/zip/zipper/zipper.exe'),
4444
('*zipper', lambda x: 'tools/zip/zipper/zipper'),
45+
('*xcode*make_hashed_objlist.py',
46+
lambda x: 'tools/objc/make_hashed_objlist.py'),
4547
('*xcode*xcode-locator', lambda x: 'tools/objc/xcode-locator'),
4648
('*src/tools/xcode/*', lambda x: 'tools/objc/' + os.path.basename(x)),
4749
# --experimental_sibling_repository_layout=false

src/main/starlark/builtins_bzl/common/objc/objc_library.bzl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ load("@_builtins//:common/objc/attrs.bzl", "common_attrs")
1919
load("@_builtins//:common/objc/objc_common.bzl", "extensions")
2020
load("@_builtins//:common/objc/transitions.bzl", "apple_crosstool_transition")
2121
load("@_builtins//:common/cc/cc_helper.bzl", "cc_helper")
22-
load(":common/cc/cc_common.bzl", "cc_common")
2322
load(":common/cc/cc_info.bzl", "CcInfo")
2423

2524
objc_internal = _builtins.internal.objc_internal
@@ -56,15 +55,6 @@ def _objc_library_impl(ctx):
5655
_validate_attributes(srcs = ctx.attr.srcs, non_arc_srcs = ctx.attr.non_arc_srcs, label = ctx.label)
5756

5857
cc_toolchain = cc_helper.find_cpp_toolchain(ctx)
59-
feature_configuration = cc_common.configure_features(
60-
ctx = ctx,
61-
cc_toolchain = cc_toolchain,
62-
requested_features = ctx.features,
63-
unsupported_features = ctx.disabled_features,
64-
)
65-
66-
if not cc_common.action_is_enabled(feature_configuration = feature_configuration, action_name = "objc-compile"):
67-
fail("Compiling objc_library targets requires the Apple CC toolchain which can be found here: https://github.com/bazelbuild/apple_support")
6858

6959
common_variables = compilation_support.build_common_variables(
7060
ctx = ctx,

src/test/java/com/google/devtools/build/lib/packages/util/MockObjcSupport.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public final class MockObjcSupport {
3939
"tvos_x86_64",
4040
"tvos_arm64");
4141

42+
private static final ImmutableList<String> DEFAULT_OSX_CROSSTOOL_DEPS_DIRS =
43+
ImmutableList.of("third_party/bazel/tools/osx/crosstool");
4244
public static final String DEFAULT_OSX_CROSSTOOL_DIR = "tools/osx/crosstool";
4345
private static final String MOCK_OSX_TOOLCHAIN_CONFIG_PATH =
4446
"com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl";
@@ -233,6 +235,9 @@ public static void setup(MockToolsConfig config) throws IOException {
233235
public static void setupCcToolchainConfig(
234236
MockToolsConfig config, CcToolchainConfig.Builder ccToolchainConfig) throws IOException {
235237
if (config.isRealFileSystem()) {
238+
for (String depDir : DEFAULT_OSX_CROSSTOOL_DEPS_DIRS) {
239+
config.linkTools(depDir);
240+
}
236241
config.linkTools(DEFAULT_OSX_CROSSTOOL_DIR);
237242
} else {
238243
CcToolchainConfig toolchainConfig = ccToolchainConfig.build();
@@ -256,6 +261,9 @@ public static void setupCcToolchainConfig(
256261

257262
public static void setupCcToolchainConfig(MockToolsConfig config) throws IOException {
258263
if (config.isRealFileSystem()) {
264+
for (String depDir : DEFAULT_OSX_CROSSTOOL_DEPS_DIRS) {
265+
config.linkTools(depDir);
266+
}
259267
config.linkTools(DEFAULT_OSX_CROSSTOOL_DIR);
260268
} else {
261269
new Crosstool(

src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,6 @@ def _impl(ctx):
12231223

12241224
if (ctx.attr.cpu == "x64_windows"):
12251225
objc_compile_action = action_config(
1226-
enabled = True,
12271226
action_name = ACTION_NAMES.objc_compile,
12281227
flag_sets = [
12291228
flag_set(
@@ -1256,7 +1255,6 @@ def _impl(ctx):
12561255
)
12571256
elif (ctx.attr.cpu == "ios_arm64"):
12581257
objc_compile_action = action_config(
1259-
enabled = True,
12601258
action_name = ACTION_NAMES.objc_compile,
12611259
flag_sets = [
12621260
flag_set(
@@ -1289,7 +1287,6 @@ def _impl(ctx):
12891287
)
12901288
elif (ctx.attr.cpu == "tvos_arm64"):
12911289
objc_compile_action = action_config(
1292-
enabled = True,
12931290
action_name = ACTION_NAMES.objc_compile,
12941291
flag_sets = [
12951292
flag_set(
@@ -1322,7 +1319,6 @@ def _impl(ctx):
13221319
)
13231320
elif (ctx.attr.cpu == "ios_armv7"):
13241321
objc_compile_action = action_config(
1325-
enabled = True,
13261322
action_name = ACTION_NAMES.objc_compile,
13271323
flag_sets = [
13281324
flag_set(
@@ -1355,7 +1351,6 @@ def _impl(ctx):
13551351
)
13561352
elif (ctx.attr.cpu == "watchos_armv7k"):
13571353
objc_compile_action = action_config(
1358-
enabled = True,
13591354
action_name = ACTION_NAMES.objc_compile,
13601355
flag_sets = [
13611356
flag_set(
@@ -1388,7 +1383,6 @@ def _impl(ctx):
13881383
)
13891384
elif (ctx.attr.cpu == "watchos_arm64_32"):
13901385
objc_compile_action = action_config(
1391-
enabled = True,
13921386
action_name = ACTION_NAMES.objc_compile,
13931387
flag_sets = [
13941388
flag_set(
@@ -1421,7 +1415,6 @@ def _impl(ctx):
14211415
)
14221416
elif (ctx.attr.cpu == "ios_i386"):
14231417
objc_compile_action = action_config(
1424-
enabled = True,
14251418
action_name = ACTION_NAMES.objc_compile,
14261419
flag_sets = [
14271420
flag_set(
@@ -1455,7 +1448,6 @@ def _impl(ctx):
14551448
)
14561449
elif (ctx.attr.cpu == "watchos_i386"):
14571450
objc_compile_action = action_config(
1458-
enabled = True,
14591451
action_name = ACTION_NAMES.objc_compile,
14601452
flag_sets = [
14611453
flag_set(
@@ -1489,7 +1481,6 @@ def _impl(ctx):
14891481
)
14901482
elif (ctx.attr.cpu == "watchos_x86_64"):
14911483
objc_compile_action = action_config(
1492-
enabled = True,
14931484
action_name = ACTION_NAMES.objc_compile,
14941485
flag_sets = [
14951486
flag_set(
@@ -1523,7 +1514,6 @@ def _impl(ctx):
15231514
)
15241515
elif (ctx.attr.cpu == "ios_x86_64"):
15251516
objc_compile_action = action_config(
1526-
enabled = True,
15271517
action_name = ACTION_NAMES.objc_compile,
15281518
flag_sets = [
15291519
flag_set(
@@ -1557,7 +1547,6 @@ def _impl(ctx):
15571547
)
15581548
elif (ctx.attr.cpu == "tvos_x86_64"):
15591549
objc_compile_action = action_config(
1560-
enabled = True,
15611550
action_name = ACTION_NAMES.objc_compile,
15621551
flag_sets = [
15631552
flag_set(
@@ -1591,7 +1580,6 @@ def _impl(ctx):
15911580
)
15921581
elif (ctx.attr.cpu == "darwin_x86_64"):
15931582
objc_compile_action = action_config(
1594-
enabled = True,
15951583
action_name = ACTION_NAMES.objc_compile,
15961584
flag_sets = [
15971585
flag_set(

src/test/py/bazel/bzlmod/bzlmod_query_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def testAqueryModuleRepoTargetsBelow(self):
9292
allow_failure=False)
9393
# This label is stringified into a "purpose" in some action before it
9494
# reaches aquery code, so can't decanonicalize it.
95-
self.assertIn('cc_library-compile for @aaa~1.0//:lib_aaa', stdout)
95+
self.assertEqual(stdout[0], 'cc_library-compile for @aaa~1.0//:lib_aaa')
9696
self.assertIn('Target: @my_repo//:lib_aaa', stdout)
9797

9898
def testAqueryModuleRepoTransitiveDeps(self):

src/test/shell/bazel/apple/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ sh_test(
3838
"//:workspace-file",
3939
"//src/test/shell/bazel:test-deps",
4040
],
41+
shard_count = 3,
4142
tags = ["no_windows"],
4243
)
4344

0 commit comments

Comments
 (0)