Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ tasks:
- "bazel run //doc:gazelle"
- "git diff --exit-code || { echo '::error::Gazelle-generated BUILD files are out of date. Run: bazel run //doc:gazelle'; exit 1; }"

buildifier: 8.5.1
buildifier: 10.0.1
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/keith/pre-commit-buildifier
rev: 8.5.1.1
rev: 10.0.1
hooks:
- id: buildifier
- id: buildifier-lint
Expand Down
22 changes: 11 additions & 11 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,17 @@ system_sdk.configure_sdks(
"CoreAudio_Private", # TODO: Remove once CI >= Xcode 26.4
"MobileGestaltPrivate",
],
"iPhoneSimulator": [
"AssetsLibrary", # TODO: Remove once CI >= Xcode 26.4
"CoreAudio_Private",
"MacOSX": [
"MobileGestaltPrivate",
],
"iPhoneOS": [
"AssetsLibrary", # TODO: Remove once CI >= Xcode 26.4
"WatchOS": [
"BrowserEngineKit",
"CoreAudio_Private", # TODO: Remove once CI >= Xcode 26.4
"MobileGestaltPrivate",
],
"MacOSX": [
"WatchSimulator": [
"BrowserEngineKit",
"CoreAudio_Private", # TODO: Remove once CI >= Xcode 26.4
"MobileGestaltPrivate",
],
"XROS": [
Expand All @@ -219,14 +219,14 @@ system_sdk.configure_sdks(
"CoreAudio_Private", # TODO: Remove once CI >= Xcode 26.4
"MobileGestaltPrivate",
],
"WatchOS": [
"BrowserEngineKit",
"iPhoneOS": [
"AssetsLibrary", # TODO: Remove once CI >= Xcode 26.4
"CoreAudio_Private", # TODO: Remove once CI >= Xcode 26.4
"MobileGestaltPrivate",
],
"WatchSimulator": [
"BrowserEngineKit",
"CoreAudio_Private", # TODO: Remove once CI >= Xcode 26.4
"iPhoneSimulator": [
"AssetsLibrary", # TODO: Remove once CI >= Xcode 26.4
"CoreAudio_Private",
"MobileGestaltPrivate",
],
},
Expand Down
3 changes: 1 addition & 2 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ 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>, <a href="#derive_swift_module_name-feature_configuration">feature_configuration</a>)
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 All @@ -125,7 +125,6 @@ This mapping is intended to be fairly predictable, but not reversible.

| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="derive_swift_module_name-feature_configuration"></a>feature_configuration | The Swift feature configuration being used when compiling the target. This currently does nothing; it will be used by upcoming changes to manage the migration of module names to raw identifiers that use the Bazel target label. | `None` |
| <a id="derive_swift_module_name-args"></a>args | Either a single argument of type `Label`, or two arguments of type `str` where the first argument is the package name and the second argument is the target name. | none |

**RETURNS**
Expand Down
26 changes: 13 additions & 13 deletions doc/providers.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/cross_compilation/wasm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ genrule(
"web_app/index.html",
"web_app/Reactor.wasm",
],
cmd = "cp $(location web/index.html) $(RULEDIR)/web_app/index.html && " +
"cp $(location :Reactor.wasm) $(RULEDIR)/web_app/Reactor.wasm",
cmd = "cp $(execpath web/index.html) $(RULEDIR)/web_app/index.html && " +
"cp $(execpath :Reactor.wasm) $(RULEDIR)/web_app/Reactor.wasm",
)
10 changes: 5 additions & 5 deletions examples/xplatform/xctest/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ swift_test(
"SimpleTests.swift",
],
env = {
"XCTEST_ENV_VAR": "TRUE",
"XCTEST_BINDIR_ENV_VAR": "$(BINDIR)",
"XCTEST_ENV_VAR": "TRUE",
},
)

Expand All @@ -19,8 +19,8 @@ swift_test(
"SimpleTests.swift",
],
env = {
"XCTEST_ENV_VAR": "TRUE",
"XCTEST_BINDIR_ENV_VAR": "$(BINDIR)",
"XCTEST_ENV_VAR": "TRUE",
},
features = ["tsan"],
# TODO: Re-enable on Linux once Swift race is figured out (or maybe Swift is upgraded)
Expand All @@ -33,8 +33,8 @@ swift_test(
"SimpleTests.swift",
],
env = {
"XCTEST_ENV_VAR": "TRUE",
"XCTEST_BINDIR_ENV_VAR": "$(BINDIR)",
"XCTEST_ENV_VAR": "TRUE",
},
features = ["asan"],
# TODO: Re-enable on Linux once Swift memory leak is figured out (or maybe Swift is upgraded)
Expand All @@ -47,8 +47,8 @@ swift_test(
"SimpleTests.swift",
],
env = {
"XCTEST_ENV_VAR": "TRUE",
"XCTEST_BINDIR_ENV_VAR": "$(BINDIR)",
"XCTEST_ENV_VAR": "TRUE",
},
features = ["ubsan"],
# TODO: Re-enable on Linux if Swift ever supports ubsan on linux
Expand All @@ -61,8 +61,8 @@ swift_test(
"SimpleTests.swift",
],
env = {
"XCTEST_ENV_VAR": "TRUE",
"XCTEST_BINDIR_ENV_VAR": "$(BINDIR)",
"XCTEST_ENV_VAR": "TRUE",
},
features = [
"tsan",
Expand Down
18 changes: 9 additions & 9 deletions mixed_language/internal/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ The non-Swift portion of the mixed language module.
aspects = [swift_clang_module_aspect],
doc = "Dependencies of the target being built.",
),
"module_map": attr.label(
allow_single_file = True,
doc = "The module map for the module.",
mandatory = True,
),
"module_name": attr.string(
doc = "The name of the module.",
mandatory = True,
),
"swift_target": attr.label(
doc = """
The Swift portion of the mixed language module.
Expand All @@ -262,15 +271,6 @@ The Swift portion of the mixed language module.
doc = "The umbrella header for the module.",
mandatory = True,
),
"module_name": attr.string(
doc = "The name of the module.",
mandatory = True,
),
"module_map": attr.label(
allow_single_file = True,
doc = "The module map for the module.",
mandatory = True,
),
"_module_map_extender": attr.label(
cfg = "exec",
executable = True,
Expand Down
14 changes: 7 additions & 7 deletions proto/swift_proto_compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ def _swift_proto_compile(label, actions, swift_proto_compiler_info, additional_c
template = swift_proto_compiler_info.internal.copy_swift_sources_template,
output = copy_swift_sources_file,
substitutions = {
"{temporary_output_directory_path}": temporary_output_directory.path,
"{permanent_output_directory_path}": permanent_output_directory_path,
"{swift_source_file_paths}": " ".join([src.path for src in swift_srcs]),
"{temporary_output_directory_path}": temporary_output_directory.path,
},
is_executable = True,
)
Expand Down Expand Up @@ -302,12 +302,6 @@ Typically, these are Well Known Types and proto runtime libraries.
""",
providers = [SwiftInfo],
),
"protoc": attr.label(
allow_single_file = True,
cfg = "exec",
executable = True,
mandatory = False,
),
"plugin": attr.label(
doc = """\
A proto compiler plugin executable binary.
Expand Down Expand Up @@ -377,6 +371,12 @@ protoc \
""",
mandatory = True,
),
"protoc": attr.label(
allow_single_file = True,
cfg = "exec",
executable = True,
mandatory = False,
),
"suffixes": attr.string_list(
doc = """\
Suffix used for Swift files generated by the plugin from protos.
Expand Down
30 changes: 15 additions & 15 deletions proto/swift_proto_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,6 @@ swift_proto_library = rule(
requires_srcs = False,
),
{
"protos": attr.label_list(
doc = """\
A list of `proto_library` targets (or targets producing `ProtoInfo`),
from which the Swift source files should be generated.
""",
providers = [ProtoInfo],
),
"compilers": attr.label_list(
default = ["//proto/compilers:swift_proto"],
doc = """\
One or more `swift_proto_compiler` targets (or targets producing `SwiftProtoCompilerInfo`),
from which the Swift protos will be generated.
""",
providers = [SwiftProtoCompilerInfo],
),
"additional_compiler_deps": swift_deps_attr(
aspects = [
swift_clang_module_aspect,
Expand All @@ -142,6 +127,21 @@ See the documentation of the respective compiler rules for more information
on which fields are accepted and how they are used.
""",
),
"compilers": attr.label_list(
default = ["//proto/compilers:swift_proto"],
doc = """\
One or more `swift_proto_compiler` targets (or targets producing `SwiftProtoCompilerInfo`),
from which the Swift protos will be generated.
""",
providers = [SwiftProtoCompilerInfo],
),
"protos": attr.label_list(
doc = """\
A list of `proto_library` targets (or targets producing `ProtoInfo`),
from which the Swift source files should be generated.
""",
providers = [ProtoInfo],
),
},
),
doc = """\
Expand Down
28 changes: 14 additions & 14 deletions swift/internal/attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -284,20 +284,6 @@ def swift_library_rule_attrs(
),
swift_config_attrs(),
{
"library_evolution": attr.bool(
default = False,
doc = """\
Indicates whether the Swift code should be compiled with library evolution mode
enabled.

This attribute should be used to compile a module that will be distributed as
part of a client-facing (non-implementation-only) module in a library or
framework that will be distributed for use outside of the Bazel build graph.
Setting this to true will compile the module with the `-library-evolution` flag
and emit a `.swiftinterface` file as one of the compilation outputs.
""",
mandatory = False,
),
"alwayslink": attr.bool(
default = True,
doc = """\
Expand Down Expand Up @@ -353,6 +339,20 @@ effectively empty (except for a large amount of prologue and epilogue code) and
this is generally wasteful because the extra file needs to be propagated in the
build graph and, when explicit modules are enabled, extra actions must be
executed to compile the Objective-C module for the generated header.
""",
mandatory = False,
),
"library_evolution": attr.bool(
default = False,
doc = """\
Indicates whether the Swift code should be compiled with library evolution mode
enabled.

This attribute should be used to compile a module that will be distributed as
part of a client-facing (non-implementation-only) module in a library or
framework that will be distributed for use outside of the Bazel build graph.
Setting this to true will compile the module with the `-library-evolution` flag
and emit a `.swiftinterface` file as one of the compilation outputs.
""",
mandatory = False,
),
Expand Down
6 changes: 3 additions & 3 deletions swift/internal/extensions/standalone_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ def _standalone_toolchain_impl(repository_ctx):
standalone_toolchain = repository_rule(
implementation = _standalone_toolchain_impl,
attrs = {
"_build_template": attr.label(
default = "//swift/internal/extensions:toolchain.BUILD",
),
"platform": attr.string(
doc = "The host platform name in the swift package download URL",
mandatory = True,
Expand All @@ -121,5 +118,8 @@ standalone_toolchain = repository_rule(
doc = "Version of the swift toolchain to be installed.",
mandatory = True,
),
"_build_template": attr.label(
default = "//swift/internal/extensions:toolchain.BUILD",
),
},
)
6 changes: 3 additions & 3 deletions swift/internal/extensions/swift_sdks.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ def _swift_android_sdk_impl(repository_ctx):

swift_android_sdk_repository = repository_rule(
attrs = _common_attrs() | {
"_build_template": attr.label(
default = "//swift/internal/extensions:androidsdk.BUILD",
),
"paired_swiftc": attr.label(
doc = """\
The `swiftc` of the standalone toolchain this SDK is paired with, used to locate
the clang builtin headers that match the clang embedded in the Swift compiler.
""",
mandatory = True,
),
"_build_template": attr.label(
default = "//swift/internal/extensions:androidsdk.BUILD",
),
},
doc = """\
Downloads the Android Swift SDK artifact bundle and defines Swift toolchains that
Expand Down
2 changes: 1 addition & 1 deletion swift/internal/features.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ def _compute_features(
# Starlark doesn't support re-binding variables captured from an enclosing lexical scope
# so we resort to mutation to achieve the same result.
state = {
"requested_features": sets.make([]),
"disabled_features": sets.make([]),
"requested_features": sets.make([]),
}

def _update_features(newly_requested_features, newly_disabled_features):
Expand Down
24 changes: 12 additions & 12 deletions swift/internal/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,22 @@ Propagated by the `swift_overlay` rule to represent information needed to
compile a Swift overlay with its paired C/Objective-C module.
""",
fields = {
"label": "The label of the `swift_overlay` target.",
"srcs": "The source files to compile in the overlay.",
"additional_inputs": "Additional inputs to the compiler.",
"alwayslink": """\
Bool. Whether the overlay should always be included in the final binary's
linkage.
""",
"copts": """\
List of strings. Swift compiler flags to pass when compiling the overlay.
""",
"defines": """\
List of strings. Compiler conditions to set when compiling the overlay.
""",
"deps": """\
A `struct` containing the following fields:

* `cc_infos`: A list of `CcInfo` providers from the overlay's `deps`.
* `swift_infos`: A list of `SwiftInfo` providers from the overlay's `deps`.
""",
"disabled_features": """\
List of strings. Features that should be disabled when compiling the overlay.
Expand All @@ -95,6 +103,7 @@ List of strings. Features that should be enabled when compiling the overlay.
Bool. Whether to add the developer framework search paths when compiling the
overlay.
""",
"label": "The label of the `swift_overlay` target.",
"library_evolution": """\
Bool. Whether to compile the overlay with library evolution enabled.
""",
Expand All @@ -112,15 +121,6 @@ A `struct` containing the following fields:
* `swift_infos`: A list of `SwiftInfo` providers from the overlay's
`private_deps`.
""",
"alwayslink": """\
Bool. Whether the overlay should always be included in the final binary's
linkage.
""",
"deps": """\
A `struct` containing the following fields:

* `cc_infos`: A list of `CcInfo` providers from the overlay's `deps`.
* `swift_infos`: A list of `SwiftInfo` providers from the overlay's `deps`.
""",
"srcs": "The source files to compile in the overlay.",
},
)
Loading
Loading