Skip to content

Commit

Permalink
Remove the implicit output from swift_library
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 521449117
(cherry picked from commit f88ca6d)
Signed-off-by: Brentley Jones <github@brentleyjones.com>
  • Loading branch information
thomasvl authored and brentleyjones committed Jun 21, 2024
1 parent fff416d commit 8a7f036
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 51 deletions.
25 changes: 11 additions & 14 deletions examples/xplatform/swift_import/BUILD
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -19,25 +21,20 @@ 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(
name = "dep",
srcs = ["dep.swift"],
module_name = "dep",
)

bzl_library(
name = "get_swiftmodule",
srcs = ["get_swiftmodule.bzl"],
visibility = ["//visibility:public"],
deps = ["//swift"],
)
17 changes: 0 additions & 17 deletions examples/xplatform/swift_import/get_swiftmodule.bzl

This file was deleted.

1 change: 0 additions & 1 deletion swift/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 0 additions & 17 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions swift/swift_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(),
)

0 comments on commit 8a7f036

Please sign in to comment.