Skip to content

Support multiple modules on app_intents for applications#2879

Merged
aaronsky merged 12 commits intobazelbuild:mainfrom
kntkymt:kntk/enable-multiple-app-intents-targets
Mar 7, 2026
Merged

Support multiple modules on app_intents for applications#2879
aaronsky merged 12 commits intobazelbuild:mainfrom
kntkymt:kntk/enable-multiple-app-intents-targets

Conversation

@kntkymt
Copy link
Copy Markdown
Contributor

@kntkymt kntkymt commented Feb 9, 2026

Background

resolve #2878

Approach

As-is

  1. Generate App Intents metadata for a target passed to app_intents (only a single target is supported).
  2. Bundle the output from step 1 into the application.

To-be

When using Xcode 26 or later

  1. Generate App Intents metadata (Metadata.appintents) for each target passed to app_intents.
  2. Generate an additional App Intents metadata file for a dummy intermediate target by passing the metadata files from 1. to --static-metadata-file-list.
    • appintentmetadataprocessor merges the metadata files into a single metadata.
  3. Bundle the output from step 2 into the application.

Note: appintentmetadataprocessor supports --static-metadata-file-list starting with the Xcode 26 toolchain.

Otherwise

Keep the current behavior.

Sample

sample project

https://github.com/kntkymt/ios-app-intents-sample/tree/main/bazel-multi-app-intents

@kntkymt
Copy link
Copy Markdown
Contributor Author

kntkymt commented Feb 21, 2026

any kind of feedbacks are welcome (ideas, approaches, blockers need to solve first, etc...)

@kntkymt
Copy link
Copy Markdown
Contributor Author

kntkymt commented Mar 7, 2026

Thank you for the review! I resolved conflict and imported changes of latest master 🙇

escpecially:

  • add platform_prerequisites
  • remove passing fake binary bundle_binary = fat_stub_binary,

to/from argument of generate_app_intents_metadata_bundle

@aaronsky aaronsky enabled auto-merge (squash) March 7, 2026 09:30
@aaronsky aaronsky merged commit f92f668 into bazelbuild:main Mar 7, 2026
7 checks passed
kntkymt added a commit to kntkymt/rules_apple that referenced this pull request Mar 28, 2026
keith pushed a commit that referenced this pull request Mar 28, 2026
…2879)" (#2906)

# Background

This reverts commit f92f668.

solves #2901

This issue is a regression introduced by
#2879, which added support
for multiple dependencies for app_intents.

The approach was as follows:

1. Parse each dependency module
2. Merge the generated metadata into a single dummy module's metadata
using the `--static-metadata-file-list` option of
`appintentmetadataprocessor`, which is intended to propagate dependency
metadata (definition of `AppIntents`) to dependents
3. Bundle the result of step 2 into the app

However, it turns out that `--static-metadata-file-list` does not
propagate AppShortcutsProvider to dependent modules. In other words, the
processor only recognizes providers defined in the last (root) module it
processes.

Since the root module in this approach is a dummy module, providers
defined in modules passed to `app_intents` are dropped during step 2.

# Approach

Let me revert it now and start over thinking about proper approach.

Now I’m thinking it would be better to keep the single-module
restriction for the app_intents argument. Since the processor
essentially expects a single root module for defining
`AppShortcutsProvider`, it makes sense for app_intents to specify that
root module.

Instead, it would be more appropriate to support recursively parsing the
metadata of dependency modules from the module passed to app_intents,
which would effectively allow handling multiple modules. I might try to
work on it when I have a time

any other idea, suggestion are welcomed

BTW, I'm going to open an another PR for adding test cases regarding
`AppShortcutsProvider`, it helps us avoiding such regression in the
future.

I'm sorry for causing this problem and thanks for reviewers,
contributors support 🙇
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple module on app_intents of applications

2 participants