Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: upgrade stardoc and protobuf to restore Bazel HEAD CI #1462

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
3 changes: 1 addition & 2 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ matrix:
- 7.x
# TODO: Uncomment once Bazel 8 is released
# - 8.x
# TODO: Uncomment once we support HEAD again
# - latest
- last_green
platform:
- ubuntu2004
tasks:
Expand Down
22 changes: 2 additions & 20 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_cc", version = "0.0.2")
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "protobuf", version = "29.0")
bazel_dep(name = "nlohmann_json", version = "3.6.1", repo_name = "com_github_nlohmann_json")
bazel_dep(
name = "swift_argument_parser",
Expand Down Expand Up @@ -43,7 +42,7 @@ register_toolchains("@build_bazel_rules_swift_local_config//:all")
# Dev dependencies
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = True, repo_name = "io_bazel_stardoc")

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

Expand All @@ -54,20 +53,3 @@ http_archive(
strip_prefix = "swift-syntax-01fc3e3ed4d26121c06790abf8fe5ddaa22a4cc5",
url = "https://github.com/apple/swift-syntax/archive/01fc3e3ed4d26121c06790abf8fe5ddaa22a4cc5.tar.gz",
)

# TODO: Remove override when a protobuf release is available that supports
# Bazel 8
archive_override(
module_name = "protobuf",
integrity = "sha256-+dloYVexGlGsxKLTARuU4KXZ5ORo/BWPR6obFk73d+Q=",
strip_prefix = "protobuf-b93b8e5f64ed922d101759380d7c6a2bbe474e26",
urls = ["https://github.com/protocolbuffers/protobuf/archive/b93b8e5f64ed922d101759380d7c6a2bbe474e26.zip"],
)

# TODO: Remove override when a protobuf release that marks `stardoc` as a
# dev_dependency is available, until then it's upgrading our stardoc version
# so override it here.
single_version_override(
module_name = "stardoc",
version = "0.6.2",
)
52 changes: 40 additions & 12 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ module.
## create_swift_interop_info

<pre>
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>,
<a href="#create_swift_interop_info-swift_infos">swift_infos</a>, <a href="#create_swift_interop_info-unsupported_features">unsupported_features</a>)
load("@rules_swift//doc:doc.bzl", "create_swift_interop_info")

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>, <a href="#create_swift_interop_info-swift_infos">swift_infos</a>, <a href="#create_swift_interop_info-unsupported_features">unsupported_features</a>)
</pre>

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

<pre>
derive_swift_module_name(<a href="#derive_swift_module_name-args">args</a>)
load("@rules_swift//doc:doc.bzl", "derive_swift_module_name")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, this is annoying.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main annoying thing is doc.bzl versus where it actually is 😕.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this something we should bring up in the stardoc repo as a bug? or maybe there's another way we're supposed to be organizing these?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably use a full issue. I saw it mentioned in a comment here: bazelbuild/stardoc#94 (comment)

I think we need to go the route of concatenating the output instead.


derive_swift_module_name(<a href="#derive_swift_module_name-args">*args</a>)
</pre>

Returns a derived module name from the given build label.
Expand Down Expand Up @@ -112,6 +116,8 @@ The module name derived from the label.
## is_swift_overlay

<pre>
load("@rules_swift//doc:doc.bzl", "is_swift_overlay")

is_swift_overlay(<a href="#is_swift_overlay-target">target</a>)
</pre>

Expand Down Expand Up @@ -140,6 +146,8 @@ True if the target is a `swift_overlay`, otherwise False.
## swift_common.cc_feature_configuration

<pre>
load("@rules_swift//doc:doc.bzl", "swift_common")

swift_common.cc_feature_configuration(<a href="#swift_common.cc_feature_configuration-feature_configuration">feature_configuration</a>)
</pre>

Expand All @@ -164,7 +172,9 @@ A C++ `FeatureConfiguration` value (see
## swift_common.compile

<pre>
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>,
load("@rules_swift//doc:doc.bzl", "swift_common")

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>,
<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>,
<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>,
<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>,
Expand Down Expand Up @@ -249,7 +259,9 @@ A `struct` with the following fields:
## swift_common.compile_module_interface

<pre>
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>,
load("@rules_swift//doc:doc.bzl", "swift_common")

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>,
<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>,
<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>)
</pre>
Expand Down Expand Up @@ -289,7 +301,9 @@ A Swift module context (as returned by `create_swift_module_context`)
## swift_common.configure_features

<pre>
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>)
load("@rules_swift//doc:doc.bzl", "swift_common")

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>)
</pre>

Creates a feature configuration to be passed to Swift build APIs.
Expand Down Expand Up @@ -323,6 +337,8 @@ An opaque value representing the feature configuration that can be
## swift_common.create_compilation_context

<pre>
load("@rules_swift//doc:doc.bzl", "swift_common")

swift_common.create_compilation_context(<a href="#swift_common.create_compilation_context-defines">defines</a>, <a href="#swift_common.create_compilation_context-srcs">srcs</a>, <a href="#swift_common.create_compilation_context-transitive_modules">transitive_modules</a>)
</pre>

Expand Down Expand Up @@ -356,8 +372,10 @@ A `struct` containing four fields:
## swift_common.create_linking_context_from_compilation_outputs

<pre>
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>,
<a href="#swift_common.create_linking_context_from_compilation_outputs-compilation_outputs">compilation_outputs</a>,
load("@rules_swift//doc:doc.bzl", "swift_common")

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>, <a href="#swift_common.create_linking_context_from_compilation_outputs-compilation_outputs">compilation_outputs</a>,
<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>,
<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>,
<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>,
Expand Down Expand Up @@ -405,7 +423,9 @@ A tuple of `(CcLinkingContext, CcLinkingOutputs)` containing the linking
## swift_common.extract_symbol_graph

<pre>
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>,
load("@rules_swift//doc:doc.bzl", "swift_common")

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>,
<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>,
<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>)
</pre>
Expand Down Expand Up @@ -434,7 +454,9 @@ Extracts the symbol graph from a Swift module.
## swift_common.get_toolchain

<pre>
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-attr">attr</a>)
load("@rules_swift//doc:doc.bzl", "swift_common")

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-attr">attr</a>)
</pre>

Gets the Swift toolchain associated with the rule or aspect.
Expand All @@ -460,6 +482,8 @@ A `SwiftToolchainInfo` provider, or `None` if the toolchain was not
## swift_common.is_enabled

<pre>
load("@rules_swift//doc:doc.bzl", "swift_common")

swift_common.is_enabled(<a href="#swift_common.is_enabled-feature_configuration">feature_configuration</a>, <a href="#swift_common.is_enabled-feature_name">feature_name</a>)
</pre>

Expand Down Expand Up @@ -488,7 +512,9 @@ check it.
## swift_common.precompile_clang_module

<pre>
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>,
load("@rules_swift//doc:doc.bzl", "swift_common")

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>,
<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>,
<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-swift_infos">swift_infos</a>)
</pre>
Expand Down Expand Up @@ -521,7 +547,9 @@ A struct containing the precompiled module and optional indexstore directory,
## swift_common.use_toolchain

<pre>
swift_common.use_toolchain(<a href="#swift_common.use_toolchain-mandatory">mandatory</a>)
load("@rules_swift//doc:doc.bzl", "swift_common")

swift_common.use_toolchain(*, <a href="#swift_common.use_toolchain-mandatory">mandatory</a>)
</pre>

Returns a list of toolchain types needed to use the Swift toolchain.
Expand Down
2 changes: 1 addition & 1 deletion doc/proto_migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ proto_library(
name = "bar_proto",
srcs = ["bar.proto"],
deps = [
"@com_google_protobuf//:api_proto",
"@protobuf//:api_proto",
":foo_proto",
],
)
Expand Down
22 changes: 17 additions & 5 deletions doc/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ On this page:
## SwiftInfo

<pre>
SwiftInfo(<a href="#SwiftInfo-direct_modules">direct_modules</a>, <a href="#SwiftInfo-transitive_modules">transitive_modules</a>)
load("@rules_swift//doc:doc.bzl", "SwiftInfo")

SwiftInfo(*, <a href="#SwiftInfo-_init-direct_swift_infos">direct_swift_infos</a>, <a href="#SwiftInfo-_init-modules">modules</a>, <a href="#SwiftInfo-_init-swift_infos">swift_infos</a>)
</pre>

Contains information about the compiled artifacts of a Swift module.
Expand Down Expand Up @@ -48,8 +50,15 @@ where the arguments are:
When reading an existing `SwiftInfo` provider, it has the two fields described
below.

**FIELDS**
**CONSTRUCTOR PARAMETERS**

| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="SwiftInfo-_init-direct_swift_infos"></a>direct_swift_infos | <p align="center">-</p> | `[]` |
| <a id="SwiftInfo-_init-modules"></a>modules | <p align="center">-</p> | `[]` |
| <a id="SwiftInfo-_init-swift_infos"></a>swift_infos | <p align="center">-</p> | `[]` |

**FIELDS**

| Name | Description |
| :------------- | :------------- |
Expand All @@ -62,14 +71,15 @@ below.
## SwiftProtoCompilerInfo

<pre>
load("@rules_swift//doc:doc.bzl", "SwiftProtoCompilerInfo")

SwiftProtoCompilerInfo(<a href="#SwiftProtoCompilerInfo-bundled_proto_paths">bundled_proto_paths</a>, <a href="#SwiftProtoCompilerInfo-compile">compile</a>, <a href="#SwiftProtoCompilerInfo-compiler_deps">compiler_deps</a>, <a href="#SwiftProtoCompilerInfo-internal">internal</a>)
</pre>

Provides information needed to generate Swift code from `ProtoInfo` providers

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="SwiftProtoCompilerInfo-bundled_proto_paths"></a>bundled_proto_paths | List of proto paths for which to skip generation because they're built into the modules imported by the generated Swift proto code, e.g., SwiftProtobuf. |
Expand All @@ -83,14 +93,15 @@ Provides information needed to generate Swift code from `ProtoInfo` providers
## SwiftProtoInfo

<pre>
load("@rules_swift//doc:doc.bzl", "SwiftProtoInfo")

SwiftProtoInfo(<a href="#SwiftProtoInfo-module_name">module_name</a>, <a href="#SwiftProtoInfo-module_mappings">module_mappings</a>, <a href="#SwiftProtoInfo-direct_pbswift_files">direct_pbswift_files</a>, <a href="#SwiftProtoInfo-pbswift_files">pbswift_files</a>)
</pre>

Propagates Swift-specific information about a `proto_library`.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="SwiftProtoInfo-module_name"></a>module_name | The name of the Swift module compiled from the `swift_proto_library` which produced this provider. |
Expand All @@ -104,6 +115,8 @@ Propagates Swift-specific information about a `proto_library`.
## SwiftToolchainInfo

<pre>
load("@rules_swift//doc:doc.bzl", "SwiftToolchainInfo")

SwiftToolchainInfo(<a href="#SwiftToolchainInfo-action_configs">action_configs</a>, <a href="#SwiftToolchainInfo-cc_language">cc_language</a>, <a href="#SwiftToolchainInfo-cc_toolchain_info">cc_toolchain_info</a>, <a href="#SwiftToolchainInfo-clang_implicit_deps_providers">clang_implicit_deps_providers</a>,
<a href="#SwiftToolchainInfo-const_protocols_to_gather">const_protocols_to_gather</a>, <a href="#SwiftToolchainInfo-cross_import_overlays">cross_import_overlays</a>, <a href="#SwiftToolchainInfo-debug_outputs_provider">debug_outputs_provider</a>,
<a href="#SwiftToolchainInfo-developer_dirs">developer_dirs</a>, <a href="#SwiftToolchainInfo-entry_point_linkopts_provider">entry_point_linkopts_provider</a>, <a href="#SwiftToolchainInfo-feature_allowlists">feature_allowlists</a>,
Expand All @@ -117,7 +130,6 @@ that use the toolchain.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="SwiftToolchainInfo-action_configs"></a>action_configs | This field is an internal implementation detail of the build rules. |
Expand Down
Loading