From 34ac987e3d30972ec07936cf07c3648fe8e66566 Mon Sep 17 00:00:00 2001 From: Luis Padron Date: Mon, 16 Oct 2023 17:05:57 -0400 Subject: [PATCH] Update doc targets to work with latest version of stardoc --- .bazelrc | 4 - MODULE.bazel | 2 +- data/BUILD.bazel | 11 + docs/BUILD.bazel | 44 ++-- docs/app_clip_doc.md | 12 +- docs/app_doc.md | 14 +- docs/extension_doc.md | 12 +- docs/features_doc.md | 16 ++ docs/force_load_direct_deps_doc.md | 46 +++++ docs/framework_doc.md | 46 ++--- docs/hmap_doc.md | 7 +- docs/import_middleman_doc.md | 74 +++++++ docs/library_doc.md | 20 +- docs/plists_doc.md | 8 +- docs/precompiled_apple_resource_bundle_doc.md | 2 - docs/providers_doc.md | 47 +++++ docs/substitute_build_settings_doc.md | 3 +- docs/test_doc.md | 110 +++++----- docs/vfs_overlay_doc.md | 59 ++++++ docs/xcconfig_doc.md | 86 ++++++++ rules/BUILD.bazel | 188 +++++++++++++++++- rules/features.bzl | 16 ++ rules/framework/BUILD.bazel | 13 ++ rules/internal/BUILD.bazel | 18 ++ rules/library.bzl | 2 +- rules/library/BUILD.bazel | 20 ++ rules/library/xcconfig.bzl | 3 + rules/vfs_overlay.doc.bzl | 8 + rules/xcconfig.doc.bzl | 10 + 29 files changed, 744 insertions(+), 157 deletions(-) create mode 100755 docs/features_doc.md create mode 100755 docs/force_load_direct_deps_doc.md create mode 100755 docs/import_middleman_doc.md create mode 100755 docs/providers_doc.md create mode 100755 docs/vfs_overlay_doc.md create mode 100755 docs/xcconfig_doc.md create mode 100644 rules/vfs_overlay.doc.bzl create mode 100644 rules/xcconfig.doc.bzl diff --git a/.bazelrc b/.bazelrc index 653c018cb..bf69ff1b7 100644 --- a/.bazelrc +++ b/.bazelrc @@ -2,10 +2,6 @@ # TODO: While supporting Bazel 5 we need to keep experimental flag vs using "--enable_bzlmod" common --experimental_enable_bzlmod -# We can't create a bzl_library for rules-swift because of its visibility, -# so circumvent by not using the sandbox -build --strategy=Stardoc=standalone - # Spawn strategy required for some tests build --spawn_strategy=standalone diff --git a/MODULE.bazel b/MODULE.bazel index 043c2b1a6..228af0e2d 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -56,8 +56,8 @@ bazel_dep( bazel_dep( name = "stardoc", version = "0.6.2", - repo_name = "io_bazel_stardoc", dev_dependency = True, + repo_name = "io_bazel_stardoc", ) # Load non-bzlmod dependencies from rules_ios diff --git a/data/BUILD.bazel b/data/BUILD.bazel index 30f12bc97..45c22d0bc 100644 --- a/data/BUILD.bazel +++ b/data/BUILD.bazel @@ -1,6 +1,17 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + package(default_visibility = ["//rules/library:__pkg__"]) exports_files( ["xcspecs.bzl"], visibility = ["//docs:__pkg__"], ) + +bzl_library( + name = "xcspecs", + srcs = [ + "xcspec_evals.bzl", + "xcspecs.bzl", + ], + visibility = ["//visibility:public"], +) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 5da1ca132..ae9599006 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -1,50 +1,48 @@ load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") package(default_visibility = ["//visibility:private"]) -_RULES = [ +# Targets to document. +# Must have a coressponding `bzl_library` target in `//rules:BUILD.bazel`. +_DOC_SRCS = [ "app_clip", "app", - "apple_patched", "extension", + "features", + "force_load_direct_deps", "framework", "hmap", + "import_middleman", "library", "plists", "precompiled_apple_resource_bundle", + "providers", "substitute_build_settings", "test", "transition_support", + "vfs_overlay.doc", + "xcconfig.doc", ] -bzl_library( - name = "data", - srcs = [ - "//data:xcspecs.bzl", - ], - tags = ["manual"], - visibility = ["//visibility:private"], -) +# Create stardoc targets for each documentation target defined [ stardoc( - name = "%s-docs" % name, - out = "%s_doc.md" % name, - input = "//rules:%s.bzl" % name, - tags = ["manual"], - visibility = ["//:__pkg__"], - deps = [ - ":data", - "@build_bazel_rules_apple//apple", + name = file + "_doc", + out = file + ".gen.md", + input = "//rules:%s.bzl" % file, + tags = [ + "no-cache", + "no-sandbox", # https://github.com/bazelbuild/stardoc/issues/112 ], + deps = ["//rules:" + file], ) - for name in _RULES + for file in _DOC_SRCS ] filegroup( name = "_all_docs", - srcs = ["%s-docs" % name for name in _RULES], + srcs = ["%s.gen.md" % name for name in _DOC_SRCS], tags = ["manual"], ) @@ -60,7 +58,9 @@ genrule( echo "#!/bin/bash" > $(OUTS) echo "set -eu" > $(OUTS) echo 'function copy() { - dest="$${BUILD_WORKSPACE_DIRECTORY}/docs/$$(basename $$1)" + src_name=$$(basename "$$1") + dest_name=$${src_name%%.*}_doc.md # replace generated extension with '_doc.md' + dest="$${BUILD_WORKSPACE_DIRECTORY}/docs/$${dest_name}" cp "$$1" "$$dest" chmod +w "$$dest" }' >> $(OUTS) diff --git a/docs/app_clip_doc.md b/docs/app_clip_doc.md index 21b95913f..880d7f97e 100755 --- a/docs/app_clip_doc.md +++ b/docs/app_clip_doc.md @@ -11,7 +11,7 @@ ios_app_clip(name, xcconfig_by_build_setting, kwargs) - Builds and packages an iOS App Clip. +Builds and packages an iOS App Clip. The docs for app_clip are at rules_apple https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_app_clip @@ -23,11 +23,11 @@ https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_app_c | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name of the iOS app clip. | none | -| families | A list of iOS device families the target supports. | ["iphone", "ipad"] | -| infoplists | A list of Info.plist files to be merged into the app clip. | [] | -| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | {} | -| xcconfig | A dictionary of xcconfigs to be applied to the app clip by default. | {} | -| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | {} | +| families | A list of iOS device families the target supports. | `["iphone", "ipad"]` | +| infoplists | A list of Info.plist files to be merged into the app clip. | `[]` | +| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | `{}` | +| xcconfig | A dictionary of xcconfigs to be applied to the app clip by default. | `{}` | +| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | `{}` | | kwargs | Arguments passed to the ios_app_clip rule as appropriate. | none | diff --git a/docs/app_doc.md b/docs/app_doc.md index 3b3b4e265..01ff90608 100755 --- a/docs/app_doc.md +++ b/docs/app_doc.md @@ -11,7 +11,7 @@ ios_application(name, xcconfig_by_build_setting, kwargs) - Builds and packages an iOS application. +Builds and packages an iOS application. **PARAMETERS** @@ -19,12 +19,12 @@ ios_application(name, name | The name of the iOS application. | none | -| families | A list of iOS device families the target supports. | ["iphone", "ipad"] | -| apple_library | The macro used to package sources into a library. | <function apple_library> | -| infoplists | A list of Info.plist files to be merged into the iOS app. | [] | -| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | {} | -| xcconfig | A dictionary of xcconfigs to be applied to the iOS app by default. | {} | -| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | {} | +| families | A list of iOS device families the target supports. | `["iphone", "ipad"]` | +| apple_library | The macro used to package sources into a library. | `` | +| infoplists | A list of Info.plist files to be merged into the iOS app. | `[]` | +| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | `{}` | +| xcconfig | A dictionary of xcconfigs to be applied to the iOS app by default. | `{}` | +| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | `{}` | | kwargs | Arguments passed to the apple_library and ios_application rules as appropriate. | none | diff --git a/docs/extension_doc.md b/docs/extension_doc.md index 6e0eb350a..6013b9d99 100755 --- a/docs/extension_doc.md +++ b/docs/extension_doc.md @@ -11,7 +11,7 @@ ios_extension(name, xcconfig_by_build_setting, kwargs) - Builds and packages an iOS extension. +Builds and packages an iOS extension. The docs for ios_extension are at rules_apple https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_extension @@ -25,11 +25,11 @@ Perhaps we can just remove this wrapper longer term. | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name of the iOS extension. | none | -| families | A list of iOS device families the target supports. | ["iphone", "ipad"] | -| infoplists | A list of Info.plist files to be merged into the extension. | [] | -| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | {} | -| xcconfig | A dictionary of xcconfigs to be applied to the extension by default. | {} | -| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | {} | +| families | A list of iOS device families the target supports. | `["iphone", "ipad"]` | +| infoplists | A list of Info.plist files to be merged into the extension. | `[]` | +| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | `{}` | +| xcconfig | A dictionary of xcconfigs to be applied to the extension by default. | `{}` | +| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | `{}` | | kwargs | Arguments passed to the ios_extension rule as appropriate. | none | diff --git a/docs/features_doc.md b/docs/features_doc.md new file mode 100755 index 000000000..9db90b1a5 --- /dev/null +++ b/docs/features_doc.md @@ -0,0 +1,16 @@ + + +Defines features specific to rules_ios + +- `apple.virtualize_frameworks` + - Virtualize means that swift,clang read from llvm's in-memory file system + +- `xcode.compile_with_xcode` + - Some of the rules need to work sligntly differently under pure Xcode mode + +- `apple.arm64_simulator_use_device_deps` + - Use the ARM deps for the simulator - see rules/import_middleman.bzl + +- `swift.swift_disable_import_underlying_module` + - When set disable passing the `-import-underlying-module` copt to `swift_library` targets + diff --git a/docs/force_load_direct_deps_doc.md b/docs/force_load_direct_deps_doc.md new file mode 100755 index 000000000..75193f6b2 --- /dev/null +++ b/docs/force_load_direct_deps_doc.md @@ -0,0 +1,46 @@ + + + + + + +## force_load_direct_deps + +
+force_load_direct_deps(name, deps, should_force_load)
+
+ +A rule to link with `-force_load` for direct`deps` + +ld has different behavior when loading members of a static library VS objects +as far as visibility. Under `-dynamic` +- linked _swift object files_ can have public visibility +- symbols from _swift static libraries_ are omitted unless used, and not +visible otherwise + +By using `-force_load`, we can load static libraries in the attributes of an +application's direct depenencies. These args need go at the _front_ of the +linker invocation otherwise these arguments don't work with lds logic. + +Why not put it into `rules_apple`? Ideally it could be, and perhaps consider a +PR to there .The underlying java rule, `AppleBinary.linkMultiArchBinary` +places `extraLinkopts` at the end of the linker invocation. At the time of +writing these args need to go into the current rule context where +`AppleBinary.linkMultiArchBinary` is called. + +One use case of this is that iOS developers want to load above mentioned +symbols from applications. Another alternate could be to create an aspect, +that actually generates a different application and linker invocation instead +of force loading symbols. This could be more complicated from an integration +perspective so it isn't used. + +**ATTRIBUTES** + + +| Name | Description | Type | Mandatory | Default | +| :------------- | :------------- | :------------- | :------------- | :------------- | +| name | A unique name for this target. | Name | required | | +| deps | - | List of labels | optional | `[]` | +| should_force_load | Allows parametrically enabling the functionality in this rule. | Boolean | optional | `True` | + + diff --git a/docs/framework_doc.md b/docs/framework_doc.md index 1b7f9a9de..bf936c156 100755 --- a/docs/framework_doc.md +++ b/docs/framework_doc.md @@ -7,7 +7,7 @@ Framework rules ## apple_framework_packaging
-apple_framework_packaging(name, bundle_extension, bundle_id, data, deps, environment_plist,
+apple_framework_packaging(name, deps, data, bundle_extension, bundle_id, environment_plist,
                           exported_symbols_lists, framework_name, frameworks, infoplists,
                           library_linkopts, link_dynamic, minimum_deployment_os_version,
                           minimum_os_version, platform_type, platforms, private_deps, skip_packaging,
@@ -22,26 +22,26 @@ Packages compiled code into an Apple .framework package
 | Name  | Description | Type | Mandatory | Default |
 | :------------- | :------------- | :------------- | :------------- | :------------- |
 | name |  A unique name for this target.   | Name | required |  |
-| bundle_extension |  The extension of the bundle, defaults to "framework".   | String | optional | "framework" |
-| bundle_id |  The bundle identifier of the framework. Currently unused.   | String | optional | "" |
-| data |  Objc or Swift rules to be packed by the framework rule   | List of labels | optional | [] |
 | deps |  Objc or Swift rules to be packed by the framework rule   | List of labels | required |  |
-| environment_plist |  An executable file referencing the environment_plist tool. Used to merge infoplists. See https://github.com/bazelbuild/rules_apple/blob/master/apple/internal/environment_plist.bzl#L69   | Label | optional | None |
-| exported_symbols_lists |     | List of labels | optional | [] |
+| data |  Objc or Swift rules to be packed by the framework rule   | List of labels | optional |  `[]`  |
+| bundle_extension |  The extension of the bundle, defaults to "framework".   | String | optional |  `"framework"`  |
+| bundle_id |  The bundle identifier of the framework. Currently unused.   | String | optional |  `""`  |
+| environment_plist |  An executable file referencing the environment_plist tool. Used to merge infoplists. See https://github.com/bazelbuild/rules_apple/blob/master/apple/internal/environment_plist.bzl#L69   | Label | optional |  `None`  |
+| exported_symbols_lists |  -   | List of labels | optional |  `[]`  |
 | framework_name |  Name of the framework, usually the same as the module name   | String | required |  |
-| frameworks |  A list of framework targets (see [ios_framework](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_framework)) that this target depends on.   | List of labels | optional | [] |
-| infoplists |  The infoplists for the framework   | List of labels | optional | [] |
-| library_linkopts |  Internal - A list of strings representing extra flags that are passed to the linker for the underlying library.   | List of strings | optional | [] |
-| link_dynamic |  Weather or not if this framework is dynamic

The default behavior bakes this into the top level app. When false, it's statically linked. | Boolean | optional | False | -| minimum_deployment_os_version | The bundle identifier of the framework. Currently unused. | String | optional | "" | -| minimum_os_version | Internal - currently rules_ios the dict platforms | String | optional | "" | -| platform_type | Internal - currently rules_ios uses the dict platforms | String | optional | "" | -| platforms | A dictionary of platform names to minimum deployment targets. If not given, the framework will be built for the platform it inherits from the target that uses the framework as a dependency. | Dictionary: String -> String | optional | {} | -| private_deps | Objc or Swift private rules to be packed by the framework rule | List of labels | optional | [] | -| skip_packaging | Parts of the framework packaging process to be skipped. Valid values are: - "binary" - "modulemap" - "header" - "infoplist" - "private_header" - "swiftmodule" - "swiftdoc" | List of strings | optional | [] | -| stamp | - | Integer | optional | 0 | +| frameworks | A list of framework targets (see [`ios_framework`](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_framework)) that this target depends on. | List of labels | optional | `[]` | +| infoplists | The infoplists for the framework | List of labels | optional | `[]` | +| library_linkopts | Internal - A list of strings representing extra flags that are passed to the linker for the underlying library. | List of strings | optional | `[]` | +| link_dynamic | Weather or not if this framework is dynamic

The default behavior bakes this into the top level app. When false, it's statically linked. | Boolean | optional | `False` | +| minimum_deployment_os_version | The bundle identifier of the framework. Currently unused. | String | optional | `""` | +| minimum_os_version | Internal - currently rules_ios the dict `platforms` | String | optional | `""` | +| platform_type | Internal - currently rules_ios uses the dict `platforms` | String | optional | `""` | +| platforms | A dictionary of platform names to minimum deployment targets. If not given, the framework will be built for the platform it inherits from the target that uses the framework as a dependency. | Dictionary: String -> String | optional | `{}` | +| private_deps | Objc or Swift private rules to be packed by the framework rule | List of labels | optional | `[]` | +| skip_packaging | Parts of the framework packaging process to be skipped. Valid values are: - "binary" - "modulemap" - "header" - "infoplist" - "private_header" - "swiftmodule" - "swiftdoc" | List of strings | optional | `[]` | +| stamp | - | Integer | optional | `0` | | transitive_deps | Deps of the deps | List of labels | required | | -| vfs | Additional VFS for the framework to export | List of labels | optional | [] | +| vfs | Additional VFS for the framework to export | List of labels | optional | `[]` | @@ -61,11 +61,11 @@ Builds and packages an Apple framework. | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name of the framework. | none | -| apple_library | The macro used to package sources into a library. | <function apple_library> | -| infoplists | A list of Info.plist files to be merged into the framework. | [] | -| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | {} | -| xcconfig | A dictionary of xcconfigs to be applied to the framework by default. | {} | -| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | {} | +| apple_library | The macro used to package sources into a library. | `` | +| infoplists | A list of Info.plist files to be merged into the framework. | `[]` | +| infoplists_by_build_setting | A dictionary of infoplists grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'infoplists' is set as default. | `{}` | +| xcconfig | A dictionary of xcconfigs to be applied to the framework by default. | `{}` | +| xcconfig_by_build_setting | A dictionary of xcconfigs grouped by bazel build setting.

Each value is applied if the respective bazel build setting is resolved during the analysis phase.

If '//conditions:default' is not set the value in 'xcconfig' is set as default. | `{}` | | kwargs | Arguments passed to the apple_library and apple_framework_packaging rules as appropriate. | none | diff --git a/docs/hmap_doc.md b/docs/hmap_doc.md index 564921df6..e28067dbe 100755 --- a/docs/hmap_doc.md +++ b/docs/hmap_doc.md @@ -7,7 +7,7 @@ Header Map rules ## headermap
-headermap(name, direct_hdr_providers, hdrs, namespace)
+headermap(name, hdrs, direct_hdr_providers, namespace)
 
Creates a binary headermap file from the given headers, @@ -15,7 +15,6 @@ suitable for passing to clang. This can be used to allow headers to be imported at a consistent path, regardless of the package structure being used. - **ATTRIBUTES** @@ -23,9 +22,9 @@ regardless of the package structure being used. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | | name | A unique name for this target. | Name | required | | -| direct_hdr_providers | Targets whose direct headers should be added to the list of hdrs | List of labels | optional | [] | | hdrs | The list of headers included in the headermap | List of labels | required | | -| namespace | The prefix to be used for header imports | String | optional | "" | +| direct_hdr_providers | Targets whose direct headers should be added to the list of hdrs | List of labels | optional | `[]` | +| namespace | The prefix to be used for header imports | String | optional | `""` | diff --git a/docs/import_middleman_doc.md b/docs/import_middleman_doc.md new file mode 100755 index 000000000..a2f503f3d --- /dev/null +++ b/docs/import_middleman_doc.md @@ -0,0 +1,74 @@ + + + + + + +## import_middleman + +
+import_middleman(name, deps, test_deps, update_in_place)
+
+ +This rule adds the ability to update the Mach-o header on imported +libraries and frameworks to get arm64 binaires running on Apple silicon +simulator. For rules_ios, it's added in `app.bzl` and `test.bzl` + +Why bother doing this? Well some apps have many dependencies which could take +along time on vendors or other parties to update. Because the M1 chip has the +same ISA as ARM64, most binaries will run transparently. Most iOS developers +code is high level enough and isn't specifc to a device or simulator. There are +many caveats and eceptions but getting it running is better than nothing. ( e.g. +`TARGET_OS_SIMULATOR` ) + +This solves the problem at the build system level with the power of bazel. The +idea is pretty straight forward: +1. collect all imported paths +2. update the macho headers with Apples vtool and arm64-to-sim +3. update the linker invocation to use the new libs + +Now it updates all of the inputs automatically - the action can be taught to do +all of this conditionally if necessary. + +Note: The action happens in a rule for a few reasons. This has an interesting +propery: you get a single path for framework lookups at linktime. Perhaps this +can be updated to work without the other behavior + +**ATTRIBUTES** + + +| Name | Description | Type | Mandatory | Default | +| :------------- | :------------- | :------------- | :------------- | :------------- | +| name | A unique name for this target. | Name | required | | +| deps | - | List of labels | optional | `[]` | +| test_deps | - | List of labels | optional | `[]` | +| update_in_place | - | Label | optional | `//tools/m1_utils:update_in_place` | + + + + +## find_imports + +
+find_imports(name)
+
+ +Internal aspect for the `import_middleman` see below for a description. + +**ASPECT ATTRIBUTES** + + +| Name | Type | +| :------------- | :------------- | +| transitve_deps| String | +| deps| String | + + +**ATTRIBUTES** + + +| Name | Description | Type | Mandatory | Default | +| :------------- | :------------- | :------------- | :------------- | :------------- | +| name | A unique name for this target. | Name | required | | + + diff --git a/docs/library_doc.md b/docs/library_doc.md index 504129253..0f8f3bc39 100755 --- a/docs/library_doc.md +++ b/docs/library_doc.md @@ -20,8 +20,8 @@ Extends a modulemap with a Swift submodule | name | A unique name for this target. | Name | required | | | destination | - | Label | optional | | | module_name | - | String | required | | -| source | - | Label | optional | None | -| swift_header | - | String | optional | "" | +| source | - | Label | optional | `None` | +| swift_header | - | String | optional | `""` | @@ -64,14 +64,14 @@ reasonable defaults that mimic Xcode's behavior. | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The base name for all of the underlying targets. | none | -| library_tools | An optional dictionary containing overrides for default behaviors. | {} | -| export_private_headers | Whether private headers should be exported via a PrivateHeadersInfo provider. | True | -| namespace_is_module_name | Whether the module name should be used as the namespace for header imports, instead of the target name. | True | -| default_xcconfig_name | The name of a default xcconfig to be applied to this target. | None | -| xcconfig | A dictionary of Xcode build settings to be applied to this target in the form of different copt attributes. | {} | -| xcconfig_by_build_setting | A dictionary of Xcode build settings grouped by bazel build setting.

Each value is applied (overriding any matching setting in 'xcconfig') if the respective bazel build setting is resolved during the analysis phase. | {} | -| objc_defines | A list of Objective-C defines to add to the compilation command line. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. | [] | -| swift_defines | A list of Swift defines to add to the compilation command line. Swift defines do not have values, so strings in this list should be simple identifiers and not KEY=VALUE pairs. (only expections are KEY=1 and KEY=0). These flags are added for the target and every target that depends on it. | [] | +| library_tools | An optional dictionary containing overrides for default behaviors. | `{}` | +| export_private_headers | Whether private headers should be exported via a `PrivateHeadersInfo` provider. | `True` | +| namespace_is_module_name | Whether the module name should be used as the namespace for header imports, instead of the target name. | `True` | +| default_xcconfig_name | The name of a default xcconfig to be applied to this target. | `None` | +| xcconfig | A dictionary of Xcode build settings to be applied to this target in the form of different `copt` attributes. | `{}` | +| xcconfig_by_build_setting | A dictionary of Xcode build settings grouped by bazel build setting.

Each value is applied (overriding any matching setting in 'xcconfig') if the respective bazel build setting is resolved during the analysis phase. | `{}` | +| objc_defines | A list of Objective-C defines to add to the compilation command line. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. | `[]` | +| swift_defines | A list of Swift defines to add to the compilation command line. Swift defines do not have values, so strings in this list should be simple identifiers and not KEY=VALUE pairs. (only expections are KEY=1 and KEY=0). These flags are added for the target and every target that depends on it. | `[]` | | kwargs | keyword arguments. | none | **RETURNS** diff --git a/docs/plists_doc.md b/docs/plists_doc.md index 9b9f4007f..67110b175 100755 --- a/docs/plists_doc.md +++ b/docs/plists_doc.md @@ -1,9 +1,7 @@ - Defines macros for working with plist files. - ## process_infoplists @@ -13,7 +11,7 @@ process_infoplists(name, xcconfig_by_build_setting)
- Constructs substituted_plists by substituting build settings from an xcconfig dict into the variables of a plist. +Constructs substituted_plists by substituting build settings from an xcconfig dict into the variables of a plist. **PARAMETERS** @@ -39,7 +37,7 @@ A selectable dict of the substituted_plists grouped by config_setting substituted_plist(name, plist, xcconfig) - Substitutes build settings from an xcconfig dict into the variables of a plist. +Substitutes build settings from an xcconfig dict into the variables of a plist. **PARAMETERS** @@ -63,7 +61,7 @@ The plist target with the substituted variables. write_info_plists_if_needed(name, plists) - Writes info plists for a bundle if needed. +Writes info plists for a bundle if needed. Given a list of infoplists, will write out any plists that are passed as a dict, and will add a default app Info.plist if no non-dict plists are passed. diff --git a/docs/precompiled_apple_resource_bundle_doc.md b/docs/precompiled_apple_resource_bundle_doc.md index 64004d961..f9c8db6c2 100755 --- a/docs/precompiled_apple_resource_bundle_doc.md +++ b/docs/precompiled_apple_resource_bundle_doc.md @@ -1,13 +1,11 @@ - This provides a resource bundle implementation that builds the resource bundle only once NOTE: This rule only exists because of this issue https://github.com/bazelbuild/rules_apple/issues/319 if this is ever fixed in bazel it should be removed - ## precompiled_apple_resource_bundle diff --git a/docs/providers_doc.md b/docs/providers_doc.md new file mode 100755 index 000000000..84541ee90 --- /dev/null +++ b/docs/providers_doc.md @@ -0,0 +1,47 @@ + + + + + + +## AvoidDepsInfo + +
+AvoidDepsInfo(libraries, link_dynamic)
+
+ + + +**FIELDS** + + +| Name | Description | +| :------------- | :------------- | +| libraries | Libraries to avoid | +| link_dynamic | Weather or not if this dep is dynamic | + + + + +## FrameworkInfo + +
+FrameworkInfo(vfsoverlay_infos, binary, headers, private_headers, modulemap, swiftmodule, swiftdoc)
+
+ + + +**FIELDS** + + +| Name | Description | +| :------------- | :------------- | +| vfsoverlay_infos | Merged VFS overlay infos, present when virtual frameworks enabled | +| binary | The binary of the framework | +| headers | Headers of the framework's public interface | +| private_headers | Private headers of the framework | +| modulemap | The module map of the framework | +| swiftmodule | The swiftmodule | +| swiftdoc | The Swift doc | + + diff --git a/docs/substitute_build_settings_doc.md b/docs/substitute_build_settings_doc.md index 28b4f5568..055e1891f 100755 --- a/docs/substitute_build_settings_doc.md +++ b/docs/substitute_build_settings_doc.md @@ -12,7 +12,6 @@ substitute_build_settings(name, name | A unique name for this target. | Name | required | | | source | The file to be expanded | Label | required | | -| variables | A mapping of settings to their values to be expanded. The setting names should not include $s | Dictionary: String -> String | optional | {} | +| variables | A mapping of settings to their values to be expanded. The setting names should not include `$`s | Dictionary: String -> String | optional | `{}` | diff --git a/docs/test_doc.md b/docs/test_doc.md index 70f710512..2172eeb1b 100755 --- a/docs/test_doc.md +++ b/docs/test_doc.md @@ -2,33 +2,32 @@ - + -## default_test_factory.make_tests +## default_test_factory.make_named_split
-default_test_factory.make_tests(factory, name, test_rule, kwargs)
+default_test_factory.make_named_split(name, split_kwargs, in_split)
 
- Main entry point of generating tests" + **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| factory |

-

| none | -| name |

-

| none | -| test_rule |

-

| none | -| kwargs |

-

| none | +| name |

-

| none | +| split_kwargs |

-

| none | +| in_split |

-

| none | - + -## default_test_factory.make_test_suite +## default_test_factory.make_runner_split
-default_test_factory.make_test_suite(factory, name, test_rule, test_kwargs)
+default_test_factory.make_runner_split(name, runner, in_split)
 
@@ -38,43 +37,37 @@ default_test_factory.make_test_suite(factory |

-

| none | -| name |

-

| none | -| test_rule |

-

| none | -| test_kwargs |

-

| none | +| name |

-

| none | +| runner |

-

| none | +| in_split |

-

| none | - + -## default_test_factory.make_test_suite_splits +## default_test_factory.make_test
-default_test_factory.make_test_suite_splits(factory, name, in_kwargs)
+default_test_factory.make_test(name, test_rule, kwargs)
 
- Helper function to split up a test for named splits and runners splits - -At the end of the day, we need to able to control how many tests / bundles -there are for sharding by class, otherwise it would recompile many times. - -Finally - you can set the splits to be whatever you want. +Helper to create an individual test **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| factory |

-

| none | -| name |

-

| none | -| in_kwargs |

-

| none | +| name |

-

| none | +| test_rule |

-

| none | +| kwargs |

-

| none | - + -## default_test_factory.make_runner_split +## default_test_factory.make_test_suite
-default_test_factory.make_runner_split(name, runner, in_split)
+default_test_factory.make_test_suite(factory, name, test_rule, test_kwargs)
 
@@ -84,49 +77,56 @@ default_test_factory.make_runner_split(name |

-

| none | -| runner |

-

| none | -| in_split |

-

| none | +| factory |

-

| none | +| name |

-

| none | +| test_rule |

-

| none | +| test_kwargs |

-

| none | - + -## default_test_factory.make_named_split +## default_test_factory.make_test_suite_splits
-default_test_factory.make_named_split(name, split_kwargs, in_split)
+default_test_factory.make_test_suite_splits(factory, name, in_kwargs)
 
+Helper function to split up a test for named splits and runners splits +At the end of the day, we need to able to control how many tests / bundles +there are for sharding by class, otherwise it would recompile many times. + +Finally - you can set the splits to be whatever you want. **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| name |

-

| none | -| split_kwargs |

-

| none | -| in_split |

-

| none | +| factory |

-

| none | +| name |

-

| none | +| in_kwargs |

-

| none | - + -## default_test_factory.make_test +## default_test_factory.make_tests
-default_test_factory.make_test(name, test_rule, kwargs)
+default_test_factory.make_tests(factory, name, test_rule, kwargs)
 
- Helper to create an individual test +Main entry point of generating tests" **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| name |

-

| none | -| test_rule |

-

| none | -| kwargs |

-

| none | +| factory |

-

| none | +| name |

-

| none | +| test_rule |

-

| none | +| kwargs |

-

| none | @@ -137,7 +137,7 @@ default_test_factory.make_test(na ios_ui_test(name, apple_library, test_factory, kwargs) - Builds and packages iOS UI Tests. +Builds and packages iOS UI Tests. **PARAMETERS** @@ -145,8 +145,8 @@ ios_ui_test(name, name | The name of the UI test. | none | -| apple_library | The macro used to package sources into a library. | <function apple_library> | -| test_factory | Use this to generate other variations of tests. | struct(make_named_split = <function _make_named_split>, make_runner_split = <function _make_runner_split>, make_test = <function _make_test>, make_test_suite = <function _make_test_suite>, make_test_suite_splits = <function _make_test_suite_splits>, make_tests = <function _make_tests>) | +| apple_library | The macro used to package sources into a library. | `` | +| test_factory | Use this to generate other variations of tests. | `struct(make_named_split = , make_runner_split = , make_test = , make_test_suite = , make_test_suite_splits = , make_tests = )` | | kwargs | Arguments passed to the apple_library and ios_ui_test rules as appropriate. | none | @@ -158,7 +158,7 @@ ios_ui_test(name, name, apple_library, test_factory, kwargs) - Builds and packages iOS Unit Snapshot Tests. +Builds and packages iOS Unit Snapshot Tests. **PARAMETERS** @@ -166,8 +166,8 @@ ios_unit_snapshot_test(name, name | The name of the UI test. | none | -| apple_library | The macro used to package sources into a library. | <function apple_library> | -| test_factory | Use this to generate other variations of tests. | struct(make_named_split = <function _make_named_split>, make_runner_split = <function _make_runner_split>, make_test = <function _make_test>, make_test_suite = <function _make_test_suite>, make_test_suite_splits = <function _make_test_suite_splits>, make_tests = <function _make_tests>) | +| apple_library | The macro used to package sources into a library. | `` | +| test_factory | Use this to generate other variations of tests. | `struct(make_named_split = , make_runner_split = , make_test = , make_test_suite = , make_test_suite_splits = , make_tests = )` | | kwargs | Arguments passed to the apple_library and ios_unit_test rules as appropriate. | none | @@ -179,7 +179,7 @@ ios_unit_snapshot_test(name, name, apple_library, test_factory, kwargs) - Builds and packages iOS Unit Tests. +Builds and packages iOS Unit Tests. **PARAMETERS** @@ -187,8 +187,8 @@ ios_unit_test(name, name | The name of the unit test. | none | -| apple_library | The macro used to package sources into a library. | <function apple_library> | -| test_factory | Use this to generate other variations of tests. | struct(make_named_split = <function _make_named_split>, make_runner_split = <function _make_runner_split>, make_test = <function _make_test>, make_test_suite = <function _make_test_suite>, make_test_suite_splits = <function _make_test_suite_splits>, make_tests = <function _make_tests>) | +| apple_library | The macro used to package sources into a library. | `` | +| test_factory | Use this to generate other variations of tests. | `struct(make_named_split = , make_runner_split = , make_test = , make_test_suite = , make_test_suite_splits = , make_tests = )` | | kwargs | Arguments passed to the apple_library and ios_unit_test rules as appropriate. | none | diff --git a/docs/vfs_overlay_doc.md b/docs/vfs_overlay_doc.md new file mode 100755 index 000000000..d86cb6d46 --- /dev/null +++ b/docs/vfs_overlay_doc.md @@ -0,0 +1,59 @@ + + + + + + +## framework_vfs_overlay + +
+framework_vfs_overlay(name, deps, hdrs, extra_search_paths, framework_name, has_swift, modulemap,
+                      private_hdrs, swiftmodules)
+
+ + + +**ATTRIBUTES** + + +| Name | Description | Type | Mandatory | Default | +| :------------- | :------------- | :------------- | :------------- | :------------- | +| name | A unique name for this target. | Name | required | | +| deps | - | List of labels | optional | `[]` | +| hdrs | - | List of labels | optional | `[]` | +| extra_search_paths | - | String | optional | `""` | +| framework_name | - | String | required | | +| has_swift | Set to True only if there are Swift source files | Boolean | optional | `False` | +| modulemap | - | Label | optional | `None` | +| private_hdrs | - | List of labels | optional | `[]` | +| swiftmodules | Everything under a .swiftmodule dir if exists | List of labels | optional | `[]` | + + + + +## make_vfsoverlay + +
+make_vfsoverlay(ctx, hdrs, module_map, private_hdrs, has_swift, swiftmodules, merge_vfsoverlays,
+                extra_search_paths, output, framework_name)
+
+ + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| ctx |

-

| none | +| hdrs |

-

| none | +| module_map |

-

| none | +| private_hdrs |

-

| none | +| has_swift |

-

| none | +| swiftmodules |

-

| `[]` | +| merge_vfsoverlays |

-

| `[]` | +| extra_search_paths |

-

| `None` | +| output |

-

| `None` | +| framework_name |

-

| `None` | + + diff --git a/docs/xcconfig_doc.md b/docs/xcconfig_doc.md new file mode 100755 index 000000000..6f74a5342 --- /dev/null +++ b/docs/xcconfig_doc.md @@ -0,0 +1,86 @@ + + + + + + +## build_setting_name + +
+build_setting_name(build_setting)
+
+ +Returns the name of a given bazel build setting from the fully-qualified label + +Fails if 'build_setting' is not in the expected format + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| build_setting | The fully-qualified label for a bazel build setting, e.g., '@repo_name//path/to/package:target_name' | none | + +**RETURNS** + +The string 'target_name' in '@repo_name//path/to/package:target_name' + + + + +## copts_by_build_setting_with_defaults + +
+copts_by_build_setting_with_defaults(xcconfig, fetch_default_xcconfig, xcconfig_by_build_setting)
+
+ +Creates a struct containing different configurable copts + +Each returned copts is a 'select()' statement keyed by the bazel build settings in 'xcconfig_by_build_setting' and each +resolved value is the result of merging 'xcconfig' with the respective build setting xcconfig and applying the +default values from 'fetch_default_xcconfig' if necessary. + +For the default value to be resolved ('//conditions:default') this macro follows the same logic described above without +the 'merging' step, so 'xcconfig' plus default values from 'fetch_default_xcconfig' if necessary. + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| xcconfig | A dictionary of Xcode build settings to be converted to different `copt` attributes. | `{}` | +| fetch_default_xcconfig | A dictionary of default Xcode build settings to be applied for the keys that are not set. | `{}` | +| xcconfig_by_build_setting | A dictionary where the keys are build settings names and the values are the respective dictionaries of Xcode build settings | `{}` | + +**RETURNS** + +Struct with different copts behind 'select()' statements + + + + +## merge_xcconfigs + +
+merge_xcconfigs(xcconfigs)
+
+ +Merges a list of xcconfigs into a single dictionary + +Overrides keys from the first xcconfig with the values from the latest one if they match. + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| xcconfigs | A list of dictionaries of Xcode build settings | none | + +**RETURNS** + +A dictionary of Xcode build settings + + diff --git a/rules/BUILD.bazel b/rules/BUILD.bazel index 0c5555608..ba3ff190b 100644 --- a/rules/BUILD.bazel +++ b/rules/BUILD.bazel @@ -12,15 +12,185 @@ genrule( ) bzl_library( - name = "bzl", - srcs = [ - "app.bzl", - "extension.bzl", - "framework.bzl", - "hmap.bzl", - "library.bzl", - "test.bzl", + name = "providers", + srcs = ["providers.bzl"], + visibility = ["//visibility:public"], +) + +bzl_library( + name = "transition_support", + srcs = ["transition_support.bzl"], + visibility = ["//visibility:public"], +) + +bzl_library( + name = "hmap", + srcs = ["hmap.bzl"], + visibility = ["//visibility:public"], + deps = ["@build_bazel_rules_swift//swift"], +) + +bzl_library( + name = "features", + srcs = ["features.bzl"], + visibility = ["//visibility:public"], +) + +bzl_library( + name = "substitute_build_settings", + srcs = ["substitute_build_settings.bzl"], + visibility = ["//visibility:public"], +) + +bzl_library( + name = "force_load_direct_deps", + srcs = ["force_load_direct_deps.bzl"], + visibility = ["//visibility:public"], + deps = [":providers"], +) + +bzl_library( + name = "xcconfig.doc", + srcs = ["xcconfig.doc.bzl"], + visibility = ["//visibility:public"], + deps = ["//rules/library:xcconfig"], +) + +bzl_library( + name = "plists", + srcs = ["plists.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":substitute_build_settings", + "//rules/library:xcconfig", + "@bazel_skylib//lib:sets", + "@bazel_skylib//lib:types", + "@bazel_skylib//rules:write_file", + ], +) + +bzl_library( + name = "vfs_overlay.doc", + srcs = ["vfs_overlay.doc.bzl"], + visibility = ["//visibility:public"], + deps = ["//rules/framework:vfs_overlay"], +) + +bzl_library( + name = "precompiled_apple_resource_bundle", + srcs = ["precompiled_apple_resource_bundle.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":transition_support", + ":utils.bzl", + "@bazel_skylib//lib:partial", + "@bazel_skylib//lib:paths", + "@build_bazel_apple_support//lib:apple_support", + "@build_bazel_rules_apple//apple", + ], +) + +bzl_library( + name = "import_middleman", + srcs = ["import_middleman.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":features", + "//rules/internal:objc_provider_utils", + "@build_bazel_rules_apple//apple", + ], +) + +bzl_library( + name = "library", + srcs = ["library.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":hmap", + ":import_middleman", + ":precompiled_apple_resource_bundle", + ":utils.bzl", + "//rules/framework:vfs_overlay", + "//rules/library:resources", + "//rules/library:xcconfig", + "@bazel_skylib//lib:paths", + "@bazel_skylib//lib:selects", + "@bazel_skylib//lib:sets", + "@bazel_skylib//rules:write_file", + "@build_bazel_rules_apple//apple", + "@build_bazel_rules_apple//apple:apple_static_library", + "@build_bazel_rules_apple//apple:resources", + "@build_bazel_rules_swift//swift", + ], +) + +bzl_library( + name = "framework", + srcs = ["framework.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":features", + ":force_load_direct_deps", + ":library", + ":plists", + ":providers", + ":transition_support", + "//rules/framework:vfs_overlay", + "//rules/internal:objc_provider_utils", + "@bazel_skylib//lib:partial", + "@bazel_skylib//lib:paths", + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + "@build_bazel_rules_apple//apple", + "@build_bazel_rules_swift//swift", + ], +) + +bzl_library( + name = "app_clip", + srcs = ["app_clip.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":force_load_direct_deps", + ":plists", + "//rules/internal:framework_middleman", + "@build_bazel_rules_apple//apple:ios", + ], +) + +bzl_library( + name = "app", + srcs = ["app.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":force_load_direct_deps", + ":library", + ":plists", + "//rules/internal:framework_middleman", + "@build_bazel_rules_apple//apple:ios", ], +) + +bzl_library( + name = "extension", + srcs = ["extension.bzl"], visibility = ["//visibility:public"], - deps = ["@build_bazel_rules_apple//apple"], + deps = [ + ":force_load_direct_deps", + ":plists", + "//rules/internal:framework_middleman", + "@build_bazel_rules_apple//apple:ios", + ], +) + +bzl_library( + name = "test", + srcs = ["test.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":library", + ":plists", + "//rules/internal:framework_middleman", + "@bazel_skylib//lib:types", + "@build_bazel_rules_apple//apple:ios", + ], ) diff --git a/rules/features.bzl b/rules/features.bzl index 64d21e594..8e261d8e9 100644 --- a/rules/features.bzl +++ b/rules/features.bzl @@ -1,3 +1,19 @@ +""" +Defines features specific to rules_ios + +- `apple.virtualize_frameworks` + - Virtualize means that swift,clang read from llvm's in-memory file system + +- `xcode.compile_with_xcode` + - Some of the rules need to work sligntly differently under pure Xcode mode + +- `apple.arm64_simulator_use_device_deps` + - Use the ARM deps for the simulator - see rules/import_middleman.bzl + +- `swift.swift_disable_import_underlying_module` + - When set disable passing the `-import-underlying-module` copt to `swift_library` targets +""" + feature_names = struct( # Virtualize means that swift,clang read from llvm's in-memory file system virtualize_frameworks = "apple.virtualize_frameworks", diff --git a/rules/framework/BUILD.bazel b/rules/framework/BUILD.bazel index f22529b26..5db75a589 100644 --- a/rules/framework/BUILD.bazel +++ b/rules/framework/BUILD.bazel @@ -1,7 +1,20 @@ load("@rules_python//python:defs.bzl", "py_binary") +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") py_binary( name = "framework_packaging", srcs = ["framework_packaging.py"], visibility = ["//visibility:public"], ) + +bzl_library( + name = "vfs_overlay", + srcs = ["vfs_overlay.bzl"], + visibility = ["//rules:__pkg__"], + deps = [ + "//rules:features", + "//rules:providers", + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + "@build_bazel_rules_swift//swift", + ], +) diff --git a/rules/internal/BUILD.bazel b/rules/internal/BUILD.bazel index e69de29bb..7c6d1528d 100644 --- a/rules/internal/BUILD.bazel +++ b/rules/internal/BUILD.bazel @@ -0,0 +1,18 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + +bzl_library( + name = "objc_provider_utils", + srcs = ["objc_provider_utils.bzl"], + visibility = ["//rules:__pkg__"], +) + +bzl_library( + name = "framework_middleman", + srcs = ["framework_middleman.bzl"], + visibility = ["//rules:__pkg__"], + deps = [ + ":objc_provider_utils", + "@bazel_skylib//lib:partial", + "@build_bazel_rules_apple//apple", + ], +) diff --git a/rules/library.bzl b/rules/library.bzl index 8301aa668..db84353a9 100644 --- a/rules/library.bzl +++ b/rules/library.bzl @@ -4,7 +4,7 @@ load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:sets.bzl", "sets") load("@bazel_skylib//lib:selects.bzl", "selects") load("@bazel_skylib//rules:write_file.bzl", "write_file") -load("@build_bazel_rules_apple//apple:apple.bzl", "apple_dynamic_framework_import", "apple_static_framework_import") +load("@build_bazel_rules_apple//apple/internal:apple_framework_import.bzl", "apple_dynamic_framework_import", "apple_static_framework_import") load("@build_bazel_rules_apple//apple/internal/resource_rules:apple_intent_library.bzl", "apple_intent_library") load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") load("//rules:precompiled_apple_resource_bundle.bzl", "precompiled_apple_resource_bundle") diff --git a/rules/library/BUILD.bazel b/rules/library/BUILD.bazel index 8c6ad0682..69d8263c0 100644 --- a/rules/library/BUILD.bazel +++ b/rules/library/BUILD.bazel @@ -1,4 +1,24 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + exports_files([ "common.pch", "resource_bundle.plist", ]) + +bzl_library( + name = "xcconfig", + srcs = ["xcconfig.bzl"], + visibility = ["//rules:__pkg__"], + deps = [ + "//data:xcspecs", + "@bazel_skylib//lib:dicts", + "@bazel_skylib//lib:shell", + "@bazel_skylib//lib:types", + ], +) + +bzl_library( + name = "resources", + srcs = ["resources.bzl"], + visibility = ["//rules:__pkg__"], +) diff --git a/rules/library/xcconfig.bzl b/rules/library/xcconfig.bzl index 8f37ea0d3..c3e47705a 100644 --- a/rules/library/xcconfig.bzl +++ b/rules/library/xcconfig.bzl @@ -257,6 +257,7 @@ def build_setting_name(build_setting): Args: build_setting: The fully-qualified label for a bazel build setting, e.g., '@repo_name//path/to/package:target_name' + Returns: The string 'target_name' in '@repo_name//path/to/package:target_name' """ @@ -284,6 +285,7 @@ def copts_by_build_setting_with_defaults(xcconfig = {}, fetch_default_xcconfig = to be applied for the keys that are not set. xcconfig_by_build_setting: A dictionary where the keys are build settings names and the values are the respective dictionaries of Xcode build settings + Returns: Struct with different copts behind 'select()' statements """ @@ -333,6 +335,7 @@ def merge_xcconfigs(*xcconfigs): Args: *xcconfigs: A list of dictionaries of Xcode build settings + Returns: A dictionary of Xcode build settings """ diff --git a/rules/vfs_overlay.doc.bzl b/rules/vfs_overlay.doc.bzl new file mode 100644 index 000000000..ec7a28e51 --- /dev/null +++ b/rules/vfs_overlay.doc.bzl @@ -0,0 +1,8 @@ +load( + "//rules/framework:vfs_overlay.bzl", + _framework_vfs_overlay = "framework_vfs_overlay", + _make_vfsoverlay = "make_vfsoverlay", +) + +framework_vfs_overlay = _framework_vfs_overlay +make_vfsoverlay = _make_vfsoverlay diff --git a/rules/xcconfig.doc.bzl b/rules/xcconfig.doc.bzl new file mode 100644 index 000000000..30367e168 --- /dev/null +++ b/rules/xcconfig.doc.bzl @@ -0,0 +1,10 @@ +load( + "//rules/library:xcconfig.bzl", + _build_setting_name = "build_setting_name", + _copts_by_build_setting_with_defaults = "copts_by_build_setting_with_defaults", + _merge_xcconfigs = "merge_xcconfigs", +) + +build_setting_name = _build_setting_name +copts_by_build_setting_with_defaults = _copts_by_build_setting_with_defaults +merge_xcconfigs = _merge_xcconfigs