diff --git a/examples/xplatform/swift_import/BUILD b/examples/xplatform/swift_import/BUILD index f391d253e..929091c7e 100644 --- a/examples/xplatform/swift_import/BUILD +++ b/examples/xplatform/swift_import/BUILD @@ -1,8 +1,10 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("//swift:swift_binary.bzl", "swift_binary") load("//swift:swift_import.bzl", "swift_import") load("//swift:swift_library.bzl", "swift_library") -load(":get_swiftmodule.bzl", "get_swiftmodule") +load( + "//test/rules:swift_library_artifact_collector.bzl", + "swift_library_artifact_collector", +) swift_binary( name = "hello_world", @@ -19,14 +21,16 @@ swift_library( swift_import( name = "import", - archives = ["libdep.a"], + archives = ["dep_outputs/libdep.a"], module_name = "dep", - swiftmodule = ":foo", + swiftmodule = "dep_outputs/dep.swiftmodule", ) -get_swiftmodule( - name = "foo", - lib = "dep", +swift_library_artifact_collector( + name = "dep_artifact_collector", + static_library = "dep_outputs/libdep.a", + swiftmodule = "dep_outputs/dep.swiftmodule", + target = ":dep", ) swift_library( @@ -34,10 +38,3 @@ swift_library( srcs = ["dep.swift"], module_name = "dep", ) - -bzl_library( - name = "get_swiftmodule", - srcs = ["get_swiftmodule.bzl"], - visibility = ["//visibility:public"], - deps = ["//swift"], -) diff --git a/examples/xplatform/swift_import/get_swiftmodule.bzl b/examples/xplatform/swift_import/get_swiftmodule.bzl deleted file mode 100644 index bbfd733c4..000000000 --- a/examples/xplatform/swift_import/get_swiftmodule.bzl +++ /dev/null @@ -1,17 +0,0 @@ -"""Return the .swiftmodule file from a swift_library for testing""" - -load("//swift:providers.bzl", "SwiftInfo") - -def _impl(ctx): - modules = ctx.attr.lib[SwiftInfo].direct_modules - if len(modules) != 1: - fail("unexpected number of modules: {}".format(len(modules))) - - return [DefaultInfo(files = depset([modules[0].swift.swiftmodule]))] - -get_swiftmodule = rule( - attrs = { - "lib": attr.label(providers = [SwiftInfo]), - }, - implementation = _impl, -) diff --git a/swift/BUILD b/swift/BUILD index 78f3bde09..b6f1771ef 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -186,7 +186,6 @@ bzl_library( ":swift_common", "//swift/internal:attrs", "//swift/internal:build_settings", - "//swift/internal:compiling", "//swift/internal:feature_names", "//swift/internal:linking", "//swift/internal:output_groups", diff --git a/swift/internal/compiling.bzl b/swift/internal/compiling.bzl index 85fcb2a21..c625dbfd6 100644 --- a/swift/internal/compiling.bzl +++ b/swift/internal/compiling.bzl @@ -1626,23 +1626,6 @@ def _declare_validated_generated_header( basename = generated_header_name, ) -def swift_library_output_map(name): - """Returns the dictionary of implicit outputs for a `swift_library`. - - This function is used to specify the `outputs` of the `swift_library` rule; - as such, its arguments must be named exactly the same as the attributes to - which they refer. - - Args: - name: The name of the target being built. - - Returns: - The implicit outputs dictionary for a `swift_library`. - """ - return { - "archive": "lib{}.a".format(name), - } - def _is_index_store_path_overridden(copts): """Checks if index_while_building must be disabled. diff --git a/swift/swift_library.bzl b/swift/swift_library.bzl index 40a28ae63..a947a41a9 100644 --- a/swift/swift_library.bzl +++ b/swift/swift_library.bzl @@ -23,7 +23,6 @@ load( "PerModuleSwiftCoptSettingInfo", "additional_per_module_swiftcopts", ) -load("//swift/internal:compiling.bzl", "swift_library_output_map") load( "//swift/internal:feature_names.bzl", "SWIFT_FEATURE_EMIT_PRIVATE_SWIFTINTERFACE", @@ -322,6 +321,5 @@ Compiles and links Swift code into a static library and Swift module. """, fragments = ["cpp"], implementation = _swift_library_impl, - outputs = swift_library_output_map, toolchains = use_swift_toolchain(), )