Skip to content

Commit

Permalink
Cherry-pick: mixed language package name into 2.x branch (#1467)
Browse files Browse the repository at this point in the history
Taking #1458 into the 2.x
branch and will tag 2.3.0
  • Loading branch information
luispadron authored Dec 10, 2024
1 parent 6871414 commit 7e43ccb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions doc/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -993,9 +993,9 @@ swift_library(
<pre>
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>,
<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>,
<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>,
<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>,
<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>)
<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>,
<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>,
<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>)
</pre>

Creates a mixed language library from a Clang and Swift library target pair.
Expand All @@ -1022,6 +1022,7 @@ Once that is the case, this macro will be deprecated.
| <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` |
| <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` |
| <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. | `[]` |
| <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` |
| <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. | `[]` |
| <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. | `[]` |
| <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. | `[]` |
Expand Down
5 changes: 5 additions & 0 deletions mixed_language/mixed_language_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def mixed_language_library(
module_map = None,
module_name = None,
non_arc_srcs = [],
package_name = None,
private_deps = [],
sdk_dylibs = [],
sdk_frameworks = [],
Expand Down Expand Up @@ -118,6 +119,9 @@ def mixed_language_library(
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.
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+.
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
Expand Down Expand Up @@ -314,6 +318,7 @@ a mixed language Swift library, use a clang only library rule like \
generated_header_name = module_name + "-Swift.h",
linkopts = linkopts,
module_name = module_name,
package_name = package_name,
private_deps = private_deps,
swiftc_inputs = swiftc_inputs,
tags = internal_tags,
Expand Down

0 comments on commit 7e43ccb

Please sign in to comment.