Skip to content

Commit 81c1342

Browse files
authored
Fix build failures and update CI (#1528)
- Fix some CI todos - Update CI to test on previous LTS and Bazel 8 for supported platforms - Add a patch to stardoc to fix us having to depend on an old version (this patch fixes `load` statements being added to the docs which point to the doc aliases instead of the actual rules) - We should push stardoc to support something like this and/or fix alias support - Fix bad dependency version on `bazel_features`. It needs to include a version with `bazel_features.cc.fixed_dsym_path_quoting`
1 parent 26cd607 commit 81c1342

File tree

10 files changed

+210
-71
lines changed

10 files changed

+210
-71
lines changed

.bazelci/presubmit.yml

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,19 @@ x_defaults:
4848
- "//tools/..."
4949

5050
tasks:
51-
# TODO: Uncomment once Bazel 8 is released
52-
# macos_7:
53-
# name: "Previous LTS"
54-
# bazel: 7.x
55-
# <<: *mac_common
51+
macos_7:
52+
name: "Previous LTS with no bzlmod"
53+
bazel: 7.x
54+
build_flags:
55+
- "--noenable_bzlmod"
56+
- "--enable_workspace"
57+
<<: *mac_common
5658

5759
macos_latest:
5860
name: "Current LTS"
5961
bazel: latest
6062
<<: *mac_common
6163

62-
macos_latest_bzlmod:
63-
name: "Current LTS using bzlmod"
64-
bazel: latest
65-
<<: *mac_common
66-
6764
macos_last_green:
6865
name: "Last Green Bazel"
6966
bazel: last_green
@@ -78,15 +75,17 @@ tasks:
7875
- .bazelci/update_workspace_to_deps_heads.sh
7976
<<: *mac_common
8077

81-
# TODO: Uncomment once Bazel 8 is released
82-
# ubuntu2004_7:
83-
# name: "Previous LTS"
84-
# bazel: 7.x
85-
# shell_commands:
86-
# - "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
87-
# - "mkdir $SWIFT_HOME"
88-
# - "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
89-
# <<: *linux_common
78+
ubuntu2004_7:
79+
name: "Previous LTS with no bzlmod"
80+
bazel: 7.x
81+
shell_commands:
82+
- "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
83+
- "mkdir $SWIFT_HOME"
84+
- "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
85+
build_flags:
86+
- "--noenable_bzlmod"
87+
- "--enable_workspace"
88+
<<: *linux_common
9089

9190
ubuntu2004_latest:
9291
name: "Current LTS"
@@ -126,18 +125,14 @@ tasks:
126125

127126
doc_tests:
128127
name: "Doc tests"
129-
# TODO: Bump when https://github.com/bazelbuild/stardoc/issues/94#issuecomment-2492218404 is resolved
130-
bazel: 7.x
128+
bazel: latest
131129
<<: *linux_environment
132130
shell_commands:
133131
- "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
134132
- "mkdir $SWIFT_HOME"
135133
- "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
136134
test_targets:
137135
- "doc/..."
138-
# TODO: Remove this once stardoc is updated to 0.7.1+ (https://github.com/bazelbuild/stardoc/pull/238)
139-
test_flags:
140-
- "--action_env=PATH"
141-
- "--noincompatible_disallow_empty_glob"
142136

137+
# TODO: Update to version 8+ and fix errors
143138
buildifier: 6.3.2

MODULE.bazel

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ module(
66
repo_name = "build_bazel_rules_swift",
77
)
88

9-
bazel_dep(name = "bazel_features", version = "1.9.0")
9+
bazel_dep(name = "bazel_features", version = "1.10.0")
1010
bazel_dep(name = "bazel_skylib", version = "1.3.0")
1111
bazel_dep(name = "apple_support", version = "1.21.0", repo_name = "build_bazel_apple_support")
1212
bazel_dep(name = "rules_cc", version = "0.0.2")
1313
bazel_dep(name = "rules_shell", version = "0.3.0")
1414
bazel_dep(name = "platforms", version = "0.0.9")
15-
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
15+
bazel_dep(name = "protobuf", version = "23.1", repo_name = "com_google_protobuf")
1616
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
1717
bazel_dep(name = "nlohmann_json", version = "3.6.1", repo_name = "com_github_nlohmann_json")
1818
bazel_dep(
@@ -45,7 +45,7 @@ register_toolchains("@build_bazel_rules_swift_local_config//:all")
4545
# Dev dependencies
4646
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
4747
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
48-
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")
48+
bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True, repo_name = "io_bazel_stardoc")
4949

5050
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5151

@@ -57,19 +57,10 @@ http_archive(
5757
url = "https://github.com/apple/swift-syntax/archive/01fc3e3ed4d26121c06790abf8fe5ddaa22a4cc5.tar.gz",
5858
)
5959

60-
# TODO: Remove override when a protobuf release is available that supports
61-
# Bazel 8
62-
archive_override(
63-
module_name = "protobuf",
64-
integrity = "sha256-+dloYVexGlGsxKLTARuU4KXZ5ORo/BWPR6obFk73d+Q=",
65-
strip_prefix = "protobuf-b93b8e5f64ed922d101759380d7c6a2bbe474e26",
66-
urls = ["https://github.com/protocolbuffers/protobuf/archive/b93b8e5f64ed922d101759380d7c6a2bbe474e26.zip"],
67-
)
68-
69-
# TODO: Remove override when a protobuf release that marks `stardoc` as a
70-
# dev_dependency is available, until then it's upgrading our stardoc version
71-
# so override it here.
60+
# TODO: In stardoc 0.7.1+, the `load` statements added to the docs are relative to the `alias` targets which is incorrect.
61+
# To keep the docs without confusing load statements we patch a partial revert of: https://github.com/bazelbuild/stardoc/pull/216
7262
single_version_override(
7363
module_name = "stardoc",
74-
version = "0.6.2",
64+
patch_strip = 1,
65+
patches = ["//third_party/patches:stardoc-revert-load-statements-in-docs.patch"],
7566
)

WORKSPACE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,9 @@ bazel_skylib_gazelle_plugin_workspace()
7575
load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup")
7676

7777
bazel_skylib_gazelle_plugin_setup()
78+
79+
load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
80+
81+
rules_shell_dependencies()
82+
83+
rules_shell_toolchains()

doc/api.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module.
1313
## create_swift_interop_info
1414

1515
<pre>
16-
create_swift_interop_info(<a href="#create_swift_interop_info-exclude_headers">exclude_headers</a>, <a href="#create_swift_interop_info-module_map">module_map</a>, <a href="#create_swift_interop_info-module_name">module_name</a>, <a href="#create_swift_interop_info-requested_features">requested_features</a>, <a href="#create_swift_interop_info-suppressed">suppressed</a>,
17-
<a href="#create_swift_interop_info-swift_infos">swift_infos</a>, <a href="#create_swift_interop_info-unsupported_features">unsupported_features</a>)
16+
create_swift_interop_info(*, <a href="#create_swift_interop_info-exclude_headers">exclude_headers</a>, <a href="#create_swift_interop_info-module_map">module_map</a>, <a href="#create_swift_interop_info-module_name">module_name</a>, <a href="#create_swift_interop_info-requested_features">requested_features</a>,
17+
<a href="#create_swift_interop_info-suppressed">suppressed</a>, <a href="#create_swift_interop_info-swift_infos">swift_infos</a>, <a href="#create_swift_interop_info-unsupported_features">unsupported_features</a>)
1818
</pre>
1919

2020
Returns a provider that lets a target expose C/Objective-C APIs to Swift.
@@ -74,7 +74,7 @@ A provider whose type/layout is an implementation detail and should not
7474
## derive_swift_module_name
7575

7676
<pre>
77-
derive_swift_module_name(<a href="#derive_swift_module_name-args">args</a>)
77+
derive_swift_module_name(<a href="#derive_swift_module_name-args">*args</a>)
7878
</pre>
7979

8080
Returns a derived module name from the given build label.
@@ -164,7 +164,7 @@ A C++ `FeatureConfiguration` value (see
164164
## swift_common.compile
165165

166166
<pre>
167-
swift_common.compile(<a href="#swift_common.compile-actions">actions</a>, <a href="#swift_common.compile-additional_inputs">additional_inputs</a>, <a href="#swift_common.compile-cc_infos">cc_infos</a>, <a href="#swift_common.compile-copts">copts</a>, <a href="#swift_common.compile-defines">defines</a>, <a href="#swift_common.compile-exec_group">exec_group</a>,
167+
swift_common.compile(*, <a href="#swift_common.compile-actions">actions</a>, <a href="#swift_common.compile-additional_inputs">additional_inputs</a>, <a href="#swift_common.compile-cc_infos">cc_infos</a>, <a href="#swift_common.compile-copts">copts</a>, <a href="#swift_common.compile-defines">defines</a>, <a href="#swift_common.compile-exec_group">exec_group</a>,
168168
<a href="#swift_common.compile-extra_swift_infos">extra_swift_infos</a>, <a href="#swift_common.compile-feature_configuration">feature_configuration</a>, <a href="#swift_common.compile-generated_header_name">generated_header_name</a>, <a href="#swift_common.compile-is_test">is_test</a>,
169169
<a href="#swift_common.compile-include_dev_srch_paths">include_dev_srch_paths</a>, <a href="#swift_common.compile-module_name">module_name</a>, <a href="#swift_common.compile-package_name">package_name</a>, <a href="#swift_common.compile-plugins">plugins</a>, <a href="#swift_common.compile-private_cc_infos">private_cc_infos</a>,
170170
<a href="#swift_common.compile-private_swift_infos">private_swift_infos</a>, <a href="#swift_common.compile-srcs">srcs</a>, <a href="#swift_common.compile-swift_infos">swift_infos</a>, <a href="#swift_common.compile-swift_toolchain">swift_toolchain</a>, <a href="#swift_common.compile-target_name">target_name</a>,
@@ -250,7 +250,7 @@ A `struct` with the following fields:
250250
## swift_common.compile_module_interface
251251

252252
<pre>
253-
swift_common.compile_module_interface(<a href="#swift_common.compile_module_interface-actions">actions</a>, <a href="#swift_common.compile_module_interface-clang_module">clang_module</a>, <a href="#swift_common.compile_module_interface-compilation_contexts">compilation_contexts</a>, <a href="#swift_common.compile_module_interface-copts">copts</a>,
253+
swift_common.compile_module_interface(*, <a href="#swift_common.compile_module_interface-actions">actions</a>, <a href="#swift_common.compile_module_interface-clang_module">clang_module</a>, <a href="#swift_common.compile_module_interface-compilation_contexts">compilation_contexts</a>, <a href="#swift_common.compile_module_interface-copts">copts</a>,
254254
<a href="#swift_common.compile_module_interface-exec_group">exec_group</a>, <a href="#swift_common.compile_module_interface-feature_configuration">feature_configuration</a>, <a href="#swift_common.compile_module_interface-is_framework">is_framework</a>, <a href="#swift_common.compile_module_interface-module_name">module_name</a>,
255255
<a href="#swift_common.compile_module_interface-swiftinterface_file">swiftinterface_file</a>, <a href="#swift_common.compile_module_interface-swift_infos">swift_infos</a>, <a href="#swift_common.compile_module_interface-swift_toolchain">swift_toolchain</a>, <a href="#swift_common.compile_module_interface-target_name">target_name</a>,
256256
<a href="#swift_common.compile_module_interface-toolchain_type">toolchain_type</a>)
@@ -292,7 +292,7 @@ A Swift module context (as returned by `create_swift_module_context`)
292292
## swift_common.configure_features
293293

294294
<pre>
295-
swift_common.configure_features(<a href="#swift_common.configure_features-ctx">ctx</a>, <a href="#swift_common.configure_features-swift_toolchain">swift_toolchain</a>, <a href="#swift_common.configure_features-requested_features">requested_features</a>, <a href="#swift_common.configure_features-unsupported_features">unsupported_features</a>)
295+
swift_common.configure_features(<a href="#swift_common.configure_features-ctx">ctx</a>, <a href="#swift_common.configure_features-swift_toolchain">swift_toolchain</a>, *, <a href="#swift_common.configure_features-requested_features">requested_features</a>, <a href="#swift_common.configure_features-unsupported_features">unsupported_features</a>)
296296
</pre>
297297

298298
Creates a feature configuration to be passed to Swift build APIs.
@@ -359,8 +359,8 @@ A `struct` containing four fields:
359359
## swift_common.create_linking_context_from_compilation_outputs
360360

361361
<pre>
362-
swift_common.create_linking_context_from_compilation_outputs(<a href="#swift_common.create_linking_context_from_compilation_outputs-actions">actions</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-additional_inputs">additional_inputs</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-alwayslink">alwayslink</a>,
363-
<a href="#swift_common.create_linking_context_from_compilation_outputs-compilation_outputs">compilation_outputs</a>,
362+
swift_common.create_linking_context_from_compilation_outputs(*, <a href="#swift_common.create_linking_context_from_compilation_outputs-actions">actions</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-additional_inputs">additional_inputs</a>,
363+
<a href="#swift_common.create_linking_context_from_compilation_outputs-alwayslink">alwayslink</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-compilation_outputs">compilation_outputs</a>,
364364
<a href="#swift_common.create_linking_context_from_compilation_outputs-feature_configuration">feature_configuration</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-is_test">is_test</a>,
365365
<a href="#swift_common.create_linking_context_from_compilation_outputs-include_dev_srch_paths">include_dev_srch_paths</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-label">label</a>,
366366
<a href="#swift_common.create_linking_context_from_compilation_outputs-linking_contexts">linking_contexts</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-module_context">module_context</a>, <a href="#swift_common.create_linking_context_from_compilation_outputs-name">name</a>,
@@ -410,7 +410,7 @@ A tuple of `(CcLinkingContext, CcLinkingOutputs)` containing the linking
410410
## swift_common.extract_symbol_graph
411411

412412
<pre>
413-
swift_common.extract_symbol_graph(<a href="#swift_common.extract_symbol_graph-actions">actions</a>, <a href="#swift_common.extract_symbol_graph-compilation_contexts">compilation_contexts</a>, <a href="#swift_common.extract_symbol_graph-emit_extension_block_symbols">emit_extension_block_symbols</a>,
413+
swift_common.extract_symbol_graph(*, <a href="#swift_common.extract_symbol_graph-actions">actions</a>, <a href="#swift_common.extract_symbol_graph-compilation_contexts">compilation_contexts</a>, <a href="#swift_common.extract_symbol_graph-emit_extension_block_symbols">emit_extension_block_symbols</a>,
414414
<a href="#swift_common.extract_symbol_graph-feature_configuration">feature_configuration</a>, <a href="#swift_common.extract_symbol_graph-include_dev_srch_paths">include_dev_srch_paths</a>, <a href="#swift_common.extract_symbol_graph-minimum_access_level">minimum_access_level</a>,
415415
<a href="#swift_common.extract_symbol_graph-module_name">module_name</a>, <a href="#swift_common.extract_symbol_graph-output_dir">output_dir</a>, <a href="#swift_common.extract_symbol_graph-swift_infos">swift_infos</a>, <a href="#swift_common.extract_symbol_graph-swift_toolchain">swift_toolchain</a>,
416416
<a href="#swift_common.extract_symbol_graph-toolchain_type">toolchain_type</a>)
@@ -441,7 +441,7 @@ Extracts the symbol graph from a Swift module.
441441
## swift_common.get_toolchain
442442

443443
<pre>
444-
swift_common.get_toolchain(<a href="#swift_common.get_toolchain-ctx">ctx</a>, <a href="#swift_common.get_toolchain-exec_group">exec_group</a>, <a href="#swift_common.get_toolchain-mandatory">mandatory</a>, <a href="#swift_common.get_toolchain-toolchain_type">toolchain_type</a>, <a href="#swift_common.get_toolchain-attr">attr</a>)
444+
swift_common.get_toolchain(<a href="#swift_common.get_toolchain-ctx">ctx</a>, *, <a href="#swift_common.get_toolchain-exec_group">exec_group</a>, <a href="#swift_common.get_toolchain-mandatory">mandatory</a>, <a href="#swift_common.get_toolchain-toolchain_type">toolchain_type</a>, <a href="#swift_common.get_toolchain-attr">attr</a>)
445445
</pre>
446446

447447
Gets the Swift toolchain associated with the rule or aspect.
@@ -526,7 +526,7 @@ check it.
526526
## swift_common.precompile_clang_module
527527

528528
<pre>
529-
swift_common.precompile_clang_module(<a href="#swift_common.precompile_clang_module-actions">actions</a>, <a href="#swift_common.precompile_clang_module-cc_compilation_context">cc_compilation_context</a>, <a href="#swift_common.precompile_clang_module-exec_group">exec_group</a>,
529+
swift_common.precompile_clang_module(*, <a href="#swift_common.precompile_clang_module-actions">actions</a>, <a href="#swift_common.precompile_clang_module-cc_compilation_context">cc_compilation_context</a>, <a href="#swift_common.precompile_clang_module-exec_group">exec_group</a>,
530530
<a href="#swift_common.precompile_clang_module-feature_configuration">feature_configuration</a>, <a href="#swift_common.precompile_clang_module-module_map_file">module_map_file</a>, <a href="#swift_common.precompile_clang_module-module_name">module_name</a>,
531531
<a href="#swift_common.precompile_clang_module-swift_toolchain">swift_toolchain</a>, <a href="#swift_common.precompile_clang_module-target_name">target_name</a>, <a href="#swift_common.precompile_clang_module-toolchain_type">toolchain_type</a>, <a href="#swift_common.precompile_clang_module-swift_infos">swift_infos</a>)
532532
</pre>
@@ -560,8 +560,9 @@ A struct containing the precompiled module and optional indexstore directory,
560560
## swift_common.synthesize_interface
561561

562562
<pre>
563-
swift_common.synthesize_interface(<a href="#swift_common.synthesize_interface-actions">actions</a>, <a href="#swift_common.synthesize_interface-compilation_contexts">compilation_contexts</a>, <a href="#swift_common.synthesize_interface-feature_configuration">feature_configuration</a>, <a href="#swift_common.synthesize_interface-module_name">module_name</a>,
564-
<a href="#swift_common.synthesize_interface-output_file">output_file</a>, <a href="#swift_common.synthesize_interface-swift_infos">swift_infos</a>, <a href="#swift_common.synthesize_interface-swift_toolchain">swift_toolchain</a>, <a href="#swift_common.synthesize_interface-toolchain_type">toolchain_type</a>)
563+
swift_common.synthesize_interface(*, <a href="#swift_common.synthesize_interface-actions">actions</a>, <a href="#swift_common.synthesize_interface-compilation_contexts">compilation_contexts</a>, <a href="#swift_common.synthesize_interface-feature_configuration">feature_configuration</a>,
564+
<a href="#swift_common.synthesize_interface-module_name">module_name</a>, <a href="#swift_common.synthesize_interface-output_file">output_file</a>, <a href="#swift_common.synthesize_interface-swift_infos">swift_infos</a>, <a href="#swift_common.synthesize_interface-swift_toolchain">swift_toolchain</a>,
565+
<a href="#swift_common.synthesize_interface-toolchain_type">toolchain_type</a>)
565566
</pre>
566567

567568
Extracts the symbol graph from a Swift module.
@@ -586,7 +587,7 @@ Extracts the symbol graph from a Swift module.
586587
## swift_common.use_toolchain
587588

588589
<pre>
589-
swift_common.use_toolchain(<a href="#swift_common.use_toolchain-mandatory">mandatory</a>, <a href="#swift_common.use_toolchain-toolchain_type">toolchain_type</a>)
590+
swift_common.use_toolchain(*, <a href="#swift_common.use_toolchain-mandatory">mandatory</a>, <a href="#swift_common.use_toolchain-toolchain_type">toolchain_type</a>)
590591
</pre>
591592

592593
Returns a list of toolchain types needed to use the Swift toolchain.

0 commit comments

Comments
 (0)