New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Xcodeproj] Sort targets and their groups in manifest definition order #2092
[Xcodeproj] Sort targets and their groups in manifest definition order #2092
Conversation
[SR-8204] Sort targets and cooresponding groups in order of declaration in the manifest. Rather than mess with the order of the package graph itself, we introduce a TargetSortDescriptor that is internal to the Xcodeproj model and can sort package targets and Xcode targets using the same logic.
[SR-8204] Allow generate-xcodeproj --sort-targets-alphabetically to preserve the old behavior of sorting targets and their groups in alphabetical order.
I need to fix a few tests, and possible add another. |
Hmm…this seems to have broken a few Xcodeproj FunctionalTests. In particular, Dependency targets in the "SystemModuleUser" and "SwiftCMixed" projects are not built in the Release directory. |
[SR-8204] `xcodebuild -alltargets` does not properly build any targets listed after the package description target, most likely due to its quite different build settings.
It seems that |
[SR-8204] Update documentation now that package descriptions are ordered last in the pbxproj.
@aciidb0mb3r Would it be correct to assume that this is no longer relevant since we're switching to Swift Packages in Xcode? If so, I can file a Radar on Xcode for this one and we can close this. |
[SR-8204] Sort targets and their groups in the following order:
Within each category, targets are sorted in manifest definition order.
Resolved targets are received from the PackageGraph unordered due to the implementation of the package graph. Rather than mess with how packages are collected, a TargetSortDescriptor type is introduced that stores a number of mappings (to achieve O(n) sort) and follows the rules for the ordered list above.
This way, the implementation of this feature does not add complexity outside of the Xcodeproj module. Additionally, using a separate sort descriptor prevents us from needing to modify the order that targets are added when building the Project model, as the building logic relies on targets being added in a certain order.
Note: The old behavior is preserved with --sort-targets-alphabetically