-
Notifications
You must be signed in to change notification settings - Fork 33
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?)
@@ -97,7 +97,7 @@ struct PBXProjectMapper: PBXProjectMapping { | |||
} | |||
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.
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.
Copilot uses AI. Check for mistakes.
@@ -48,7 +48,7 @@ struct XCPackageMapper: XCPackageMapping { | |||
func map(package: XCLocalSwiftPackageReference, sourceDirectory: AbsolutePath) throws -> Package { | |||
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.
Consider propagating groupPath information if available to support structured folder logic, rather than defaulting to nil.
Copilot uses AI. Check for mistakes.
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 :)
@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! 🙏