Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Move swift_clang_module_aspect out of swift_common and directly expos…
Browse files Browse the repository at this point in the history
…e it.

RELNOTES: swift_clang_module_aspect is directly exported instead of being in swift_common.
PiperOrigin-RevId: 367673524
  • Loading branch information
thomasvl authored and swiple-rules-gardener committed Apr 9, 2021
1 parent 9be992e commit bf8243d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion swift/internal/swift_binary_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ load(":derived_files.bzl", "derived_files")
load(":feature_names.bzl", "SWIFT_FEATURE_BUNDLED_XCTESTS")
load(":linking.bzl", "register_link_binary_action")
load(":providers.bzl", "SwiftToolchainInfo")
load(":swift_clang_module_aspect.bzl", "swift_clang_module_aspect")
load(":swift_common.bzl", "swift_common")
load(":utils.bzl", "expand_locations")

Expand All @@ -35,7 +36,7 @@ def _binary_rule_attrs(stamp_default):
"""
return dicts.add(
swift_common.compilation_attrs(
additional_deps_aspects = [swift_common.swift_clang_module_aspect],
additional_deps_aspects = [swift_clang_module_aspect],
requires_srcs = False,
),
{
Expand Down
8 changes: 4 additions & 4 deletions swift/internal/swift_clang_module_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,10 @@ depends on an `objc_library` that depends on a `swift_library`).
It also manages module map generation for `cc_library` targets that have the
`swift_module` tag. This tag may take one of two forms:
* `swift_module`: By itself, this indicates that the target is compatible
with Swift and should be given a module name that is derived from its
target label.
* `swift_module=name`: The module should be given the name `name`.
* `swift_module`: By itself, this indicates that the target is compatible
with Swift and should be given a module name that is derived from its
target label.
* `swift_module=name`: The module should be given the name `name`.
Note that the public headers of such `cc_library` targets must be parsable as C,
since Swift does not support C++ interop at this time.
Expand Down
7 changes: 1 addition & 6 deletions swift/internal/swift_common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ load(
"create_swift_info",
"create_swift_module",
)
load(
":swift_clang_module_aspect.bzl",
"create_swift_interop_info",
"swift_clang_module_aspect",
)
load(":swift_clang_module_aspect.bzl", "create_swift_interop_info")

# The exported `swift_common` module, which defines the public API for directly
# invoking actions that compile Swift code from other rules.
Expand All @@ -71,7 +67,6 @@ swift_common = struct(
is_enabled = is_feature_enabled,
library_rule_attrs = swift_library_rule_attrs,
precompile_clang_module = precompile_clang_module,
swift_clang_module_aspect = swift_clang_module_aspect,
swift_runtime_linkopts = swift_runtime_linkopts,
toolchain_attrs = swift_toolchain_attrs,
)
5 changes: 3 additions & 2 deletions swift/internal/swift_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ load(
)
load(":linking.bzl", "create_linker_input")
load(":providers.bzl", "SwiftInfo", "SwiftToolchainInfo")
load(":swift_clang_module_aspect.bzl", "swift_clang_module_aspect")
load(":swift_common.bzl", "swift_common")
load(
":utils.bzl",
Expand Down Expand Up @@ -286,11 +287,11 @@ def _swift_library_impl(ctx):
swift_library = rule(
attrs = dicts.add(
swift_common.library_rule_attrs(additional_deps_aspects = [
swift_common.swift_clang_module_aspect,
swift_clang_module_aspect,
]),
{
"private_deps": swift_deps_attr(
aspects = [swift_common.swift_clang_module_aspect],
aspects = [swift_clang_module_aspect],
doc = """\
A list of targets that are implementation-only dependencies of the target being
built. Libraries/linker flags from these dependencies will be propagated to
Expand Down
5 changes: 5 additions & 0 deletions swift/swift.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ load(
"@build_bazel_rules_swift//swift/internal:swift_c_module.bzl",
_swift_c_module = "swift_c_module",
)
load(
"@build_bazel_rules_swift//swift/internal:swift_clang_module_aspect.bzl",
_swift_clang_module_aspect = "swift_clang_module_aspect",
)
load(
"@build_bazel_rules_swift//swift/internal:swift_common.bzl",
_swift_common = "swift_common",
Expand Down Expand Up @@ -83,4 +87,5 @@ swift_module_alias = _swift_module_alias
swift_proto_library = _swift_proto_library

# Re-export public aspects.
swift_clang_module_aspect = _swift_clang_module_aspect
swift_usage_aspect = _swift_usage_aspect

0 comments on commit bf8243d

Please sign in to comment.