bazelbuild / bazelbuild/rules_apple
Support iOS 16 AppEntity
- Dominant language
- Starlark
- Stars
- 593
- Forks
- 334
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 9
Description
Looks like there's a new tool that will extract metadata from code and turn them into `appintents`
```
❯ xcrun appintentsmetadataprocessor --help
usage: /Applications/Xcode-14.1.0.app/Contents/Developer/usr/bin/appintentsmetadataprocessor --output PATH --target-triple VALUE --module-name VALUE --toolchain-dir PATH --binary-file PATH --source-files [PATH]
-h, --help This help text.
-o, --output PATH The path to produce the compiled output bundle.
-t, --target-triple VALUE Target triple used for build.
-m, --module-name VALUE Module name of target.
-c, --toolchain-dir PATH Toolchain path used for build.
-b, --binary-file PATH Binary file path containing extracted metadata.
-s, --source-files PATH Source file paths to produce the compiled output bundle.
-d, --disable-output-generation Disable output generation.
-r, --sdk-root PATH SDK root file path.
-p, --dependency-file PATH Dependency info file path.
-f, --force Force execution - Disregard dependency file.
-g, --stringsdata-file PATH stringsdata file path.
```
https://developer.apple.com/documentation/AppIntents/AppEntity
bazelbuild Slack thread: https://bazelbuild.slack.com/archives/CD3QY5C2X/p1669231881137459
What the tool does can be reproduced simply by using those APIs in an `ios_application` target, and [rules_xcodeproj](https://github.com/buildbuddy-io/rules_xcodeproj) can be used in a pinch to test this out. My best guess is it seems to be running it against all sources for an Xcode iOS application target.
```
2022-11-23 13:20:58.761 appintentsmetadataprocessor[62072:29097131] Starting appintentsmetadataprocessor export
2022-11-23 13:21:03.323 appintentsmetadataprocessor[62072:29097131] Writing Metadata.appintents
2022-11-23 13:21:03.324 appintentsmetadataprocessor[62072:29097131] Metadata root: /Users/ekerber/Library/Developer/Xcode/DerivedData/Slack-bvwscvpyghvogxbdfhfsrahbyxcv/Build/Products/Debug-iphonesimulator/bazel-out/applebin_ios-ios_sim_arm64-dbg-ST-efefcef94047/bin/App/Slack.app/Metadata.appintents
2022-11-23 13:21:03.351 appintentsmetadataprocessor[62072:29097131] Writing ExtractedAppShortcutsMetadata.stringsdata file
2022-11-23 13:21:03.352 appintentsmetadataprocessor[62072:29097131] Writing ExtractedParameterSummaryMetadata.stringsdata file
```
The metadata extraction is skipped if an app target does not link **AppIntent.framework**:
```
ExtractAppIntentsMetadata (in target 'asdf' from project 'asdf')
cd /Users/ekerber/Desktop/asdf
/Applications/Xcode-14.1.0.app/Contents/Developer/usr/bin/appintentsmetadataprocessor --output /Users/ekerber/Library/Developer/Xcode/DerivedData/asdf-fjjbitzkoyhvpbaepoiqplaybtxv/Build/Products/Debug/asdf.app/Contents/Resources --toolchain-dir /Applications/Xcode-14.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --module-name asdf --source-files /Users/ekerber/Desktop/asdf/asdf/ViewController.swift /Users/ekerber/Desktop/asdf/asdf/AppDelegate.swift --sdk-root /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk --target-triple arm64-apple-macos13.0 --binary-file /Users/ekerber/Library/Developer/Xcode/DerivedData/asdf-fjjbitzkoyhvpbaepoiqplaybtxv/Build/Products/Debug/asdf.app/Contents/MacOS/asdf --dependency-file /Users/ekerber/Library/Developer/Xcode/DerivedData/asdf-fjjbitzkoyhvpbaepoiqplaybtxv/Build/Intermediates.noindex/asdf.build/Debug/asdf.build/Objects-normal/arm64/asdf_dependency_info.dat --stringsdata-file /Users/ekerber/Library/Developer/Xcode/DerivedData/asdf-fjjbitzkoyhvpbaepoiqplaybtxv/Build/Intermediates.noindex/asdf.build/Debug/asdf.build/Objects-normal/arm64/ExtractedAppShortcutsMetadata.stringsdata
note: Metadata extraction skipped. No AppIntents.framework dependency found. (in target 'asdf' from project 'asdf')
```
Similar prior work: #298
Contributor guide
Research direction
Start by reviewing prior work in issue #298 and reproducing the appintentsmetadataprocessor invocation for an ios_application target. Investigate how AppIntents.framework dependencies affect metadata extraction; done means defining and validating support for AppEntity metadata in the Bazel build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- build-system, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100