Skip to content

Commit 61e2c46

Browse files
authored
Add support for package_name in mixed_language_library (#1458)
1 parent 26d4f8f commit 61e2c46

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

doc/rules.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,9 +1066,9 @@ swift_library(
10661066
<pre>
10671067
mixed_language_library(<a href="#mixed_language_library-name">name</a>, <a href="#mixed_language_library-alwayslink">alwayslink</a>, <a href="#mixed_language_library-clang_copts">clang_copts</a>, <a href="#mixed_language_library-clang_defines">clang_defines</a>, <a href="#mixed_language_library-clang_srcs">clang_srcs</a>, <a href="#mixed_language_library-data">data</a>,
10681068
<a href="#mixed_language_library-enable_modules">enable_modules</a>, <a href="#mixed_language_library-hdrs">hdrs</a>, <a href="#mixed_language_library-includes">includes</a>, <a href="#mixed_language_library-linkopts">linkopts</a>, <a href="#mixed_language_library-module_map">module_map</a>, <a href="#mixed_language_library-module_name">module_name</a>,
1069-
<a href="#mixed_language_library-non_arc_srcs">non_arc_srcs</a>, <a href="#mixed_language_library-private_deps">private_deps</a>, <a href="#mixed_language_library-sdk_dylibs">sdk_dylibs</a>, <a href="#mixed_language_library-sdk_frameworks">sdk_frameworks</a>, <a href="#mixed_language_library-swift_copts">swift_copts</a>,
1070-
<a href="#mixed_language_library-swift_defines">swift_defines</a>, <a href="#mixed_language_library-swift_srcs">swift_srcs</a>, <a href="#mixed_language_library-swiftc_inputs">swiftc_inputs</a>, <a href="#mixed_language_library-textual_hdrs">textual_hdrs</a>, <a href="#mixed_language_library-umbrella_header">umbrella_header</a>,
1071-
<a href="#mixed_language_library-weak_sdk_frameworks">weak_sdk_frameworks</a>, <a href="#mixed_language_library-deps">deps</a>, <a href="#mixed_language_library-kwargs">kwargs</a>)
1069+
<a href="#mixed_language_library-non_arc_srcs">non_arc_srcs</a>, <a href="#mixed_language_library-package_name">package_name</a>, <a href="#mixed_language_library-private_deps">private_deps</a>, <a href="#mixed_language_library-sdk_dylibs">sdk_dylibs</a>, <a href="#mixed_language_library-sdk_frameworks">sdk_frameworks</a>,
1070+
<a href="#mixed_language_library-swift_copts">swift_copts</a>, <a href="#mixed_language_library-swift_defines">swift_defines</a>, <a href="#mixed_language_library-swift_srcs">swift_srcs</a>, <a href="#mixed_language_library-swiftc_inputs">swiftc_inputs</a>, <a href="#mixed_language_library-textual_hdrs">textual_hdrs</a>,
1071+
<a href="#mixed_language_library-umbrella_header">umbrella_header</a>, <a href="#mixed_language_library-weak_sdk_frameworks">weak_sdk_frameworks</a>, <a href="#mixed_language_library-deps">deps</a>, <a href="#mixed_language_library-kwargs">kwargs</a>)
10721072
</pre>
10731073

10741074
Creates a mixed language library from a Clang and Swift library target pair.
@@ -1095,6 +1095,7 @@ Once that is the case, this macro will be deprecated.
10951095
| <a id="mixed_language_library-module_map"></a>module_map | A `File` representing an existing module map that should be used to represent the module, or `None` (the default) if the module map should be generated based on `hdrs`. If this argument is provided, then `module_name` must also be provided.<br><br>Warning: If a module map (whether provided here or not) is able to be found via an include path, it will result in duplicate module definition errors for downstream targets unless sandboxing or remote execution is used. | `None` |
10961096
| <a id="mixed_language_library-module_name"></a>module_name | The name of the Swift module being built.<br><br>If left unspecified, the module name will be computed based on the target's build label, by stripping the leading `//` and replacing `/`, `:`, and other non-identifier characters with underscores. | `None` |
10971097
| <a id="mixed_language_library-non_arc_srcs"></a>non_arc_srcs | The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the `clang_srcs` attribute, but are compiled without ARC enabled. | `[]` |
1098+
| <a id="mixed_language_library-package_name"></a>package_name | The semantic package of the Swift target being built. Targets with the same `package_name` can access APIs using the 'package' access control modifier in Swift 5.9+. | `None` |
10981099
| <a id="mixed_language_library-private_deps"></a>private_deps | A list of targets that are implementation-only dependencies of the target being built. Libraries/linker flags from these dependencies will be propagated to dependent for linking, but artifacts/flags required for compilation (such as .swiftmodule files, C headers, and search paths) will not be propagated. | `[]` |
10991100
| <a id="mixed_language_library-sdk_dylibs"></a>sdk_dylibs | A list of of SDK `.dylib` libraries to link with. For instance, "libz" or "libarchive". "libc++" is included automatically if the binary has any C++ or Objective-C++ sources in its dependency tree. When linking a binary, all libraries named in that binary's transitive dependency graph are used. | `[]` |
11001101
| <a id="mixed_language_library-sdk_frameworks"></a>sdk_frameworks | A list of SDK frameworks to link with (e.g. "AddressBook", "QuartzCore").<br><br>When linking a top level Apple binary, all SDK frameworks listed in that binary's transitive dependency graph are linked. | `[]` |

mixed_language/mixed_language_library.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def mixed_language_library(
4747
module_map = None,
4848
module_name = None,
4949
non_arc_srcs = [],
50+
package_name = None,
5051
private_deps = [],
5152
sdk_dylibs = [],
5253
sdk_frameworks = [],
@@ -118,6 +119,9 @@ def mixed_language_library(
118119
the library target that DO NOT use ARC. The files in this attribute
119120
are treated very similar to those in the `clang_srcs` attribute, but
120121
are compiled without ARC enabled.
122+
package_name: The semantic package of the Swift target being built. Targets
123+
with the same `package_name` can access APIs using the 'package'
124+
access control modifier in Swift 5.9+.
121125
private_deps: A list of targets that are implementation-only
122126
dependencies of the target being built. Libraries/linker flags from
123127
these dependencies will be propagated to dependent for linking, but
@@ -314,6 +318,7 @@ a mixed language Swift library, use a clang only library rule like \
314318
generated_header_name = module_name + "-Swift.h",
315319
linkopts = linkopts,
316320
module_name = module_name,
321+
package_name = package_name,
317322
private_deps = private_deps,
318323
swiftc_inputs = swiftc_inputs,
319324
tags = internal_tags,

0 commit comments

Comments
 (0)