Fall back to Xcode DerivedData when using --skip-build#1083
Open
ky1ejs wants to merge 2 commits intoperipheryapp:masterfrom
Open
Fall back to Xcode DerivedData when using --skip-build#1083ky1ejs wants to merge 2 commits intoperipheryapp:masterfrom
ky1ejs wants to merge 2 commits intoperipheryapp:masterfrom
Conversation
When --skip-build is used without --index-store-path, periphery looks for the index store in its own DerivedData cache directory. However, when the build was performed by Xcode or xcodebuild directly, the index store lives in Xcode's default DerivedData location instead. This adds a fallback that searches ~/Library/Developer/Xcode/DerivedData for a matching project directory when the index store is not found in periphery's own cache. The most recently modified matching directory is preferred. Fixes peripheryapp#1082
Make findIndexStorePath and findIndexStoreInDerivedData internal for testability. Extract the core DerivedData search into a findIndexStoreInDerivedData(projectName:derivedDataRoot:) overload that accepts a custom root path, enabling unit tests with temp directories. Add 11 tests covering both findIndexStorePath and the DerivedData fallback: modern vs legacy index layouts, preference ordering, project name matching edge cases, and most-recently-modified selection.
d0ddb45 to
349cb37
Compare
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
When
--skip-buildis used without--index-store-path, periphery only looks for the index store in its own DerivedData cache directory (~/Library/Caches/com.github.peripheryapp/DerivedData-*). If the build was performed by Xcode orxcodebuilddirectly (rather than by periphery), the index store lives in Xcode's default DerivedData location and periphery fails withFailed to find index datastore.This is a common scenario in CI pipelines where the project is built in a prior step and periphery runs with
--skip-buildto avoid rebuilding.This PR adds a fallback: when the index store isn't found in periphery's own cache, search
~/Library/Developer/Xcode/DerivedData/for directories matching the project name, preferring the most recently modified one.Changes
Index.noindex/DataStoreorIndex/DataStore) into a reusablefindIndexStorePath(in:)methodfindIndexStoreInDefaultDerivedData(projectName:)that searches Xcode's default DerivedData locationindexStorePath(project:schemes:)now tries periphery's cache first, then falls back to Xcode's DerivedData before throwingReproduction
Fixes #1082