diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index aef9ae335..9192d86f5 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -12,10 +12,8 @@ _DOC_SRCS = [ "features", "framework", "hmap", - "import_middleman", "library", "plists", - "force_load_direct_deps", "precompiled_apple_resource_bundle", "providers", "substitute_build_settings", diff --git a/docs/force_load_direct_deps_doc.md b/docs/force_load_direct_deps_doc.md deleted file mode 100755 index fc9fa68a7..000000000 --- a/docs/force_load_direct_deps_doc.md +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - -## force_load_direct_deps - -
-force_load_direct_deps(name, deps, minimum_os_version, platform_type, 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 | Deps | List of labels | required | | -| minimum_os_version | Internal - currently rules_ios the dict `platforms` | String | optional | `""` | -| platform_type | Internal - currently rules_ios uses the dict `platforms` | String | optional | `""` | -| should_force_load | Allows parametrically enabling the functionality in this rule. | Boolean | optional | `True` | - - diff --git a/docs/import_middleman_doc.md b/docs/import_middleman_doc.md deleted file mode 100755 index a2f503f3d..000000000 --- a/docs/import_middleman_doc.md +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - -## 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/rules/BUILD.bazel b/rules/BUILD.bazel index 2fc6e9c21..708a8a486 100644 --- a/rules/BUILD.bazel +++ b/rules/BUILD.bazel @@ -23,10 +23,7 @@ bzl_library( srcs = ["transition_support.bzl"], tags = ["manual"], visibility = ["//visibility:public"], - deps = [ - "@build_bazel_apple_support//lib:apple_support", - "@rules_apple_api//:api", - ], + deps = [":bzl_srcs"], ) bzl_library( @@ -51,24 +48,12 @@ bzl_library( visibility = ["//visibility:public"], ) -bzl_library( - name = "force_load_direct_deps", - srcs = ["force_load_direct_deps.bzl"], - tags = ["manual"], - visibility = ["//visibility:public"], - deps = [ - ":providers", - ":transition_support", - "@rules_apple_api//:api", - ], -) - bzl_library( name = "xcconfig.doc", srcs = ["xcconfig.doc.bzl"], tags = ["manual"], visibility = ["//visibility:public"], - deps = ["//rules/library:xcconfig"], + deps = ["bzl_srcs"], ) bzl_library( @@ -76,13 +61,7 @@ bzl_library( srcs = ["plists.bzl"], tags = ["manual"], visibility = ["//visibility:public"], - deps = [ - ":substitute_build_settings", - "//rules/library:xcconfig", - "@bazel_skylib//lib:sets", - "@bazel_skylib//lib:types", - "@bazel_skylib//rules:write_file", - ], + deps = [":bzl_srcs"], ) bzl_library( @@ -99,25 +78,7 @@ bzl_library( tags = ["manual"], 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"], - tags = ["manual"], - visibility = ["//visibility:public"], - deps = [ - ":features", - "//rules/internal:objc_provider_utils", - "@build_bazel_rules_apple//apple", - "@rules_apple_api//:api", + ":bzl_srcs", ], ) @@ -126,24 +87,7 @@ bzl_library( srcs = ["library.bzl"], tags = ["manual"], 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", - "@rules_apple_api//:api", - ], + deps = [":bzl_srcs"], ) bzl_library( @@ -151,22 +95,7 @@ bzl_library( srcs = ["framework.bzl"], tags = ["manual"], 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", - "@rules_apple_api//:api", - ], + deps = [":bzl_srcs"], ) bzl_library( @@ -174,13 +103,7 @@ bzl_library( srcs = ["apple_patched.bzl"], tags = ["manual"], visibility = ["//visibility:public"], - deps = [ - ":features", - ":providers", - "//rules/framework:vfs_overlay", - "@build_bazel_rules_apple//apple", - "@build_bazel_rules_swift//swift", - ], + deps = [":bzl_srcs"], ) bzl_library( @@ -188,12 +111,7 @@ bzl_library( srcs = ["app_clip.bzl"], tags = ["manual"], visibility = ["//visibility:public"], - deps = [ - ":force_load_direct_deps", - ":plists", - "//rules/internal:framework_middleman", - "@build_bazel_rules_apple//apple:ios", - ], + deps = [":bzl_srcs"], ) bzl_library( @@ -201,13 +119,7 @@ bzl_library( srcs = ["app.bzl"], tags = ["manual"], visibility = ["//visibility:public"], - deps = [ - ":force_load_direct_deps", - ":library", - ":plists", - "//rules/internal:framework_middleman", - "@build_bazel_rules_apple//apple:ios", - ], + deps = [":bzl_srcs"], ) bzl_library( @@ -215,12 +127,32 @@ bzl_library( srcs = ["extension.bzl"], tags = ["manual"], visibility = ["//visibility:public"], + deps = [":bzl_srcs"], +) + +# A library for all of the bzl_srcs, to satisfy `stardoc`'s deps attribute. +bzl_library( + name = "bzl_srcs", + srcs = glob([ + "*.bzl", + "internal/*.bzl", + ]), + tags = ["manual"], + visibility = ["//visibility:public"], deps = [ - ":force_load_direct_deps", - ":plists", - ":transition_support", - "//rules/internal:framework_middleman", + "//data:xcspecs", + "//rules/framework:vfs_overlay", + "//rules/library:bzl_srcs", + "@bazel_skylib//lib:paths", + "@bazel_skylib//lib:selects", + "@bazel_skylib//lib:sets", + "@bazel_skylib//lib:types", + "@bazel_skylib//rules:write_file", + "@build_bazel_rules_apple//apple", + "@build_bazel_rules_apple//apple:apple_static_library", "@build_bazel_rules_apple//apple:ios", + "@build_bazel_rules_apple//apple:resources", + "@build_bazel_rules_swift//swift", "@rules_apple_api//:api", ], ) @@ -230,11 +162,5 @@ bzl_library( srcs = ["test.bzl"], tags = ["manual"], visibility = ["//visibility:public"], - deps = [ - ":library", - ":plists", - "//rules/internal:framework_middleman", - "@bazel_skylib//lib:types", - "@build_bazel_rules_apple//apple:ios", - ], + deps = [":bzl_srcs"], ) diff --git a/rules/internal/BUILD.bazel b/rules/internal/BUILD.bazel deleted file mode 100644 index 622a29fc3..000000000 --- a/rules/internal/BUILD.bazel +++ /dev/null @@ -1,24 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -bzl_library( - name = "objc_provider_utils", - srcs = ["objc_provider_utils.bzl"], - tags = ["manual"], - visibility = ["//rules:__pkg__"], -) - -bzl_library( - name = "framework_middleman", - srcs = ["framework_middleman.bzl"], - tags = ["manual"], - visibility = ["//rules:__pkg__"], - deps = [ - ":objc_provider_utils", - "//rules:providers", - "//rules:transition_support", - "@bazel_skylib//lib:dicts", - "@bazel_skylib//lib:partial", - "@build_bazel_rules_apple//apple", - "@rules_apple_api//:api", - ], -) diff --git a/rules/library/BUILD.bazel b/rules/library/BUILD.bazel index 084428783..db436eee6 100644 --- a/rules/library/BUILD.bazel +++ b/rules/library/BUILD.bazel @@ -6,9 +6,8 @@ exports_files([ ]) bzl_library( - name = "xcconfig", - srcs = ["xcconfig.bzl"], - tags = ["manual"], + name = "bzl_srcs", + srcs = glob(["*.bzl"]), visibility = ["//rules:__pkg__"], deps = [ "//data:xcspecs", @@ -18,9 +17,18 @@ bzl_library( ], ) +bzl_library( + name = "xcconfig", + srcs = ["xcconfig.bzl"], + tags = ["manual"], + visibility = ["//rules:__pkg__"], + deps = ["bzl_srcs"], +) + bzl_library( name = "resources", srcs = ["resources.bzl"], tags = ["manual"], visibility = ["//rules:__pkg__"], + deps = ["bzl_srcs"], )