diff --git a/.bazelrc b/.bazelrc index bff0e9e..0efca15 100644 --- a/.bazelrc +++ b/.bazelrc @@ -92,6 +92,8 @@ build:ci --progress_report_interval=60 build:ci --verbose_failures # ci setup for tests, tend to be more flaky on github actions build:ci --jobs=4 +# Sets alwayslink to True in objc_library and objc_import +build:ci --incompatible_objc_alwayslink_by_default # allow extra time for simulators to boot test:ci --test_env=STARTUP_TIMEOUT_SEC=350 test:ci --test_timeout=1000 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2d39b22..f782271 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: XCODE_VERSION: ${{ matrix.xcode_version }} USE_BAZEL_VERSION: ${{ matrix.bazel_version }} LATEST_RULES_SWIFT_VERSION: 2.1.1 - LATEST_RULES_APPLE_VERSION: 3.8.0 + LATEST_RULES_APPLE_VERSION: 3.15.0 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 diff --git a/MODULE.bazel b/MODULE.bazel index c11671f..59be73b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -22,12 +22,12 @@ bazel_dep( ) bazel_dep( name = "rules_apple", - version = "3.5.1", + version = "3.15.0", repo_name = "build_bazel_rules_apple", ) bazel_dep( name = "rules_cc", - version = "0.0.6", + version = "0.0.10", ) bazel_dep( name = "rules_swift", diff --git a/README.md b/README.md index 311cfe7..08be30f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ See the following table for supported rules_apple release versions. | rules_apple release | Minimum supported rules version | Final supported rules version |:-------------------:|:-------------------------:|:-------------------------: -| 3.5.1 | 4.3.1 | current +| 3.15.0 | 5.3.0 | current | 3.* | 3.* | 4.2.1 | 2.* | 2.* | 3.2.2 | 1.* | 1.0.0 | 3.2.2 diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 2dbbc1c..b553aa2 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -14,7 +14,6 @@ _DOC_SRCS = [ "import_middleman", "library", "plists", - "force_load_direct_deps", "precompiled_apple_resource_bundle", "providers", "substitute_build_settings", diff --git a/docs/app_clip_doc.md b/docs/app_clip_doc.md index 880d7f9..0f2fb9b 100755 --- a/docs/app_clip_doc.md +++ b/docs/app_clip_doc.md @@ -7,6 +7,8 @@ ## ios_app_clip
+load("@rules_ios//rules:app_clip.bzl", "ios_app_clip") + ios_app_clip(name, families, infoplists, infoplists_by_build_setting, xcconfig, xcconfig_by_build_setting, kwargs)diff --git a/docs/app_doc.md b/docs/app_doc.md index 8e64f75..e247139 100755 --- a/docs/app_doc.md +++ b/docs/app_doc.md @@ -7,6 +7,8 @@ ## ios_application
+load("@rules_ios//rules:app.bzl", "ios_application") + ios_application(name, families, apple_library, infoplists, infoplists_by_build_setting, xcconfig, xcconfig_by_build_setting, kwargs)diff --git a/docs/extension_doc.md b/docs/extension_doc.md index 6013b9d..27a5ee8 100755 --- a/docs/extension_doc.md +++ b/docs/extension_doc.md @@ -7,6 +7,8 @@ ## ios_extension
+load("@rules_ios//rules:extension.bzl", "ios_extension") + ios_extension(name, families, infoplists, infoplists_by_build_setting, xcconfig, xcconfig_by_build_setting, kwargs)diff --git a/docs/force_load_direct_deps_doc.md b/docs/force_load_direct_deps_doc.md deleted file mode 100755 index fc9fa68..0000000 --- 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/framework_doc.md b/docs/framework_doc.md index 1d5ae76..1566020 100755 --- a/docs/framework_doc.md +++ b/docs/framework_doc.md @@ -7,6 +7,8 @@ Framework rules ## apple_framework_packaging
+load("@rules_ios//rules:framework.bzl", "apple_framework_packaging") + 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, @@ -49,6 +51,8 @@ Packages compiled code into an Apple .framework package ## apple_framework@@ -47,6 +51,8 @@ default_test_factory.make_runner_split(name, test_rule, kwargs) @@ -67,6 +73,8 @@ Helper to create an individual test ## default_test_factory.make_test_suite+load("@rules_ios//rules:framework.bzl", "apple_framework") + apple_framework(name, apple_library, infoplists, infoplists_by_build_setting, xcconfig, xcconfig_by_build_setting, kwargs)diff --git a/docs/hmap_doc.md b/docs/hmap_doc.md index e28067d..9898e86 100755 --- a/docs/hmap_doc.md +++ b/docs/hmap_doc.md @@ -7,6 +7,8 @@ Header Map rules ## headermap+load("@rules_ios//rules:hmap.bzl", "headermap") + headermap(name, hdrs, direct_hdr_providers, namespace)@@ -32,6 +34,8 @@ regardless of the package structure being used. ## HeaderMapInfo+load("@rules_ios//rules:hmap.bzl", "HeaderMapInfo") + HeaderMapInfo(files)@@ -39,7 +43,6 @@ Propagates header maps **FIELDS** - | Name | Description | | :------------- | :------------- | | files | depset with headermaps | @@ -50,6 +53,8 @@ Propagates header maps ## hmap.make_hmap+load("@rules_ios//rules:hmap.bzl", "hmap") + hmap.make_hmap(actions, headermap_builder, output, namespace, hdrs_lists)diff --git a/docs/import_middleman_doc.md b/docs/import_middleman_doc.md index 1cfcf4b..235fc36 100755 --- a/docs/import_middleman_doc.md +++ b/docs/import_middleman_doc.md @@ -7,6 +7,8 @@ ## import_middleman+load("@rules_ios//rules:import_middleman.bzl", "import_middleman") + import_middleman(name, deps, test_deps, update_in_place)@@ -50,6 +52,8 @@ can be updated to work without the other behavior ## find_imports+load("@rules_ios//rules:import_middleman.bzl", "find_imports") + find_imports(name)diff --git a/docs/library_doc.md b/docs/library_doc.md index 1a9790f..e8f0bfc 100755 --- a/docs/library_doc.md +++ b/docs/library_doc.md @@ -7,6 +7,8 @@ Library rules ## extend_modulemap+load("@rules_ios//rules:library.bzl", "extend_modulemap") + extend_modulemap(name, destination, module_name, source, swift_header)@@ -29,6 +31,8 @@ Extends a modulemap with a Swift submodule ## PrivateHeadersInfo+load("@rules_ios//rules:library.bzl", "PrivateHeadersInfo") + PrivateHeadersInfo(headers)@@ -36,7 +40,6 @@ Propagates private headers, so they can be accessed if necessary **FIELDS** - | Name | Description | | :------------- | :------------- | | headers | Private headers | @@ -47,6 +50,8 @@ Propagates private headers, so they can be accessed if necessary ## apple_library+load("@rules_ios//rules:library.bzl", "apple_library") + apple_library(name, library_tools, export_private_headers, namespace_is_module_name, default_xcconfig_name, xcconfig, xcconfig_by_build_setting, objc_defines, swift_defines, kwargs) diff --git a/docs/plists_doc.md b/docs/plists_doc.md index 67110b1..e38cd86 100755 --- a/docs/plists_doc.md +++ b/docs/plists_doc.md @@ -7,6 +7,8 @@ Defines macros for working with plist files. ## process_infoplists- - **FIELDS** - | Name | Description | | :------------- | :------------- | | vfsoverlay_infos | Merged VFS overlay infos, present when virtual frameworks enabled | diff --git a/docs/substitute_build_settings_doc.md b/docs/substitute_build_settings_doc.md index 055e189..367596f 100755 --- a/docs/substitute_build_settings_doc.md +++ b/docs/substitute_build_settings_doc.md @@ -7,6 +7,8 @@ ## substitute_build_settings+load("@rules_ios//rules:plists.bzl", "process_infoplists") + process_infoplists(name, infoplists, infoplists_by_build_setting, xcconfig, xcconfig_by_build_setting)@@ -34,6 +36,8 @@ A selectable dict of the substituted_plists grouped by config_setting ## substituted_plist+load("@rules_ios//rules:plists.bzl", "substituted_plist") + substituted_plist(name, plist, xcconfig)@@ -58,6 +62,8 @@ The plist target with the substituted variables. ## write_info_plists_if_needed+load("@rules_ios//rules:plists.bzl", "write_info_plists_if_needed") + write_info_plists_if_needed(name, plists)diff --git a/docs/precompiled_apple_resource_bundle_doc.md b/docs/precompiled_apple_resource_bundle_doc.md index f9c8db6..278ae41 100755 --- a/docs/precompiled_apple_resource_bundle_doc.md +++ b/docs/precompiled_apple_resource_bundle_doc.md @@ -11,6 +11,8 @@ if this is ever fixed in bazel it should be removed ## precompiled_apple_resource_bundle+load("@rules_ios//rules:precompiled_apple_resource_bundle.bzl", "precompiled_apple_resource_bundle") + precompiled_apple_resource_bundle(kwargs)diff --git a/docs/providers_doc.md b/docs/providers_doc.md index 84541ee..f4494ac 100755 --- a/docs/providers_doc.md +++ b/docs/providers_doc.md @@ -7,14 +7,13 @@ ## AvoidDepsInfo+load("@rules_ios//rules:providers.bzl", "AvoidDepsInfo") + AvoidDepsInfo(libraries, link_dynamic)- - **FIELDS** - | Name | Description | | :------------- | :------------- | | libraries | Libraries to avoid | @@ -26,14 +25,13 @@ AvoidDepsInfo(libraries, vfsoverlay_infos, binary, headers, private_headers, modulemap, swiftmodule, swiftdoc)+load("@rules_ios//rules:substitute_build_settings.bzl", "substitute_build_settings") + substitute_build_settings(name, source, variables)diff --git a/docs/test_doc.md b/docs/test_doc.md index 78c2876..4d6c53b 100755 --- a/docs/test_doc.md +++ b/docs/test_doc.md @@ -7,6 +7,8 @@ ## default_test_factory.make_named_split+load("@rules_ios//rules:test.bzl", "default_test_factory") + default_test_factory.make_named_split(name, split_kwargs, in_split)@@ -27,6 +29,8 @@ default_test_factory.make_named_split(name, runner, in_split)
+load("@rules_ios//rules:test.bzl", "default_test_factory") + default_test_factory.make_test_suite(factory, name, test_rule, test_kwargs)@@ -88,6 +96,8 @@ default_test_factory.make_test_suite(factory, name, in_kwargs) @@ -113,6 +123,8 @@ Finally - you can set the splits to be whatever you want. ## default_test_factory.make_tests
+load("@rules_ios//rules:test.bzl", "default_test_factory") + default_test_factory.make_tests(factory, name, test_rule, kwargs)@@ -134,6 +146,8 @@ Main entry point of generating tests" ## ios_ui_test
+load("@rules_ios//rules:test.bzl", "ios_ui_test") + ios_ui_test(name, apple_library, test_factory, kwargs)@@ -155,6 +169,8 @@ Builds and packages iOS UI Tests. ## ios_unit_snapshot_test
+load("@rules_ios//rules:test.bzl", "ios_unit_snapshot_test") + ios_unit_snapshot_test(name, apple_library, test_factory, kwargs)@@ -176,6 +192,8 @@ Builds and packages iOS Unit Snapshot Tests. ## ios_unit_test
+load("@rules_ios//rules:test.bzl", "ios_unit_test") + ios_unit_test(name, apple_library, test_factory, kwargs)diff --git a/docs/transition_support_doc.md b/docs/transition_support_doc.md index 1529501..c71c9ca 100755 --- a/docs/transition_support_doc.md +++ b/docs/transition_support_doc.md @@ -23,6 +23,8 @@ part on the language used for XCFramework library identifiers: ## transition_support.current_apple_platform
+load("@rules_ios//rules:transition_support.bzl", "transition_support") + transition_support.current_apple_platform(apple_fragment, xcode_config)diff --git a/docs/vfs_overlay_doc.md b/docs/vfs_overlay_doc.md index d86cb6d..87f4bec 100755 --- a/docs/vfs_overlay_doc.md +++ b/docs/vfs_overlay_doc.md @@ -7,6 +7,8 @@ ## framework_vfs_overlay
+load("@rules_ios//rules:vfs_overlay.doc.bzl", "framework_vfs_overlay") + framework_vfs_overlay(name, deps, hdrs, extra_search_paths, framework_name, has_swift, modulemap, private_hdrs, swiftmodules)@@ -34,6 +36,8 @@ framework_vfs_overlay(name, ctx, hdrs, module_map, private_hdrs, has_swift, swiftmodules, merge_vfsoverlays, extra_search_paths, output, framework_name) diff --git a/docs/xcconfig_doc.md b/docs/xcconfig_doc.md index 6f74a53..fa1577e 100755 --- a/docs/xcconfig_doc.md +++ b/docs/xcconfig_doc.md @@ -7,6 +7,8 @@ ## build_setting_name
+load("@rules_ios//rules:xcconfig.doc.bzl", "build_setting_name") + build_setting_name(build_setting)@@ -32,6 +34,8 @@ The string 'target_name' in '@repo_name//path/to/package:target_name' ## copts_by_build_setting_with_defaults
+load("@rules_ios//rules:xcconfig.doc.bzl", "copts_by_build_setting_with_defaults") + copts_by_build_setting_with_defaults(xcconfig, fetch_default_xcconfig, xcconfig_by_build_setting)@@ -64,6 +68,8 @@ Struct with different copts behind 'select()' statements ## merge_xcconfigs
+load("@rules_ios//rules:xcconfig.doc.bzl", "merge_xcconfigs") + merge_xcconfigs(xcconfigs)diff --git a/rules/BUILD.bazel b/rules/BUILD.bazel index 8e48c04..803c4f4 100644 --- a/rules/BUILD.bazel +++ b/rules/BUILD.bazel @@ -46,17 +46,6 @@ bzl_library( visibility = ["//visibility:public"], ) -bzl_library( - name = "force_load_direct_deps", - srcs = ["force_load_direct_deps.bzl"], - visibility = ["//visibility:public"], - deps = [ - ":providers", - ":transition_support", - "@bazel_skylib//lib:dicts", - ], -) - bzl_library( name = "xcconfig.doc", srcs = ["xcconfig.doc.bzl"], @@ -139,7 +128,6 @@ bzl_library( visibility = ["//visibility:public"], deps = [ ":features", - ":force_load_direct_deps", ":library", ":plists", ":providers", @@ -159,7 +147,6 @@ bzl_library( srcs = ["app_clip.bzl"], visibility = ["//visibility:public"], deps = [ - ":force_load_direct_deps", ":plists", "//rules/internal:framework_middleman", "@build_bazel_rules_apple//apple:ios", @@ -171,7 +158,6 @@ bzl_library( srcs = ["app.bzl"], visibility = ["//visibility:public"], deps = [ - ":force_load_direct_deps", ":library", ":plists", "//rules/internal:framework_middleman", @@ -184,7 +170,6 @@ bzl_library( srcs = ["extension.bzl"], visibility = ["//visibility:public"], deps = [ - ":force_load_direct_deps", ":plists", ":transition_support", "//rules/internal:framework_middleman", diff --git a/rules/app.bzl b/rules/app.bzl index 52b950e..b92ca8f 100644 --- a/rules/app.bzl +++ b/rules/app.bzl @@ -1,7 +1,6 @@ load("@build_bazel_rules_apple//apple:ios.bzl", rules_apple_ios_application = "ios_application") load("//rules:library.bzl", "apple_library") load("//rules:plists.bzl", "process_infoplists") -load("//rules:force_load_direct_deps.bzl", "force_load_direct_deps") load("//rules/internal:framework_middleman.bzl", "dep_middleman", "framework_middleman") # We need to try and partition out arguments for obj_library / swift_library @@ -93,17 +92,6 @@ def ios_application( application_kwargs["launch_storyboard"] = application_kwargs.pop("launch_storyboard", library.launch_screen_storyboard_name) - # Setup force loading here - need to process deps and libs - force_load_name = name + ".force_load_direct_deps" - force_load_direct_deps( - name = force_load_name, - deps = kwargs.get("deps", []) + library.lib_names, - tags = ["manual"], - testonly = testonly, - platform_type = "ios", - minimum_os_version = application_kwargs.get("minimum_os_version"), - ) - # Setup framework middlemen - need to process deps and libs fw_name = name + ".framework_middleman" framework_middleman( @@ -125,8 +113,7 @@ def ios_application( platform_type = "ios", minimum_os_version = application_kwargs.get("minimum_os_version"), ) - deps = [dep_name] + [force_load_name] - + deps = [dep_name] processed_infoplists = process_infoplists( name = name, infoplists = infoplists, diff --git a/rules/app_clip.bzl b/rules/app_clip.bzl index 05fd0bf..33fcecc 100644 --- a/rules/app_clip.bzl +++ b/rules/app_clip.bzl @@ -1,6 +1,5 @@ load("@build_bazel_rules_apple//apple:ios.bzl", rules_apple_ios_app_clip = "ios_app_clip") load("//rules:plists.bzl", "process_infoplists") -load("//rules:force_load_direct_deps.bzl", "force_load_direct_deps") load("//rules/internal:framework_middleman.bzl", "dep_middleman", "framework_middleman") def ios_app_clip( @@ -43,15 +42,6 @@ def ios_app_clip( frameworks = kwargs.pop("frameworks", []) testonly = kwargs.pop("testonly", False) - # Setup force loading here - need to process deps and libs - force_load_name = name + ".force_load_direct_deps" - force_load_direct_deps( - name = force_load_name, - deps = deps, - tags = ["manual"], - testonly = testonly, - ) - # Setup framework middlemen - need to process deps and libs fw_name = name + ".framework_middleman" framework_middleman( @@ -69,7 +59,7 @@ def ios_app_clip( tags = ["manual"], testonly = testonly, ) - deps = [dep_name] + [force_load_name] + deps = [dep_name] processed_infoplists = process_infoplists( name = name, diff --git a/rules/extension.bzl b/rules/extension.bzl index 0607cdc..dc20ae4 100644 --- a/rules/extension.bzl +++ b/rules/extension.bzl @@ -1,6 +1,5 @@ load("@build_bazel_rules_apple//apple:ios.bzl", rules_apple_ios_extension = "ios_extension") load("//rules:plists.bzl", "process_infoplists") -load("//rules:force_load_direct_deps.bzl", "force_load_direct_deps") load("//rules/internal:framework_middleman.bzl", "dep_middleman", "framework_middleman") def ios_extension( @@ -45,15 +44,6 @@ def ios_extension( frameworks = kwargs.pop("frameworks", []) testonly = kwargs.pop("testonly", False) - # Setup force loading here - need to process deps and libs - force_load_name = name + ".force_load_direct_deps" - force_load_direct_deps( - name = force_load_name, - deps = deps, - tags = ["manual"], - testonly = testonly, - ) - # Setup framework middlemen - need to process deps and libs fw_name = name + ".framework_middleman" framework_middleman( @@ -72,7 +62,7 @@ def ios_extension( tags = ["manual"], testonly = testonly, ) - deps = [dep_name] + [force_load_name] + deps = [dep_name] processed_infoplists = process_infoplists( name = name, diff --git a/rules/force_load_direct_deps.bzl b/rules/force_load_direct_deps.bzl index ec7aaf9..f7443cb 100644 --- a/rules/force_load_direct_deps.bzl +++ b/rules/force_load_direct_deps.bzl @@ -35,142 +35,3 @@ def _cc_info_static_libraries(dep): static_cc_libraries.append(library_to_link.static_library) return static_cc_libraries - -# TODO: We should deprecate this rule for Bazel 7+ as `--incompatible_objc_alwayslink_by_default` effectively -# does the same thing. -def _force_load_direct_deps_impl(ctx): - """This rule will traverse the direct deps of the target and force load the static libraries of the objc deps. - """ - - if not ctx.attr.should_force_load: - return [ - apple_common.new_objc_provider(), - CcInfo(), - ] - - force_load_libraries = [] - force_load_cc_libraries = [] - avoid_deps = [] - avoid_libraries = {} - avoid_cc_libraries = {} - cc_toolchain = find_cpp_toolchain(ctx) - cc_features = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - language = "objc", - ) - - # Set the deps that should be avoided and not linked. - for dep in ctx.attr.deps: - if AvoidDepsInfo in dep: - avoid_deps.extend(dep[AvoidDepsInfo].libraries) - - # Collect the libraries that should be avoided. - for dep in avoid_deps: - for lib in _objc_provider_static_libraries(dep): - avoid_libraries[lib] = True - for lib in _cc_info_static_libraries(dep): - avoid_cc_libraries[lib] = True - - # Collect the libraries that should be force loaded. - for dep in ctx.attr.deps: - for lib in _objc_provider_static_libraries(dep): - if not lib in avoid_libraries: - force_load_libraries.append(lib) - for lib in _cc_info_static_libraries(dep): - if not lib in avoid_cc_libraries: - force_load_cc_libraries.append(lib) - - return [ - apple_common.new_objc_provider( - force_load_library = depset(force_load_libraries), - link_inputs = depset(force_load_libraries), - ), - CcInfo( - linking_context = cc_common.create_linking_context( - linker_inputs = depset([ - cc_common.create_linker_input( - owner = ctx.label, - libraries = depset([ - cc_common.create_library_to_link( - actions = ctx.actions, - cc_toolchain = cc_toolchain, - feature_configuration = cc_features, - static_library = library, - alwayslink = True, - ) - for library in force_load_cc_libraries - ]), - ), - ]), - ), - ), - ] - -force_load_direct_deps = rule( - implementation = _force_load_direct_deps_impl, - toolchains = use_cpp_toolchain(), - fragments = ["apple", "cpp", "objc"], - attrs = { - "deps": attr.label_list( - cfg = transition_support.apple_platform_split_transition, - mandatory = True, - doc = - "Deps", - ), - "should_force_load": attr.bool( - default = True, - doc = "Allows parametrically enabling the functionality in this rule.", - ), - "platform_type": attr.string( - mandatory = False, - doc = - """Internal - currently rules_ios uses the dict `platforms` -""", - ), - "minimum_os_version": attr.string( - mandatory = False, - doc = - """Internal - currently rules_ios the dict `platforms` -""", - ), - "_allowlist_function_transition": attr.label( - default = "@bazel_tools//tools/allowlists/function_transition_allowlist", - doc = "Needed to allow this rule to have an incoming edge configuration transition.", - ), - "_cc_toolchain": attr.label( - providers = [cc_common.CcToolchainInfo], - default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"), - doc = """\ -The C++ toolchain from which linking flags and other tools needed by the Swift -toolchain (such as `clang`) will be retrieved. -""", - ), - }, - doc = """ -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. - - """, -) diff --git a/rules/framework.bzl b/rules/framework.bzl index 420824b..c0b6219 100644 --- a/rules/framework.bzl +++ b/rules/framework.bzl @@ -32,7 +32,6 @@ load( "@build_bazel_rules_apple//apple/internal/aspects:resource_aspect.bzl", "apple_resource_aspect", ) -load("//rules:force_load_direct_deps.bzl", "force_load_direct_deps") load("//rules:header_paths.bzl", "header_paths") _APPLE_FRAMEWORK_PACKAGING_KWARGS = [ @@ -168,21 +167,6 @@ def apple_framework( "//conditions:default": "", }) - # Setup force loading here - only for direct deps / direct libs and when `link_dynamic` is set. - should_force_load = framework_packaging_kwargs.get("link_dynamic", False) - if should_force_load: - force_load_name = name + ".force_load_direct_deps" - force_load_direct_deps( - name = force_load_name, - deps = kwargs.get("deps", []) + library.lib_names, - should_force_load = should_force_load, - testonly = testonly, - tags = ["manual"], - minimum_os_version = minimum_os_version, - platform_type = platform_type, - ) - framework_deps.append(force_load_name) - framework_deps += library.lib_names apple_framework_packaging( name = name, @@ -944,7 +928,6 @@ def _bundle_dynamic_framework(ctx, is_extension_safe, avoid_deps): cc_features = cc_features, cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, - objc_provider = link_result.objc, rule_label = label, ), ) diff --git a/rules/import_middleman.bzl b/rules/import_middleman.bzl index 80ea397..da8681a 100644 --- a/rules/import_middleman.bzl +++ b/rules/import_middleman.bzl @@ -95,15 +95,6 @@ def _find_imports_impl(target, ctx): if ctx.rule.kind == "objc_import": imported_library_file.append(target[apple_common.Objc].imported_library) - elif AppleFrameworkImportInfo in target: - static_framework_file.append(target[apple_common.Objc].imported_library) - target_dynamic_framework_file = target[apple_common.Objc].dynamic_framework_file - target_dynamic_framework_file_list = target_dynamic_framework_file.to_list() - if len(target_dynamic_framework_file_list) > 0: - import_infos[target_dynamic_framework_file_list[0].path] = target[AppleFrameworkImportInfo] - - dynamic_framework_file.append(target_dynamic_framework_file) - return [_FindImportsAspectInfo( dynamic_framework_file = depset(transitive = dynamic_framework_file), imported_library_file = depset(transitive = imported_library_file), @@ -196,7 +187,7 @@ def _file_collector_rule_impl(ctx): ] objc_provider_fields = objc_provider_utils.merge_objc_providers_dict( - providers = [dep[apple_common.Objc] for dep in ctx.attr.deps], + providers = [], merge_keys = merge_keys, )