Skip to content

Commit

Permalink
Remove references to objc_provider and remove force_load_direct_deps …
Browse files Browse the repository at this point in the history
…to support rules_apple > 3.15.0 (#934)

1) With rules_apple removing legacy objc_providers, rules_apple > 3.15.0
is no longer compatible with rules_ios due to
bazelbuild/rules_apple#2611

2) Removing force load direct deps as its no longer needed in Bazel 7
#862

```sh
ERROR: /Users/ssarad/Bazel/BUILD.bazel:3:15: in apple_framework_packaging rule 
Traceback (most recent call last):
	File "/Users/ssarad/.bazel_cache/output/external/rules_ios~/rules/framework.bzl", line 1109, column 48, in _apple_framework_packaging_impl
		bundle_outs = _bundle_dynamic_framework(ctx, is_extension_safe = is_extension_safe, avoid_deps = avoid_deps)
	File "/Users/ssarad/.bazel_cache/output/external/rules_ios~/rules/framework.bzl", line 888, column 44, in _bundle_dynamic_framework
		partials.framework_provider_partial(
	File "/Users/ssarad/.bazel_cache/output/external/rules_apple~/apple/internal/partials/framework_provider.bzl", line 94, column 5, in framework_provider_partial
		def framework_provider_partial(
Error: framework_provider_partial() got unexpected keyword argument: objc_provider

```

This PR is attempt to make rules_ios compatible with rules_apple +
remove the legacy code to force load direct deps as with Bazel 7,
`--incompatible_objc_alwayslink_by_default` does the same thing.

---------

Co-authored-by: Sarad <sarad.pant@capitalone.com>
  • Loading branch information
ssarad and ssaradp authored Jan 17, 2025
1 parent 8da30c9 commit 6aa4540
Show file tree
Hide file tree
Showing 28 changed files with 86 additions and 317 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ _DOC_SRCS = [
"import_middleman",
"library",
"plists",
"force_load_direct_deps",
"precompiled_apple_resource_bundle",
"providers",
"substitute_build_settings",
Expand Down
2 changes: 2 additions & 0 deletions docs/app_clip_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## ios_app_clip

<pre>
load("@rules_ios//rules:app_clip.bzl", "ios_app_clip")

ios_app_clip(<a href="#ios_app_clip-name">name</a>, <a href="#ios_app_clip-families">families</a>, <a href="#ios_app_clip-infoplists">infoplists</a>, <a href="#ios_app_clip-infoplists_by_build_setting">infoplists_by_build_setting</a>, <a href="#ios_app_clip-xcconfig">xcconfig</a>,
<a href="#ios_app_clip-xcconfig_by_build_setting">xcconfig_by_build_setting</a>, <a href="#ios_app_clip-kwargs">kwargs</a>)
</pre>
Expand Down
2 changes: 2 additions & 0 deletions docs/app_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## ios_application

<pre>
load("@rules_ios//rules:app.bzl", "ios_application")

ios_application(<a href="#ios_application-name">name</a>, <a href="#ios_application-families">families</a>, <a href="#ios_application-apple_library">apple_library</a>, <a href="#ios_application-infoplists">infoplists</a>, <a href="#ios_application-infoplists_by_build_setting">infoplists_by_build_setting</a>, <a href="#ios_application-xcconfig">xcconfig</a>,
<a href="#ios_application-xcconfig_by_build_setting">xcconfig_by_build_setting</a>, <a href="#ios_application-kwargs">kwargs</a>)
</pre>
Expand Down
2 changes: 2 additions & 0 deletions docs/extension_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## ios_extension

<pre>
load("@rules_ios//rules:extension.bzl", "ios_extension")

ios_extension(<a href="#ios_extension-name">name</a>, <a href="#ios_extension-families">families</a>, <a href="#ios_extension-infoplists">infoplists</a>, <a href="#ios_extension-infoplists_by_build_setting">infoplists_by_build_setting</a>, <a href="#ios_extension-xcconfig">xcconfig</a>,
<a href="#ios_extension-xcconfig_by_build_setting">xcconfig_by_build_setting</a>, <a href="#ios_extension-kwargs">kwargs</a>)
</pre>
Expand Down
48 changes: 0 additions & 48 deletions docs/force_load_direct_deps_doc.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/framework_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Framework rules
## apple_framework_packaging

<pre>
load("@rules_ios//rules:framework.bzl", "apple_framework_packaging")

apple_framework_packaging(<a href="#apple_framework_packaging-name">name</a>, <a href="#apple_framework_packaging-deps">deps</a>, <a href="#apple_framework_packaging-data">data</a>, <a href="#apple_framework_packaging-bundle_extension">bundle_extension</a>, <a href="#apple_framework_packaging-bundle_id">bundle_id</a>, <a href="#apple_framework_packaging-environment_plist">environment_plist</a>,
<a href="#apple_framework_packaging-exported_symbols_lists">exported_symbols_lists</a>, <a href="#apple_framework_packaging-framework_name">framework_name</a>, <a href="#apple_framework_packaging-frameworks">frameworks</a>, <a href="#apple_framework_packaging-infoplists">infoplists</a>,
<a href="#apple_framework_packaging-library_linkopts">library_linkopts</a>, <a href="#apple_framework_packaging-link_dynamic">link_dynamic</a>, <a href="#apple_framework_packaging-minimum_deployment_os_version">minimum_deployment_os_version</a>,
Expand Down Expand Up @@ -49,6 +51,8 @@ Packages compiled code into an Apple .framework package
## apple_framework

<pre>
load("@rules_ios//rules:framework.bzl", "apple_framework")

apple_framework(<a href="#apple_framework-name">name</a>, <a href="#apple_framework-apple_library">apple_library</a>, <a href="#apple_framework-infoplists">infoplists</a>, <a href="#apple_framework-infoplists_by_build_setting">infoplists_by_build_setting</a>, <a href="#apple_framework-xcconfig">xcconfig</a>,
<a href="#apple_framework-xcconfig_by_build_setting">xcconfig_by_build_setting</a>, <a href="#apple_framework-kwargs">kwargs</a>)
</pre>
Expand Down
7 changes: 6 additions & 1 deletion docs/hmap_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Header Map rules
## headermap

<pre>
load("@rules_ios//rules:hmap.bzl", "headermap")

headermap(<a href="#headermap-name">name</a>, <a href="#headermap-hdrs">hdrs</a>, <a href="#headermap-direct_hdr_providers">direct_hdr_providers</a>, <a href="#headermap-namespace">namespace</a>)
</pre>

Expand All @@ -32,14 +34,15 @@ regardless of the package structure being used.
## HeaderMapInfo

<pre>
load("@rules_ios//rules:hmap.bzl", "HeaderMapInfo")

HeaderMapInfo(<a href="#HeaderMapInfo-files">files</a>)
</pre>

Propagates header maps

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="HeaderMapInfo-files"></a>files | depset with headermaps |
Expand All @@ -50,6 +53,8 @@ Propagates header maps
## hmap.make_hmap

<pre>
load("@rules_ios//rules:hmap.bzl", "hmap")

hmap.make_hmap(<a href="#hmap.make_hmap-actions">actions</a>, <a href="#hmap.make_hmap-headermap_builder">headermap_builder</a>, <a href="#hmap.make_hmap-output">output</a>, <a href="#hmap.make_hmap-namespace">namespace</a>, <a href="#hmap.make_hmap-hdrs_lists">hdrs_lists</a>)
</pre>

Expand Down
4 changes: 4 additions & 0 deletions docs/import_middleman_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## import_middleman

<pre>
load("@rules_ios//rules:import_middleman.bzl", "import_middleman")

import_middleman(<a href="#import_middleman-name">name</a>, <a href="#import_middleman-deps">deps</a>, <a href="#import_middleman-test_deps">test_deps</a>, <a href="#import_middleman-update_in_place">update_in_place</a>)
</pre>

Expand Down Expand Up @@ -50,6 +52,8 @@ can be updated to work without the other behavior
## find_imports

<pre>
load("@rules_ios//rules:import_middleman.bzl", "find_imports")

find_imports(<a href="#find_imports-name">name</a>)
</pre>

Expand Down
7 changes: 6 additions & 1 deletion docs/library_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Library rules
## extend_modulemap

<pre>
load("@rules_ios//rules:library.bzl", "extend_modulemap")

extend_modulemap(<a href="#extend_modulemap-name">name</a>, <a href="#extend_modulemap-destination">destination</a>, <a href="#extend_modulemap-module_name">module_name</a>, <a href="#extend_modulemap-source">source</a>, <a href="#extend_modulemap-swift_header">swift_header</a>)
</pre>

Expand All @@ -29,14 +31,15 @@ Extends a modulemap with a Swift submodule
## PrivateHeadersInfo

<pre>
load("@rules_ios//rules:library.bzl", "PrivateHeadersInfo")

PrivateHeadersInfo(<a href="#PrivateHeadersInfo-headers">headers</a>)
</pre>

Propagates private headers, so they can be accessed if necessary

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="PrivateHeadersInfo-headers"></a>headers | Private headers |
Expand All @@ -47,6 +50,8 @@ Propagates private headers, so they can be accessed if necessary
## apple_library

<pre>
load("@rules_ios//rules:library.bzl", "apple_library")

apple_library(<a href="#apple_library-name">name</a>, <a href="#apple_library-library_tools">library_tools</a>, <a href="#apple_library-export_private_headers">export_private_headers</a>, <a href="#apple_library-namespace_is_module_name">namespace_is_module_name</a>,
<a href="#apple_library-default_xcconfig_name">default_xcconfig_name</a>, <a href="#apple_library-xcconfig">xcconfig</a>, <a href="#apple_library-xcconfig_by_build_setting">xcconfig_by_build_setting</a>, <a href="#apple_library-objc_defines">objc_defines</a>, <a href="#apple_library-swift_defines">swift_defines</a>,
<a href="#apple_library-kwargs">kwargs</a>)
Expand Down
6 changes: 6 additions & 0 deletions docs/plists_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Defines macros for working with plist files.
## process_infoplists

<pre>
load("@rules_ios//rules:plists.bzl", "process_infoplists")

process_infoplists(<a href="#process_infoplists-name">name</a>, <a href="#process_infoplists-infoplists">infoplists</a>, <a href="#process_infoplists-infoplists_by_build_setting">infoplists_by_build_setting</a>, <a href="#process_infoplists-xcconfig">xcconfig</a>,
<a href="#process_infoplists-xcconfig_by_build_setting">xcconfig_by_build_setting</a>)
</pre>
Expand Down Expand Up @@ -34,6 +36,8 @@ A selectable dict of the substituted_plists grouped by config_setting
## substituted_plist

<pre>
load("@rules_ios//rules:plists.bzl", "substituted_plist")

substituted_plist(<a href="#substituted_plist-name">name</a>, <a href="#substituted_plist-plist">plist</a>, <a href="#substituted_plist-xcconfig">xcconfig</a>)
</pre>

Expand All @@ -58,6 +62,8 @@ The plist target with the substituted variables.
## write_info_plists_if_needed

<pre>
load("@rules_ios//rules:plists.bzl", "write_info_plists_if_needed")

write_info_plists_if_needed(<a href="#write_info_plists_if_needed-name">name</a>, <a href="#write_info_plists_if_needed-plists">plists</a>)
</pre>

Expand Down
2 changes: 2 additions & 0 deletions docs/precompiled_apple_resource_bundle_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if this is ever fixed in bazel it should be removed
## precompiled_apple_resource_bundle

<pre>
load("@rules_ios//rules:precompiled_apple_resource_bundle.bzl", "precompiled_apple_resource_bundle")

precompiled_apple_resource_bundle(<a href="#precompiled_apple_resource_bundle-kwargs">kwargs</a>)
</pre>

Expand Down
10 changes: 4 additions & 6 deletions docs/providers_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
## AvoidDepsInfo

<pre>
load("@rules_ios//rules:providers.bzl", "AvoidDepsInfo")

AvoidDepsInfo(<a href="#AvoidDepsInfo-libraries">libraries</a>, <a href="#AvoidDepsInfo-link_dynamic">link_dynamic</a>)
</pre>



**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="AvoidDepsInfo-libraries"></a>libraries | Libraries to avoid |
Expand All @@ -26,14 +25,13 @@ AvoidDepsInfo(<a href="#AvoidDepsInfo-libraries">libraries</a>, <a href="#AvoidD
## FrameworkInfo

<pre>
load("@rules_ios//rules:providers.bzl", "FrameworkInfo")

FrameworkInfo(<a href="#FrameworkInfo-vfsoverlay_infos">vfsoverlay_infos</a>, <a href="#FrameworkInfo-binary">binary</a>, <a href="#FrameworkInfo-headers">headers</a>, <a href="#FrameworkInfo-private_headers">private_headers</a>, <a href="#FrameworkInfo-modulemap">modulemap</a>, <a href="#FrameworkInfo-swiftmodule">swiftmodule</a>, <a href="#FrameworkInfo-swiftdoc">swiftdoc</a>)
</pre>



**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="FrameworkInfo-vfsoverlay_infos"></a>vfsoverlay_infos | Merged VFS overlay infos, present when virtual frameworks enabled |
Expand Down
2 changes: 2 additions & 0 deletions docs/substitute_build_settings_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## substitute_build_settings

<pre>
load("@rules_ios//rules:substitute_build_settings.bzl", "substitute_build_settings")

substitute_build_settings(<a href="#substitute_build_settings-name">name</a>, <a href="#substitute_build_settings-source">source</a>, <a href="#substitute_build_settings-variables">variables</a>)
</pre>

Expand Down
18 changes: 18 additions & 0 deletions docs/test_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## default_test_factory.make_named_split

<pre>
load("@rules_ios//rules:test.bzl", "default_test_factory")

default_test_factory.make_named_split(<a href="#default_test_factory.make_named_split-name">name</a>, <a href="#default_test_factory.make_named_split-split_kwargs">split_kwargs</a>, <a href="#default_test_factory.make_named_split-in_split">in_split</a>)
</pre>

Expand All @@ -27,6 +29,8 @@ default_test_factory.make_named_split(<a href="#default_test_factory.make_named_
## default_test_factory.make_runner_split

<pre>
load("@rules_ios//rules:test.bzl", "default_test_factory")

default_test_factory.make_runner_split(<a href="#default_test_factory.make_runner_split-name">name</a>, <a href="#default_test_factory.make_runner_split-runner">runner</a>, <a href="#default_test_factory.make_runner_split-in_split">in_split</a>)
</pre>

Expand All @@ -47,6 +51,8 @@ default_test_factory.make_runner_split(<a href="#default_test_factory.make_runne
## default_test_factory.make_test

<pre>
load("@rules_ios//rules:test.bzl", "default_test_factory")

default_test_factory.make_test(<a href="#default_test_factory.make_test-name">name</a>, <a href="#default_test_factory.make_test-test_rule">test_rule</a>, <a href="#default_test_factory.make_test-kwargs">kwargs</a>)
</pre>

Expand All @@ -67,6 +73,8 @@ Helper to create an individual test
## default_test_factory.make_test_suite

<pre>
load("@rules_ios//rules:test.bzl", "default_test_factory")

default_test_factory.make_test_suite(<a href="#default_test_factory.make_test_suite-factory">factory</a>, <a href="#default_test_factory.make_test_suite-name">name</a>, <a href="#default_test_factory.make_test_suite-test_rule">test_rule</a>, <a href="#default_test_factory.make_test_suite-test_kwargs">test_kwargs</a>)
</pre>

Expand All @@ -88,6 +96,8 @@ default_test_factory.make_test_suite(<a href="#default_test_factory.make_test_su
## default_test_factory.make_test_suite_splits

<pre>
load("@rules_ios//rules:test.bzl", "default_test_factory")

default_test_factory.make_test_suite_splits(<a href="#default_test_factory.make_test_suite_splits-factory">factory</a>, <a href="#default_test_factory.make_test_suite_splits-name">name</a>, <a href="#default_test_factory.make_test_suite_splits-in_kwargs">in_kwargs</a>)
</pre>

Expand All @@ -113,6 +123,8 @@ Finally - you can set the splits to be whatever you want.
## default_test_factory.make_tests

<pre>
load("@rules_ios//rules:test.bzl", "default_test_factory")

default_test_factory.make_tests(<a href="#default_test_factory.make_tests-factory">factory</a>, <a href="#default_test_factory.make_tests-name">name</a>, <a href="#default_test_factory.make_tests-test_rule">test_rule</a>, <a href="#default_test_factory.make_tests-kwargs">kwargs</a>)
</pre>

Expand All @@ -134,6 +146,8 @@ Main entry point of generating tests"
## ios_ui_test

<pre>
load("@rules_ios//rules:test.bzl", "ios_ui_test")

ios_ui_test(<a href="#ios_ui_test-name">name</a>, <a href="#ios_ui_test-apple_library">apple_library</a>, <a href="#ios_ui_test-test_factory">test_factory</a>, <a href="#ios_ui_test-kwargs">kwargs</a>)
</pre>

Expand All @@ -155,6 +169,8 @@ Builds and packages iOS UI Tests.
## ios_unit_snapshot_test

<pre>
load("@rules_ios//rules:test.bzl", "ios_unit_snapshot_test")

ios_unit_snapshot_test(<a href="#ios_unit_snapshot_test-name">name</a>, <a href="#ios_unit_snapshot_test-apple_library">apple_library</a>, <a href="#ios_unit_snapshot_test-test_factory">test_factory</a>, <a href="#ios_unit_snapshot_test-kwargs">kwargs</a>)
</pre>

Expand All @@ -176,6 +192,8 @@ Builds and packages iOS Unit Snapshot Tests.
## ios_unit_test

<pre>
load("@rules_ios//rules:test.bzl", "ios_unit_test")

ios_unit_test(<a href="#ios_unit_test-name">name</a>, <a href="#ios_unit_test-apple_library">apple_library</a>, <a href="#ios_unit_test-test_factory">test_factory</a>, <a href="#ios_unit_test-kwargs">kwargs</a>)
</pre>

Expand Down
2 changes: 2 additions & 0 deletions docs/transition_support_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ part on the language used for XCFramework library identifiers:
## transition_support.current_apple_platform

<pre>
load("@rules_ios//rules:transition_support.bzl", "transition_support")

transition_support.current_apple_platform(<a href="#transition_support.current_apple_platform-apple_fragment">apple_fragment</a>, <a href="#transition_support.current_apple_platform-xcode_config">xcode_config</a>)
</pre>

Expand Down
Loading

0 comments on commit 6aa4540

Please sign in to comment.