feat: add On-Demand Resources (ODR) tag support - #379
Open
kramnadroj wants to merge 1 commit into
Open
Conversation
Add programmatic support for managing On-Demand Resource tags, resolving the missing feature raised in issue kronenthaler#298. - PBXBuildFile: add get_asset_tags(), add_asset_tags(), remove_asset_tags() and asset_tags parameter to create(), following the same pattern as ATTRIBUTES - PBXProject: add add_known_asset_tags() and remove_known_asset_tags() to manage the KnownAssetTags registry in project attributes - FileOptions: add asset_tags parameter so add_file() automatically sets ASSET_TAGS on the build file and registers tags in KnownAssetTags Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
Committer here. Not a dev. A QA that found your tool super useful for this use case. Tasked claude with adding it for others. Unsure if you have any AI rules in the repo |
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.
Problem
There was no programmatic way to assign On-Demand Resource tags to files in an Xcode project using
mod-pbxproj. Users were forced to either mutate.pbxprojfiles directly via shell scripts, or usePBXGenericObjectparsing as an undocumented workaround. This was raised in issue #298.ODR requires two distinct mutations to the project file:
ASSET_TAGSin thesettingsof aPBXBuildFileentry to associate a file with specific tagsKnownAssetTagsunderattributesin thePBXProjectsectionNeither was supported.
Solution
PBXBuildFile— new methods following the same pattern asATTRIBUTES:get_asset_tags()— returns the currentASSET_TAGSlist for a build fileadd_asset_tags(tags)— adds one or more tags (string or list)remove_asset_tags(tags)— removes tags and cleans up empty settingscreate()now acceptsasset_tags=NonePBXProject— new methods for managing the project-level tag registry:add_known_asset_tags(tags)— adds tags toattributes.KnownAssetTags(no duplicates)remove_known_asset_tags(tags)— removes tags and cleans up empty attributesFileOptions— newasset_tags=Noneparameter for the high-level API. Whenadd_file()is called with asset tags, the library automatically updates both the build file'sASSET_TAGSand the project'sKnownAssetTagsin one step.Usage
This produces the correct structure in the
.pbxproj:Tests
TestPBXBuildFile— 10 new tests coveringget_asset_tags,add_asset_tags,remove_asset_tags, creation with tags, and cleanup of empty settingsTestPBXProject— 7 new tests coveringadd_known_asset_tags,remove_known_asset_tags, duplicate prevention, and cleanup of empty attributesTestProjectFiles— 3 new integration tests verifying thatFileOptions(asset_tags=...)correctly setsASSET_TAGSon build files and registers tags inKnownAssetTags, and that files added without tags are unaffectedCloses #298