Skip to content

Commit

Permalink
Perform the necessary forwarding load to expose the apple_xcframewo…
Browse files Browse the repository at this point in the history
…rk rule from internal.

PiperOrigin-RevId: 399550213
(cherry picked from commit 22948ba)
  • Loading branch information
nglevin authored and brentleyjones committed Nov 29, 2021
1 parent f593408 commit 69670b9
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 6 deletions.
1 change: 1 addition & 0 deletions apple/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ bzl_library(
srcs = ["apple.bzl"],
deps = [
"//apple/internal:apple_framework_import",
"//apple/internal:xcframework_rules",
],
)

Expand Down
5 changes: 5 additions & 0 deletions apple/apple.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ load(
_apple_dynamic_framework_import = "apple_dynamic_framework_import",
_apple_static_framework_import = "apple_static_framework_import",
)
load(
"@build_bazel_rules_apple//apple/internal:xcframework_rules.bzl",
_apple_xcframework = "apple_xcframework",
)

apple_dynamic_framework_import = _apple_dynamic_framework_import
apple_static_framework_import = _apple_static_framework_import
apple_xcframework = _apple_xcframework
27 changes: 27 additions & 0 deletions apple/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,33 @@ bzl_library(
],
)

bzl_library(
name = "xcframework_rules",
srcs = ["xcframework_rules.bzl"],
visibility = [
"//apple:__subpackages__",
],
deps = [
":apple_product_type",
":experimental",
":intermediates",
":linking_support",
":outputs",
":partials",
":platform_support",
":processor",
":resources",
":rule_support",
":swift_support",
":transition_support",
"//apple:providers",
"//apple/internal/aspects:resource_aspect",
"@build_bazel_apple_support//lib:apple_support",
"@build_bazel_apple_support//lib:lipo",
"@build_bazel_rules_swift//swift",
],
)

# Consumed by bazel tests.
filegroup(
name = "for_bazel_tests",
Expand Down
35 changes: 35 additions & 0 deletions doc/rules-apple.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,38 @@ objc_library(
| <a id="apple_static_framework_import-weak_sdk_frameworks"></a>weak_sdk_frameworks | Names of SDK frameworks to weakly link with. For instance, <code>MediaAccessibility</code>. In difference to regularly linked SDK frameworks, symbols from weakly linked frameworks do not cause an error if they are not present at runtime. | List of strings | optional | [] |


<a id="#apple_xcframework"></a>

## apple_xcframework

<pre>
apple_xcframework(<a href="#apple_xcframework-name">name</a>, <a href="#apple_xcframework-bundle_id">bundle_id</a>, <a href="#apple_xcframework-bundle_name">bundle_name</a>, <a href="#apple_xcframework-data">data</a>, <a href="#apple_xcframework-deps">deps</a>, <a href="#apple_xcframework-exported_symbols_lists">exported_symbols_lists</a>,
<a href="#apple_xcframework-families_required">families_required</a>, <a href="#apple_xcframework-framework_type">framework_type</a>, <a href="#apple_xcframework-infoplists">infoplists</a>, <a href="#apple_xcframework-ios">ios</a>, <a href="#apple_xcframework-linkopts">linkopts</a>,
<a href="#apple_xcframework-minimum_deployment_os_versions">minimum_deployment_os_versions</a>, <a href="#apple_xcframework-minimum_os_versions">minimum_os_versions</a>, <a href="#apple_xcframework-public_hdrs">public_hdrs</a>, <a href="#apple_xcframework-stamp">stamp</a>, <a href="#apple_xcframework-version">version</a>)
</pre>



**ATTRIBUTES**


| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="apple_xcframework-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="apple_xcframework-bundle_id"></a>bundle_id | The bundle ID (reverse-DNS path followed by app name) for each of the embedded frameworks. If present, this value will be embedded in an Info.plist within each framework bundle. | String | optional | "" |
| <a id="apple_xcframework-bundle_name"></a>bundle_name | The desired name of the xcframework bundle (without the extension) and the bundles for all embedded frameworks. If this attribute is not set, then the name of the target will be used instead. | String | optional | "" |
| <a id="apple_xcframework-data"></a>data | A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within each of the embedded framework bundles. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="apple_xcframework-deps"></a>deps | A list of dependencies targets that will be linked into this each of the framework target's individual binaries. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the framework bundles. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="apple_xcframework-exported_symbols_lists"></a>exported_symbols_lists | A list of targets containing exported symbols lists files for the linker to control symbol resolution.<br><br>Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as <code>__private_extern__</code> (aka <code>visibility=hidden</code>) and will not be global in the output file.<br><br>See the man page documentation for <code>ld(1)</code> on macOS for more details. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="apple_xcframework-families_required"></a>families_required | A list of device families supported by this extension, with platforms such as <code>ios</code> as keys. Valid values are <code>iphone</code> and <code>ipad</code> for <code>ios</code>; at least one must be specified if a platform is defined. Currently, this only affects processing of <code>ios</code> resources. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> List of strings</a> | optional | {} |
| <a id="apple_xcframework-framework_type"></a>framework_type | Indicates what type of framework the output should be, if defined. Currently only <code>dynamic</code> is supported. If this is not given, the default is to have all contained frameworks built as dynamic frameworks. | List of strings | optional | [] |
| <a id="apple_xcframework-infoplists"></a>infoplists | A list of .plist files that will be merged to form the Info.plist for each of the embedded frameworks. At least one file must be specified. Please see [Info.plist Handling](https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#infoplist-handling) for what is supported. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | required | |
| <a id="apple_xcframework-ios"></a>ios | A dictionary of strings indicating which platform variants should be built for the <code>ios</code> platform ( <code>device</code> or <code>simulator</code>) as keys, and arrays of strings listing which architectures should be built for those platform variants (for example, <code>x86_64</code>, <code>arm64</code>) as their values. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> List of strings</a> | optional | {} |
| <a id="apple_xcframework-linkopts"></a>linkopts | A list of strings representing extra flags that should be passed to the linker. | List of strings | optional | [] |
| <a id="apple_xcframework-minimum_deployment_os_versions"></a>minimum_deployment_os_versions | A dictionary of strings indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0") as values, with their respective platforms such as <code>ios</code> as keys. This is different from <code>minimum_os_versions</code>, which is effective at compile time. Ensure version specific APIs are guarded with <code>available</code> clauses. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <a id="apple_xcframework-minimum_os_versions"></a>minimum_os_versions | A dictionary of strings indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "8.0") as values, with their respective platforms such as <code>ios</code> as keys. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
| <a id="apple_xcframework-public_hdrs"></a>public_hdrs | A list of files directly referencing header files to be used as the publicly visible interface for each of these embedded frameworks. These header files will be embedded within each bundle, typically in a subdirectory such as <code>Headers</code>. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="apple_xcframework-stamp"></a>stamp | Enable link stamping. Whether to encode build information into the binaries. Possible values:<br><br>* <code>stamp = 1</code>: Stamp the build information into the binaries. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * <code>stamp = 0</code>: Always replace build information by constant values. This gives good build result caching. * <code>stamp = -1</code>: Embedding of build information is controlled by the <code>--[no]stamp</code> flag. | Integer | optional | -1 |
| <a id="apple_xcframework-version"></a>version | An <code>apple_bundle_version</code> target that represents the version for this target. See [<code>apple_bundle_version</code>](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-general.md?cl=head#apple_bundle_version). | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |


10 changes: 4 additions & 6 deletions test/starlark_tests/targets_under_test/apple/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
load(
"//apple:apple.bzl",
"apple_xcframework",
)
load(
"//apple:versioning.bzl",
"apple_bundle_version",
Expand All @@ -11,12 +15,6 @@ load(
"apple_core_data_model",
)

# TODO(b/135122463): Replace internal domain load(...) with a public import when the rule is ready.
load(
"//apple/internal:xcframework_rules.bzl",
"apple_xcframework",
) # buildifier: disable=bzl-visibility

licenses(["notice"])

package(
Expand Down

0 comments on commit 69670b9

Please sign in to comment.