Fix watchOS target detection and add isWatchExtension helper#42
Merged
Fix watchOS target detection and add isWatchExtension helper#42
Conversation
Change PBXNativeTarget.isWatchOSTarget to identify watchOS targets based on productType (watchapp, watchapp2, watchapp2-container) instead of relying on the WATCHOS_DEPLOYMENT_TARGET build setting. Update tests to find and assert watchapp2 targets, add explicit tests for watchapp and watchapp2-container targets, and adjust expectations for regular application targets (setting WATCHOS_DEPLOYMENT_TARGET no longer makes them watchOS targets). This simplifies detection logic and aligns behavior with product type identifiers.
- Fix getCopyBuildPhaseForTarget to use isWatchOSTarget() instead of checking for generic application type - Add isWatchExtension() helper for watchkit-extension and watchkit2-extension product types - Update tests to use correct watchOS product types Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isWatchOSTarget(): Changed from checkingcom.apple.product-type.application+WATCHOS_DEPLOYMENT_TARGETto checking the proper watchOS product types (watchapp,watchapp2,watchapp2-container)getCopyBuildPhaseForTarget(): Was incorrectly returning "Embed Watch Content" for any regular iOS app; now usesisWatchOSTarget()isWatchExtension(): New helper method to identify watch extension targets (watchkit-extension,watchkit2-extension)Test plan
isWatchExtension()🤖 Generated with Claude Code