Skip to content

Commit

Permalink
Swift Explicit Modules: extract attrib
Browse files Browse the repository at this point in the history
Summary: Move the `uses_explicit_modules` attribute to a single place, so that all rules which use can be updated in a single place (follow-up diff).

Reviewed By: manicaesar

Differential Revision: D63053781

fbshipit-source-id: c4db1fc7cd5b1b867e337f0e08b44869531417a2
  • Loading branch information
milend authored and facebook-github-bot committed Sep 20, 2024
1 parent 8b434e1 commit e5a3144
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions apple/apple_common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ def _serialize_debugging_options_arg():
"serialize_debugging_options": attrs.bool(default = True),
}

def _uses_explicit_modules_arg():
return {
"uses_explicit_modules": attrs.bool(default = False),
}

apple_common = struct(
headers_arg = _headers_arg,
exported_headers_arg = _exported_headers_arg,
Expand All @@ -171,4 +176,5 @@ apple_common = struct(
privacy_manifest_arg = _privacy_manifest_arg,
debug_artifacts_validators_arg = _debug_artifacts_validators_arg,
serialize_debugging_options_arg = _serialize_debugging_options_arg,
uses_explicit_modules_arg = _uses_explicit_modules_arg,
)
2 changes: 1 addition & 1 deletion decls/cxx_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ cxx_library = prelude_rule(
cxx_common.precompiled_header_arg() |
apple_common.extra_xcode_sources() |
apple_common.extra_xcode_files() |
apple_common.uses_explicit_modules_arg() |
{
"bridging_header": attrs.option(attrs.source(), default = None),
"can_be_asset": attrs.option(attrs.bool(), default = None),
Expand Down Expand Up @@ -587,7 +588,6 @@ cxx_library = prelude_rule(
"thin_lto": attrs.bool(default = False),
"use_archive": attrs.option(attrs.bool(), default = None),
"uses_cxx_explicit_modules": attrs.bool(default = False),
"uses_explicit_modules": attrs.bool(default = False),
"version_universe": attrs.option(attrs.string(), default = None),
"weak_framework_names": attrs.list(attrs.string(), default = []),
"use_header_units": attrs.bool(default = False),
Expand Down
10 changes: 5 additions & 5 deletions decls/ios_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ apple_binary = prelude_rule(
apple_common.extra_xcode_sources() |
apple_common.extra_xcode_files() |
apple_common.serialize_debugging_options_arg() |
apple_common.uses_explicit_modules_arg() |
{
"bridging_header": attrs.option(attrs.source(), default = None),
"can_be_asset": attrs.option(attrs.bool(), default = None),
Expand Down Expand Up @@ -231,7 +232,6 @@ apple_binary = prelude_rule(
"thin_lto": attrs.bool(default = False),
"use_submodules": attrs.bool(default = True),
"uses_cxx_explicit_modules": attrs.bool(default = False),
"uses_explicit_modules": attrs.bool(default = False),
"uses_modules": attrs.bool(default = False),
} |
buck.allow_cache_upload_arg()
Expand Down Expand Up @@ -457,6 +457,7 @@ apple_library = prelude_rule(
apple_common.extra_xcode_sources() |
apple_common.extra_xcode_files() |
apple_common.serialize_debugging_options_arg() |
apple_common.uses_explicit_modules_arg() |
{
"bridging_header": attrs.option(attrs.source(), default = None),
"can_be_asset": attrs.option(attrs.bool(), default = None),
Expand Down Expand Up @@ -521,7 +522,6 @@ apple_library = prelude_rule(
"thin_lto": attrs.bool(default = False),
"use_submodules": attrs.bool(default = True),
"uses_cxx_explicit_modules": attrs.bool(default = False),
"uses_explicit_modules": attrs.bool(default = False),
"uses_modules": attrs.bool(default = False),
} |
buck.allow_cache_upload_arg()
Expand Down Expand Up @@ -705,6 +705,7 @@ apple_test = prelude_rule(
apple_common.extra_xcode_sources() |
apple_common.extra_xcode_files() |
apple_common.serialize_debugging_options_arg() |
apple_common.uses_explicit_modules_arg() |
{
"asset_catalogs_compilation_options": attrs.dict(key = attrs.string(), value = attrs.any(), default = {}),
"bridging_header": attrs.option(attrs.source(), default = None),
Expand Down Expand Up @@ -790,7 +791,6 @@ apple_test = prelude_rule(
"ui_test_target_app": attrs.option(attrs.dep(), default = None),
"use_submodules": attrs.bool(default = True),
"uses_cxx_explicit_modules": attrs.bool(default = False),
"uses_explicit_modules": attrs.bool(default = False),
"uses_modules": attrs.bool(default = False),
"xcode_product_type": attrs.option(attrs.string(), default = None),
} |
Expand Down Expand Up @@ -982,9 +982,9 @@ swift_library = prelude_rule(
"srcs": attrs.list(attrs.source(), default = []),
"supported_platforms_regex": attrs.option(attrs.regex(), default = None),
"target_sdk_version": attrs.option(attrs.string(), default = None),
"uses_explicit_modules": attrs.bool(default = False),
"version": attrs.option(attrs.string(), default = None),
}
} |
apple_common.uses_explicit_modules_arg()
),
)

Expand Down

0 comments on commit e5a3144

Please sign in to comment.