diff --git a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/MODULE.bazel b/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/MODULE.bazel deleted file mode 100644 index df425921773f..000000000000 --- a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/MODULE.bazel +++ /dev/null @@ -1,79 +0,0 @@ -"""rules_swift MODULE.bazel file""" - -module( - name = "rules_swift", - version = "4.0.0-rc5-codeql.3", - bazel_compatibility = [">=8.0.0"], - compatibility_level = 3, -) - -bazel_dep(name = "abseil-cpp", version = "20250814.1") -bazel_dep(name = "apple_support", version = "2.8.0") -bazel_dep(name = "bazel_linux_packages", version = "0.4.1") -bazel_dep(name = "bazel_features", version = "1.51.0") -bazel_dep(name = "bazel_skylib", version = "1.7.1") -bazel_dep(name = "nlohmann_json", version = "3.12.0.bcr.1") -bazel_dep(name = "platforms", version = "0.0.11") -bazel_dep(name = "protobuf", version = "34.0.bcr.1") -bazel_dep(name = "rules_cc", version = "0.2.14") -bazel_dep(name = "rules_shell", version = "0.3.0") -bazel_dep(name = "swift_argument_parser", version = "1.7.0") - -apt = use_extension("@bazel_linux_packages//apt:extensions.bzl", "apt") -apt.ubuntu( - name = "swift_ubuntu22.04_sysroot", - architectures = ["amd64"], - lockfile = "//swift/internal/extensions:ubuntu22.04_sysroot.lock.json", - packages = [ - "libc6-dev", - "libcurl4-openssl-dev", - "libstdc++-11-dev", - "libxml2-dev", - "linux-libc-dev", - "zlib1g-dev", - ], - suites = ["jammy"], -) -apt.ubuntu( - name = "swift_ubuntu22.04_aarch64_sysroot", - architectures = ["arm64"], - lockfile = "//swift/internal/extensions:ubuntu22.04_aarch64_sysroot.lock.json", - packages = [ - "libc6-dev", - "libcurl4-openssl-dev", - "libstdc++-11-dev", - "libxml2-dev", - "linux-libc-dev", - "zlib1g-dev", - ], - suites = ["jammy"], -) -use_repo( - apt, - "swift_ubuntu22.04_aarch64_sysroot", - "swift_ubuntu22.04_sysroot", -) - -swift_autoconfiguration = use_repo_rule("//swift/internal:swift_autoconfiguration.bzl", "swift_autoconfiguration") - -swift_autoconfiguration(name = "rules_swift_local_config") - -http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "rules_swift_index_import_5_8", - build_file = "//third_party:rules_swift_index_import/BUILD.overlay", - canonical_id = "index-import-5.8", - sha256 = "28c1ffa39d99e74ed70623899b207b41f79214c498c603915aef55972a851a15", - urls = ["https://github.com/MobileNativeFoundation/index-import/releases/download/5.8.0.1/index-import.tar.gz"], -) - -http_archive( - name = "rules_swift_index_import_6_1", - build_file = "//third_party:rules_swift_index_import/BUILD.overlay", - canonical_id = "index-import-6.1", - sha256 = "9a54fc1674af6031125a9884480a1e31e1bcf48b8f558b3e8bcc6b6fcd6e8b61", - urls = ["https://github.com/MobileNativeFoundation/index-import/releases/download/6.1.0.1/index-import.tar.gz"], -) - -register_toolchains("//swift/toolchains:all") diff --git a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/patches/external_static_runtime.patch b/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/patches/external_static_runtime.patch deleted file mode 100644 index 6614436073bb..000000000000 --- a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/patches/external_static_runtime.patch +++ /dev/null @@ -1,242 +0,0 @@ -diff --git a/swift/extensions.bzl b/swift/extensions.bzl -index b77f636..1255ba7 100644 ---- a/swift/extensions.bzl -+++ b/swift/extensions.bzl -@@ -191,6 +191,7 @@ def _standalone_toolchain_impl(module_ctx): - name = repository_name, - sha256 = sha256, - platform = platform, -+ static_runtime = toolchain.static_runtime if platform != "xcode" else None, - swift_version = swift_version, - ) - toolchains_build_file_content += toolchains_for_platform( -@@ -266,6 +267,9 @@ their hashes. For instance: - `bazel run @rules_swift//tools/swift-releases -- list 6.2.4` - """, - ), -+ "static_runtime": attr.label( -+ doc = "External static runtime package to attach to the generated execution toolchains.", -+ ), - "swift_version": attr.string(doc = "Version of the swift toolchain to be installed. Cannot be used concurrently with `swift_version_file`"), - "swift_version_file": attr.label(doc = "A label to the .swift_version file to use. Cannot be used concurrently with `swift_version`"), - }) -diff --git a/swift/internal/extensions/standalone_toolchain.bzl b/swift/internal/extensions/standalone_toolchain.bzl -index 801aad7..119ded9 100644 ---- a/swift/internal/extensions/standalone_toolchain.bzl -+++ b/swift/internal/extensions/standalone_toolchain.bzl -@@ -100,6 +100,9 @@ def _standalone_toolchain_impl(repository_ctx): - "BUILD.bazel", - repository_ctx.attr._build_template, - substitutions = { -+ "{external_static_runtime}": ( -+ ' external_static_runtime = "{}",'.format(repository_ctx.attr.static_runtime) if repository_ctx.attr.static_runtime else "" -+ ), - "{swift_version}": repository_ctx.attr.swift_version, - }, - ) -@@ -117,6 +120,9 @@ standalone_toolchain = repository_rule( - "sha256": attr.string( - doc = "The expected SHA-256 of the file downloaded. This must match the SHA-256 of the file downloaded.", - ), -+ "static_runtime": attr.label( -+ doc = "External static runtime package used by this execution toolchain.", -+ ), - "swift_version": attr.string( - doc = "Version of the swift toolchain to be installed.", - mandatory = True, -diff --git a/swift/internal/extensions/toolchain.BUILD b/swift/internal/extensions/toolchain.BUILD -index 1304dc2..ee77866 100644 ---- a/swift/internal/extensions/toolchain.BUILD -+++ b/swift/internal/extensions/toolchain.BUILD -@@ -364,6 +364,7 @@ swift_toolchain( - ), - "//conditions:default": [], - }), -+{external_static_runtime} - swift_tools = "tools", - version_file = ".swift-version", - ) -diff --git a/swift/toolchains/BUILD b/swift/toolchains/BUILD -index 1a8db31..fff0879 100644 ---- a/swift/toolchains/BUILD -+++ b/swift/toolchains/BUILD -@@ -155,6 +155,7 @@ bzl_library( - "//swift/internal:features", - "//swift/internal:providers", - "//swift/internal:target_triples", -+ "//swift/internal:toolchain_utils", - "//swift/internal:utils", - "//swift/internal:wmo", - "//swift/toolchains/config:action_config", -diff --git a/swift/toolchains/swift_toolchain.bzl b/swift/toolchains/swift_toolchain.bzl -index 9fc2a49..6f10573 100644 ---- a/swift/toolchains/swift_toolchain.bzl -+++ b/swift/toolchains/swift_toolchain.bzl -@@ -69,6 +69,11 @@ load( - "SwiftModuleAliasesInfo", - ) - load("//swift/internal:target_triples.bzl", "target_triples") -+load( -+ "//swift/internal:toolchain_utils.bzl", -+ "get_swift_toolchain", -+ "use_swift_toolchain", -+) - load( - "//swift/internal:utils.bzl", - "collect_cross_import_overlays", -@@ -101,6 +106,64 @@ load( - ) - load("//swift/toolchains/config:tool_config.bzl", "ToolConfigInfo") -- -+ -+SwiftStaticRuntimeInfo = provider( -+ fields = { -+ "copts": "Compiler options required to use the runtime.", -+ "files": "Runtime and SDK files required by compile and link actions.", -+ "linkopts": "Linker options required to link the runtime.", -+ "root": "Execution-root-relative path to the runtime SDK.", -+ }, -+) -+ -+def _swift_static_runtime_impl(ctx): -+ root = ctx.label.workspace_root -+ files = depset(ctx.files.files) -+ -+ def expand_root(options): -+ return [option.replace("{root}", root) for option in options] -+ -+ return [ -+ DefaultInfo(files = files), -+ SwiftStaticRuntimeInfo( -+ copts = expand_root(ctx.attr.copts), -+ files = files, -+ linkopts = expand_root(ctx.attr.linkopts), -+ root = root, -+ ), -+ ] -+ -+swift_static_runtime = rule( -+ implementation = _swift_static_runtime_impl, -+ attrs = { -+ "copts": attr.string_list(), -+ "files": attr.label_list(allow_files = True, mandatory = True), -+ "linkopts": attr.string_list(), -+ }, -+) -+ -+def _swift_runtime_impl(ctx): -+ runtime_cc_info = get_swift_toolchain(ctx).dynamic_runtime_cc_info -+ files = [] -+ if runtime_cc_info: -+ for linker_input in runtime_cc_info.linking_context.linker_inputs.to_list(): -+ for library in linker_input.libraries: -+ dynamic_library = getattr(library, "dynamic_library", None) -+ if dynamic_library: -+ files.append(dynamic_library) -+ runtime = depset(files) -+ providers = [DefaultInfo( -+ files = runtime, -+ runfiles = ctx.runfiles(transitive_files = runtime), -+ )] -+ if runtime_cc_info: -+ providers.append(runtime_cc_info) -+ return providers -+ -+swift_runtime = rule( -+ implementation = _swift_runtime_impl, -+ toolchains = use_swift_toolchain(), -+) -+ - def _swift_compile_resource_set(_os, inputs_size): - # The `os` argument is unused, but the Starlark API requires both - # positional arguments. -@@ -662,6 +725,7 @@ def _resolve_sdkroot(ctx, cc_toolchain): -- -+ - def _swift_toolchain_impl(ctx): - toolchain_root = ctx.attr.root -+ external_static_runtime = ctx.attr.external_static_runtime[SwiftStaticRuntimeInfo] if ctx.attr.external_static_runtime else None - cc_toolchain = find_cc_toolchain(ctx) - target_system_name = _parse_target_system_name( - arch = ctx.attr.arch, -@@ -684,7 +748,7 @@ def _swift_toolchain_impl(ctx): - "before invoking Bazel, or configure a Bazel LLVM CC toolchain. " + - "The current CC toolchain is configured to use '{}'.".format(cc_toolchain.compiler)) -- -+ -- sdkroot = _resolve_sdkroot(ctx, cc_toolchain) -+ sdkroot = external_static_runtime.root if external_static_runtime else _resolve_sdkroot(ctx, cc_toolchain) -- -+ - if ctx.attr.swift_tools: - if ctx.attr.swift_executable: -@@ -740,6 +804,18 @@ def _swift_toolchain_impl(ctx): - ctx.attr.linkopts, - ctx.files.linker_inputs, - ) -+ elif external_static_runtime: -+ swift_linkopts_cc_info = CcInfo( -+ linking_context = cc_common.create_linking_context( -+ linker_inputs = depset([ -+ cc_common.create_linker_input( -+ owner = ctx.label, -+ user_link_flags = depset(external_static_runtime.linkopts), -+ additional_inputs = external_static_runtime.files, -+ ), -+ ]), -+ ), -+ ) - else: - ( - swift_linkopts_cc_info, -@@ -763,6 +839,8 @@ def _swift_toolchain_impl(ctx): - swiftcopts.extend(ctx.attr._exec_copts[BuildSettingInfo].value) - else: - swiftcopts.extend(ctx.attr._copts[BuildSettingInfo].value) -+ if external_static_runtime: -+ swiftcopts.extend(external_static_runtime.copts) -- -+ - # Combine build mode features, autoconfigured features, and required - # features. -@@ -774,7 +852,7 @@ def _swift_toolchain_impl(ctx): - target_triple = target_triple, - )) -- -+ -- if apple_common.dotted_version(ctx.attr.parsed_version) >= apple_common.dotted_version("6.3"): -+ if not external_static_runtime and apple_common.dotted_version(ctx.attr.parsed_version) >= apple_common.dotted_version("6.3"): - requested_features.append(SWIFT_FEATURE__SUPPORTS_HERMETIC_SWIFTMODULE) -- -+ - requested_features.extend(ctx.features) -@@ -787,6 +865,8 @@ def _swift_toolchain_impl(ctx): - additional_tools = [ctx.file.version_file] - if ctx.attr.swift_tools: - additional_tools += ctx.attr.swift_tools[SwiftToolsInfo].additional_inputs -+ if external_static_runtime: -+ additional_tools += external_static_runtime.files.to_list() -- -+ - all_tool_configs = _all_tool_configs( - env = ctx.attr.env, -@@ -873,7 +953,7 @@ def _swift_toolchain_impl(ctx): - system_modules = collect_implicit_deps_providers([]), - implicit_system_modules = collect_implicit_deps_providers([]), - swift_worker = ctx.attr._worker[DefaultInfo].files_to_run, -- const_protocols_to_gather = ctx.file.const_protocols_to_gather, -+ const_protocols_to_gather = None if external_static_runtime else ctx.file.const_protocols_to_gather, - test_configuration = struct( - binary_name = "{name}", - env = env, -@@ -952,6 +1032,10 @@ context. - """, - allow_files = True, - ), -+ "external_static_runtime": attr.label( -+ doc = "External static Swift runtime and SDK to use instead of the compiler's runtimes.", -+ providers = [[SwiftStaticRuntimeInfo]], -+ ), - "static_runtime": attr.label_list( - doc = """\ - Static Swift runtime archives and supporting linker files that are passed to diff --git a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/patches/register_downloaded_macos_toolchain.patch b/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/patches/register_downloaded_macos_toolchain.patch deleted file mode 100644 index 730735b9e09e..000000000000 --- a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/patches/register_downloaded_macos_toolchain.patch +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/swift/internal/extensions/toolchains.bzl b/swift/internal/extensions/toolchains.bzl ---- a/swift/internal/extensions/toolchains.bzl -+++ b/swift/internal/extensions/toolchains.bzl -@@ -132,12 +132,11 @@ def toolchains_for_platform(platform, toolchain_repository): - toolchain_repository = toolchain_repository, - ) - -- if platform != "xcode": -- content += _EXEC_TOOLCHAIN_PLATFORM.format( -- exec_compatible_with = _exec_compatible_with_for_platform(platform), -- platform = platform, -- toolchain_repository = toolchain_repository, -- ) -+ content += _EXEC_TOOLCHAIN_PLATFORM.format( -+ exec_compatible_with = _exec_compatible_with_for_platform(platform), -+ platform = platform, -+ toolchain_repository = toolchain_repository, -+ ) - - if platform in ( - "ubuntu22.04", -diff --git a/swift/toolchains/swift_toolchain.bzl b/swift/toolchains/swift_toolchain.bzl ---- a/swift/toolchains/swift_toolchain.bzl -+++ b/swift/toolchains/swift_toolchain.bzl -@@ -605,10 +605,14 @@ def _parse_target_system_name(*, arch, os, target_system_name): - """Returns the target system name set by the CC toolchain or attempts to create one based on the OS and arch.""" - - if target_system_name and target_system_name != "local": -+ if os == "macos" and target_system_name.endswith(("-macos", "-macosx")): -+ return target_system_name + "10.15" - return target_system_name - - if os == "linux": - return "%s-unknown-linux-gnu" % arch -+ elif os == "macos": -+ return "%s-apple-macos10.15" % arch - elif os == "windows": - # The MSVC cc toolchain reports a `target_gnu_system_name` of "local", - # so synthesize the triple. -@@ -706,5 +710,16 @@ def _swift_toolchain_impl(ctx): - elif ctx.attr.os == "none": - swift_linkopts_cc_info = CcInfo() -+ elif ctx.attr.os == "macos": -+ macos_linkopts = ["-L{}".format(paths.join(toolchain_root, "lib/swift/macosx"))] -+ if sdkroot: -+ macos_linkopts.append("-L{}".format(paths.join(sdkroot, "usr/lib/swift"))) -+ swift_linkopts_cc_info = _swift_sdk_linkopts_cc_info( -+ ctx.label, -+ macos_linkopts, -+ ctx.attr.swift_tools[SwiftToolsInfo].additional_inputs if ctx.attr.swift_tools else [], -+ ) -+ dynamic_runtime_cc_info = None -+ static_runtime_cc_info = None - elif ctx.attr.os == "android": - if not sdkroot: - fail("Android toolchain requires a sysroot to be set, either via the `sdkroot` attribute or by using a CC toolchain that provides one.") -diff --git a/swift/internal/extensions/toolchain.BUILD b/swift/internal/extensions/toolchain.BUILD ---- a/swift/internal/extensions/toolchain.BUILD -+++ b/swift/internal/extensions/toolchain.BUILD -@@ -333,17 +333,22 @@ swift_toolchain( - features = [ - "swift._supports_upcoming_features", - "swift.no_embed_debug_module", -- "swift.use_autolink_extract", -- "swift.lld_gc_workaround", -- "swift.use_module_wrap", - # TODO: This should be removed so that private headers can be used with - # explicit modules, but the build targets for CgRPC need to be cleaned up - # first because they contain C++ code. - "swift.module_map_no_private_headers", -- ], -+ ] + select({ -+ "@platforms//os:linux": [ -+ "swift.lld_gc_workaround", -+ "swift.use_autolink_extract", -+ "swift.use_module_wrap", -+ ], -+ "//conditions:default": [], -+ }), - os = select({ - "@platforms//os:linux": "linux", - "@platforms//os:macos": "macos", - }), - parsed_version = "{swift_version}", -+ sdkroot = "{macos_sdkroot}", - static_runtime = select({ -diff --git a/swift/internal/extensions/standalone_toolchain.bzl b/swift/internal/extensions/standalone_toolchain.bzl -index 119ded9..b7065b7 100644 ---- a/swift/internal/extensions/standalone_toolchain.bzl -+++ b/swift/internal/extensions/standalone_toolchain.bzl -@@ -95,6 +95,11 @@ def _standalone_toolchain_impl(repository_ctx): - strip_prefix = filename.removesuffix(".tar.gz"), - ) - -+ macos_sdkroot = "" -+ if repository_ctx.attr.platform == "xcode": -+ macos_sdkroot = _run(repository_ctx, ["xcrun", "--sdk", "macosx", "--show-sdk-path"]) -+ repository_ctx.watch(macos_sdkroot) -+ - repository_ctx.file(".swift-version", repository_ctx.attr.swift_version) - repository_ctx.template( - "BUILD.bazel", -@@ -103,6 +108,7 @@ def _standalone_toolchain_impl(repository_ctx): - "{external_static_runtime}": ( - ' external_static_runtime = "{}",'.format(repository_ctx.attr.static_runtime) if repository_ctx.attr.static_runtime else "" - ), -+ "{macos_sdkroot}": macos_sdkroot, - "{swift_version}": repository_ctx.attr.swift_version, - }, - ) diff --git a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/source.json b/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/source.json deleted file mode 100644 index 71710b254ccf..000000000000 --- a/misc/bazel/registry/modules/rules_swift/4.0.0-rc5-codeql.3/source.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "integrity": "sha256-Ly2lS4AlZJMiyqAxKHyCB+2pGeP5aYkQ6zv8QheeSTI=", - "url": "https://github.com/bazelbuild/rules_swift/releases/download/4.0.0-rc5/rules_swift.4.0.0-rc5.tar.gz", - "patches": { - "external_static_runtime.patch": "sha256-bnyDyK3dU+vmNVKr16y0vMrtkUSYlVOkWtIBVtjqBGw=", - "register_downloaded_macos_toolchain.patch": "sha256-w6/S2LEFXEFE+eLUeowKl4mQ5bLvb2SxQknXfXEglyE=" - }, - "patch_strip": 1 -} diff --git a/misc/bazel/registry/modules/rules_swift/metadata.json b/misc/bazel/registry/modules/rules_swift/metadata.json index f99e15130d56..02d511011b58 100644 --- a/misc/bazel/registry/modules/rules_swift/metadata.json +++ b/misc/bazel/registry/modules/rules_swift/metadata.json @@ -5,8 +5,7 @@ "github:bazelbuild/rules_swift" ], "versions": [ - "4.2.2-codeql.1", - "4.0.0-rc5-codeql.3" + "4.2.2-codeql.1" ], "yanked_versions": {} }