Skip to content

Commit

Permalink
Remove unnecessary references to build_bazel_rules_swift (#1399)
Browse files Browse the repository at this point in the history
Signed-off-by: Brentley Jones <github@brentleyjones.com>
  • Loading branch information
brentleyjones authored Oct 14, 2024
1 parent 0825aec commit 7fafc9b
Show file tree
Hide file tree
Showing 43 changed files with 233 additions and 284 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
workspace(name = "build_bazel_rules_swift")

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ custom_swift_proto_compiler = rule(
doc = """\
A proto compiler executable binary.
""",
default = "//examples/xplatform/custom_swift_proto_compiler/rules:custom_proto_compiler",
default = Label(
"//examples/xplatform/custom_swift_proto_compiler/rules:custom_proto_compiler",
),
executable = True,
cfg = "exec",
),
Expand Down
2 changes: 1 addition & 1 deletion mixed_language/internal/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ The Swift portion of the mixed language module.
"_module_map_extender": attr.label(
cfg = "exec",
executable = True,
default = "//tools/mixed_language_module_map_extender",
default = Label("//tools/mixed_language_module_map_extender"),
),
},
),
Expand Down
2 changes: 1 addition & 1 deletion proto/swift_proto_compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Each compiler target should configure this based on the suffix applied to the ge
mandatory = True,
),
"_copy_swift_sources_template": attr.label(
default = "//proto:copy_swift_sources.sh.tpl",
default = Label("//proto:copy_swift_sources.sh.tpl"),
allow_single_file = True,
),
},
Expand Down
8 changes: 5 additions & 3 deletions proto/swift_proto_library_group.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ _swift_proto_library_group_aspect = aspect(
swift_common.toolchain_attrs(),
{
"_compiler": attr.label(
default = "//proto:_swift_proto_compiler",
default = Label("//proto:_swift_proto_compiler"),
doc = """\
A `swift_proto_compiler` target (or target producing `SwiftProtoCompilerInfo`),
from which the Swift protos will be generated.
Expand Down Expand Up @@ -137,10 +137,12 @@ def _swift_proto_library_group_impl(ctx):
swift_proto_library_group = rule(
attrs = {
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
default = Label(
"@bazel_tools//tools/allowlists/function_transition_allowlist",
),
),
"compiler": attr.label(
default = "//proto/compilers:swift_proto",
default = Label("//proto/compilers:swift_proto"),
doc = """\
A `swift_proto_compiler` target (or target producing `SwiftProtoCompilerInfo`),
from which the Swift protos will be generated.
Expand Down
2 changes: 1 addition & 1 deletion swift/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ bool_flag(
config_setting(
name = "universal_tools_config",
flag_values = {
"@build_bazel_rules_swift//swift:universal_tools": "true",
"//swift:universal_tools": "true",
},
)

Expand Down
10 changes: 4 additions & 6 deletions swift/internal/attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ def swift_config_attrs():
"""
return {
"_config_emit_private_swiftinterface": attr.label(
default = "@build_bazel_rules_swift//swift:emit_private_swiftinterface",
default = Label("//swift:emit_private_swiftinterface"),
),
"_config_emit_swiftinterface": attr.label(
default = "@build_bazel_rules_swift//swift:emit_swiftinterface",
default = Label("//swift:emit_swiftinterface"),
),
"_per_module_swiftcopt": attr.label(
default = "@build_bazel_rules_swift//swift:per_module_swiftcopt",
default = Label("//swift:per_module_swiftcopt"),
),
}

Expand Down Expand Up @@ -435,8 +435,6 @@ that it is invoked in the correct mode (i.e., `swift`, `swiftc`,
"_default_swift_executable": attr.label(
allow_files = True,
cfg = "exec",
default = Label(
"@build_bazel_rules_swift//swift:default_swift_executable",
),
default = Label("//swift:default_swift_executable"),
),
}
30 changes: 15 additions & 15 deletions swift/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
"@build_bazel_rules_swift//swift/internal:swift_autoconfiguration.bzl",
"//swift/internal:swift_autoconfiguration.bzl",
"swift_autoconfiguration",
)

Expand Down Expand Up @@ -79,7 +79,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
],
sha256 = "69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf",
type = "zip",
build_file = "@build_bazel_rules_swift//third_party:com_github_nlohmann_json/BUILD.overlay",
build_file = "//third_party:com_github_nlohmann_json/BUILD.overlay",
)

_maybe(
Expand All @@ -96,7 +96,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-argument-parser/archive/refs/tags/1.3.0.tar.gz"],
sha256 = "e5010ff37b542807346927ba68b7f06365a53cf49d36a6df13cef50d86018204",
strip_prefix = "swift-argument-parser-1.3.0",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_argument_parser/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_argument_parser/BUILD.overlay",
)

_maybe(
Expand All @@ -105,7 +105,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-protobuf/archive/1.20.2.tar.gz"], # pinned to grpc-swift version
sha256 = "3fb50bd4d293337f202d917b6ada22f9548a0a0aed9d9a4d791e6fbd8a246ebb",
strip_prefix = "swift-protobuf-1.20.2/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_protobuf/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_protobuf/BUILD.overlay",
)

_maybe(
Expand All @@ -114,7 +114,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/grpc/grpc-swift/archive/1.16.0.tar.gz"], # latest at time of writing
sha256 = "58b60431d0064969f9679411264b82e40a217ae6bd34e17096d92cc4e47556a5",
strip_prefix = "grpc-swift-1.16.0/",
build_file = "@build_bazel_rules_swift//third_party:com_github_grpc_grpc_swift/BUILD.overlay",
build_file = "//third_party:com_github_grpc_grpc_swift/BUILD.overlay",
)

_maybe(
Expand All @@ -123,7 +123,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-docc-symbolkit/archive/refs/tags/swift-5.10-RELEASE.tar.gz"],
sha256 = "de1d4b6940468ddb53b89df7aa1a81323b9712775b0e33e8254fa0f6f7469a97",
strip_prefix = "swift-docc-symbolkit-swift-5.10-RELEASE",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_docc_symbolkit/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_docc_symbolkit/BUILD.overlay",
)

_maybe(
Expand All @@ -132,7 +132,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-nio/archive/2.42.0.tar.gz"], # pinned to grpc swift version
sha256 = "e3304bc3fb53aea74a3e54bd005ede11f6dc357117d9b1db642d03aea87194a0",
strip_prefix = "swift-nio-2.42.0/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_nio/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_nio/BUILD.overlay",
)

_maybe(
Expand All @@ -141,7 +141,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-nio-http2/archive/1.26.0.tar.gz"], # pinned to grpc-swift version
sha256 = "f0edfc9d6a7be1d587e5b403f2d04264bdfae59aac1d74f7d974a9022c6d2b25",
strip_prefix = "swift-nio-http2-1.26.0/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_nio_http2/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_nio_http2/BUILD.overlay",
)

_maybe(
Expand All @@ -150,7 +150,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-nio-transport-services/archive/1.15.0.tar.gz"], # pinned to grpc-swift version
sha256 = "f3498dafa633751a52b9b7f741f7ac30c42bcbeb3b9edca6d447e0da8e693262",
strip_prefix = "swift-nio-transport-services-1.15.0/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_nio_transport_services/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_nio_transport_services/BUILD.overlay",
)

_maybe(
Expand All @@ -159,7 +159,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-nio-extras/archive/1.4.0.tar.gz"], # pinned to grpc-swift version
sha256 = "4684b52951d9d9937bb3e8ccd6b5daedd777021ef2519ea2f18c4c922843b52b",
strip_prefix = "swift-nio-extras-1.4.0/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_nio_extras/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_nio_extras/BUILD.overlay",
)

_maybe(
Expand All @@ -168,7 +168,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-log/archive/1.4.4.tar.gz"], # pinned to grpc-swift version
sha256 = "48fe66426c784c0c20031f15dc17faf9f4c9037c192bfac2f643f65cb2321ba0",
strip_prefix = "swift-log-1.4.4/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_log/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_log/BUILD.overlay",
)

_maybe(
Expand All @@ -177,7 +177,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-nio-ssl/archive/2.23.0.tar.gz"], # pinned to grpc swift version
sha256 = "4787c63f61dd04d99e498adc3d1a628193387e41efddf8de19b8db04544d016d",
strip_prefix = "swift-nio-ssl-2.23.0/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_nio_ssl/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_nio_ssl/BUILD.overlay",
)

_maybe(
Expand All @@ -186,7 +186,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-collections/archive/1.0.4.tar.gz"], # pinned to swift-nio @ grpc-swift version
sha256 = "d9e4c8a91c60fb9c92a04caccbb10ded42f4cb47b26a212bc6b39cc390a4b096",
strip_prefix = "swift-collections-1.0.4/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_collections/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_collections/BUILD.overlay",
)

_maybe(
Expand All @@ -195,7 +195,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
urls = ["https://github.com/apple/swift-atomics/archive/1.1.0.tar.gz"], # pinned to swift-nio @ grpc-swift version
sha256 = "1bee7f469f7e8dc49f11cfa4da07182fbc79eab000ec2c17bfdce468c5d276fb",
strip_prefix = "swift-atomics-1.1.0/",
build_file = "@build_bazel_rules_swift//third_party:com_github_apple_swift_atomics/BUILD.overlay",
build_file = "//third_party:com_github_apple_swift_atomics/BUILD.overlay",
)

# It relies on `index-import` to import indexes into Bazel's remote
Expand All @@ -204,7 +204,7 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
_maybe(
http_archive,
name = "build_bazel_rules_swift_index_import",
build_file = "@build_bazel_rules_swift//third_party:build_bazel_rules_swift_index_import/BUILD.overlay",
build_file = "//third_party:build_bazel_rules_swift_index_import/BUILD.overlay",
canonical_id = "index-import-5.8",
urls = ["https://github.com/MobileNativeFoundation/index-import/releases/download/5.8.0.1/index-import.tar.gz"],
sha256 = "28c1ffa39d99e74ed70623899b207b41f79214c498c603915aef55972a851a15",
Expand Down
8 changes: 5 additions & 3 deletions swift/swift_compiler_plugin.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ load(
"@build_bazel_apple_support//lib:transitions.bzl",
"macos_universal_transition",
)
load("//swift/internal:compiling.bzl", "compile")
load(
"@build_bazel_rules_swift//swift/internal:feature_names.bzl",
"//swift/internal:feature_names.bzl",
"SWIFT_FEATURE_ADD_TARGET_NAME_TO_OUTPUT",
)
load("//swift/internal:compiling.bzl", "compile")
load("//swift/internal:features.bzl", "is_feature_enabled")
load(
"//swift/internal:linking.bzl",
Expand Down Expand Up @@ -336,7 +336,9 @@ universal_swift_compiler_plugin = rule(
providers = [SwiftCompilerPluginInfo],
),
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
default = Label(
"@bazel_tools//tools/allowlists/function_transition_allowlist",
),
),
# TODO(b/301253335): Enable AEGs and switch from `swift` exec_group to swift `toolchain` param.
"_use_auto_exec_groups": attr.bool(default = False),
Expand Down
5 changes: 1 addition & 4 deletions swift/swift_interop_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ minimize build graph invalidations among those packages when other, unrelated
parts of the Swift rules change.
"""

load(
"@build_bazel_rules_swift//swift/internal:swift_interop_info.bzl",
"SwiftInteropInfo",
)
load("//swift/internal:swift_interop_info.bzl", "SwiftInteropInfo")

def create_swift_interop_info(
*,
Expand Down
5 changes: 1 addition & 4 deletions swift/swift_module_mapping.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

"""Implementation of the `swift_module_mapping` rule."""

load(
"@build_bazel_rules_swift//swift/internal:providers.bzl",
"SwiftModuleAliasesInfo",
)
load("//swift/internal:providers.bzl", "SwiftModuleAliasesInfo")

def _swift_module_mapping_impl(ctx):
# This rule generates no actions/outputs; it only serves to propagate a
Expand Down
7 changes: 2 additions & 5 deletions swift/swift_module_mapping_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@

"""Implementation of the `swift_module_mapping_test` rule."""

load("@build_bazel_rules_swift//swift:providers.bzl", "SwiftInfo")
load(
"@build_bazel_rules_swift//swift/internal:providers.bzl",
"SwiftModuleAliasesInfo",
)
load("//swift/internal:providers.bzl", "SwiftModuleAliasesInfo")
load(":providers.bzl", "SwiftInfo")

_SwiftModulesToValidateMappingInfo = provider(
doc = "Propagates module names to have their mapping validated.",
Expand Down
12 changes: 4 additions & 8 deletions swift/swift_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -653,26 +653,22 @@ standard executable binary that is invoked directly.
),
"_swizzle_absolute_xcttestsourcelocation": attr.label(
default = Label(
"@build_bazel_rules_swift//swift/internal:swizzle_absolute_xcttestsourcelocation",
"//swift/internal:swizzle_absolute_xcttestsourcelocation",
),
),
"_test_discoverer": attr.label(
cfg = "exec",
default = Label(
"@build_bazel_rules_swift//tools/test_discoverer",
),
default = Label("//tools/test_discoverer"),
executable = True,
),
"_test_runner_deps": attr.label_list(
default = [
"@build_bazel_rules_swift//tools/test_observer",
Label("//tools/test_observer"),
],
),
"_xctest_runner_template": attr.label(
allow_single_file = True,
default = Label(
"@build_bazel_rules_swift//tools/xctest_runner:xctest_runner_template",
),
default = Label("//tools/xctest_runner:xctest_runner_template"),
),
# TODO(b/301253335): Enable AEGs and switch from `swift` exec_group to swift `toolchain` param.
"_use_auto_exec_groups": attr.bool(default = False),
Expand Down
12 changes: 6 additions & 6 deletions swift/toolchains/swift_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -624,23 +624,21 @@ The C++ toolchain from which other tools needed by the Swift toolchain (such as
""",
),
"_copts": attr.label(
default = Label("@build_bazel_rules_swift//swift:copt"),
default = Label("//swift:copt"),
doc = """\
The label of the `string_list` containing additional flags that should be passed
to the compiler.
""",
),
"_exec_copts": attr.label(
default = Label("@build_bazel_rules_swift//swift:exec_copt"),
default = Label("//swift:exec_copt"),
doc = """\
The label of the `string_list` containing additional flags that should be passed
to the compiler for exec transition builds.
""",
),
"_module_mapping": attr.label(
default = Label(
"@build_bazel_rules_swift//swift:module_mapping",
),
default = Label("//swift:module_mapping"),
providers = [[SwiftModuleAliasesInfo]],
),
"_worker": attr.label(
Expand All @@ -654,7 +652,9 @@ for incremental compilation using a persistent mode.
executable = True,
),
"const_protocols_to_gather": attr.label(
default = Label("@build_bazel_rules_swift//swift/toolchains/config:const_protocols_to_gather.json"),
default = Label(
"//swift/toolchains/config:const_protocols_to_gather.json",
),
allow_single_file = True,
doc = """\
The label of the file specifying a list of protocols for extraction of conformances'
Expand Down
Loading

0 comments on commit 7fafc9b

Please sign in to comment.