-
Couldn't load subscription status.
- Fork 35
Add local packages structure logic #232
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
base: main
Are you sure you want to change the base?
Add local packages structure logic #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for structured folders in local packages by updating the local package mapping logic across several components. The key changes include:
- Updating the PBXProjectMapper to include an additional groupPath parameter when mapping local packages.
- Modifying the XCPackageMapper to propagate the new groupPath parameter.
- Adjusting the Package model and its extensions to accommodate the new structured folders design.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Sources/XcodeGraphMapper/Mappers/Project/PBXProjectMapper.swift | Updated mapping of local packages with an added groupPath parameter. |
| Sources/XcodeGraphMapper/Mappers/Packages/XCPackageMapper.swift | Modified return value of local package mapping to include groupPath. |
| Sources/XcodeGraphMapper/Extensions/Package+Extensions.swift | Adjusted switch-case matching to destructure the new parameter while ignoring it. |
| Sources/XcodeGraph/Models/Package.swift | Updated the Package enum to support an optional groupPath. |
Comments suppressed due to low confidence (2)
Sources/XcodeGraphMapper/Extensions/Package+Extensions.swift:9
- [nitpick] Document the decision to disregard the groupPath parameter in the conversion to a path string, so that future maintainers understand this intentional omission.
case let .local(path, _):
Sources/XcodeGraph/Models/Package.swift:6
- Ensure that all consumers of the Package API are updated to correctly handle the new optional groupPath parameter.
case local(path: AbsolutePath, groupPath: String?)
| let localPackages = try pbxProject.localPackages.compactMap { | ||
| try packageMapper.map(package: $0, sourceDirectory: sourceDirectory) | ||
| } + localPackagePaths.map { .local(path: $0) } | ||
| } + localPackagePaths.map { .local(path: $0, groupPath: nil) } |
Copilot
AI
Jun 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All local package mappings use nil for groupPath. If structured folders are intended, consider retrieving and passing the appropriate group path when available to improve maintainability.
| let relativePath = try RelativePath(validating: package.relativePath) | ||
| let path = sourceDirectory.appending(relativePath) | ||
| return .local(path: path) | ||
| return .local(path: path, groupPath: nil) |
Copilot
AI
Jun 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider propagating groupPath information if available to support structured folder logic, rather than defaulting to nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rishatyakushev thanks for doing this. I'd keep this one open until the counterpart in tuist/tuist is approved :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some minor comments.
| let relativePath = try RelativePath(validating: package.relativePath) | ||
| let path = sourceDirectory.appending(relativePath) | ||
| return .local(path: path) | ||
| return .local(path: path, groupPath: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we get groupPath from XCLocalSwiftPackageReference?
| let localPackages = try pbxProject.localPackages.compactMap { | ||
| try packageMapper.map(package: $0, sourceDirectory: sourceDirectory) | ||
| } + localPackagePaths.map { .local(path: $0) } | ||
| } + localPackagePaths.map { .local(path: $0, groupPath: nil) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, can't we get groupPath?
@pepicrft @fortmarek Hello! 👋
When you have a moment, could you please review this PR? I’m aiming to add support for structured folders in local packages (per the discussion here: https://community.tuist.dev/t/how-to-generate-and-keep-structured-folders-local-packages/245), but I’ve hit a roadblock. I’d be grateful for any feedback or a merge. Thank you! 🙏