Closed teameh closed 1 year ago
(Rebased and signed commits with gpg key)
@all-contributors add @teameh for code
@kwridan
I've put up a pull request to add @teameh! :tada:
Again thanks for the review. I've updated the PR.
Regarding your comments:
Only creating the directories if needed
Good point. I've also added this behaviour to XCSharedData
I propose we mark some of those path methods as deprecated but maintain the current behaviour and instead create XcodeProjPaths which would have more explicit methods
I wonder if all the path methods should be part of a separate object at all. Shouldn't they be more coupled with their Type? Eg. XCUserData
'knows' what it's own folder structure is like so wouldn't it make more sense to place the path methods in that file as well?
extension XCUserData {
/// Returns user data path relative to the given path.
///
/// - Parameter path: `.xcodeproj` file path
/// - Returns: user data path relative to the given path.
public static func path(_ path: Path) -> Path {
path + "xcuserdata"
}
/// Returns user data path for a specific user relative to the given path.
///
/// - Parameter path: `.xcodeproj` file path
/// - Returns: user data path relative to the given path.
public static func path(_ path: Path, userName: String) -> Path {
XCUserData.path(path) + "\(userName).xcuserdatad"
}
}
After some variants I went with this approach and changed the files, this time keeping backwards compatibility in mind. See the bottom of the various classes.
I'm not sure if you would indeed need a separate XcodeProjPaths
object to expose all the paths directly, but I've added it nevertheless. See https://github.com/tuist/XcodeProj/pull/739/files#diff-fa66e1c428ec70441e060c5e8cfcc78146a7485eaa5a57ab586063fa2dfeb6acR248. Do you think Tuist still needs it? The paths can also be derived. I'll move it to its own file if this is what we want.
No problem. Iterations are good.
Ok, I've removed the enum and added some more assertions to see why the builds are failing..
My machine:
Executed 314 tests, with 0 failures (0 unexpected) in 5.406 (5.463) seconds
@kwridan could you maybe approve the workflow? https://github.com/tuist/XcodeProj/actions/runs/3854685253
Thanks! I've removed the superfluous comments.
What do you think about https://github.com/tuist/XcodeProj/pull/739#discussion_r1063408365?
Hey @kwridan, @adellibovi, @brentleyjones, @danyf90 & @fortmarek. If there's anything I can do to move this PR forward, please let me know. Also happy to hop on a quick call to elaborate the changes if you think that is helpful for one of you.
Hey @kwridan, @adellibovi, @brentleyjones, @danyf90 & @fortmarek. If there's anything I can do to move this PR forward, please let me know. Also happy to hop on a quick call to elaborate the changes if you think that is helpful for one of you.
Apologies for the delays - trying to source a second reviewer is proving more challenging these days π , I have posted a message in the Tuist slack for visibility.
Awesome! Thanks for merging this π
Hey there, any plans for creating a new release for XcodeProj? Would be cool if we could use this for https://github.com/yonaskolb/XcodeGen/pull/1142!
It's already out as part of https://github.com/tuist/XcodeProj/releases/tag/8.9.0 π
Thank You
Semper Fi
XIΓK Mustardseed XIΓK
On Mon, Dec 26, 2022, 11:57 Teameh @.***> wrote:
π Hi I'm new here. Thanks for this project, it's great! Short description π
XcodeProj doesn't support xcuserdata yet, this PR adds XCUserData Background
XCSchemeManagement is already implemented, but it's not included in Sources/XcodeProj/Project/XcodeProj.swift https://github.com/tuist/XcodeProj/blob/main/Sources/XcodeProj/Project/XcodeProj.swift. XcodeProj also currently does not feature the necessary XCUserData where XCSchemeManagement should be part of.
In XcodeGen we are trying to add support for scheme management via XCSchemeManagement that should result in three options for schemes: visibility, order hints and wether or not a scheme is shared.
When a scheme is not shared it should be written to xcuserdata instead of xcshareddata but since xcuserdata is not part of XcodeProj yet this is not possible at the moment and the shared: Bool property of XCSchemeManagement is not very useful.
[image: 209574381-98840d4a-ea19-4602-a838-9de86fbaac8d] https://user-images.githubusercontent.com/1330668/209579166-8e0095ef-9edf-40e5-843e-ad8392dba64e.png Implementation π©βπ»π¨βπ»
- Created XCUserData & XCUserDataTests
- Changed XcodeProj.swift so schemes and breakpoints could be written to both shared and user data
- Conformed XCSharedData to Writable because XcodeProj.swift was getting a bit bloated.
- Conformed XCSchemeManagement to Writable
- Added XcodeProjTests to verify changes did not break anything
- Extracted func testReadWriteProducesNoDiff(file:line:path:initModel:) to testWrite.swift to dry up the tests a bit.
I'll add some review remarks and questions to the diff. Questions
- Coverage for the files inSources/XcodeProj/Project is a bit low. I found no tests for the code in XcodeProj.swift that is responsible for writing files to disk. XCSharedData is also lacking tests. I thought it would be too much out of scope for this PR, but maybe I can add those in another PR?
[image: image] https://user-images.githubusercontent.com/1330668/209579322-245ffcce-a970-4ea5-9e66-e8fd8f71bb54.png Remarks?
I had good fun working on this today! I hope you see the added value.
You can view, comment on, or merge this pull request online at:
https://github.com/tuist/XcodeProj/pull/739 Commit Summary
- b22dc60 https://github.com/tuist/XcodeProj/pull/739/commits/b22dc607b97a386b5603a37b519eaee6c585e41e Added support for xcuserdata
File Changes
(18 files https://github.com/tuist/XcodeProj/pull/739/files)
- M Fixtures/Schemes/xcschememanagement.plist https://github.com/tuist/XcodeProj/pull/739/files#diff-c01a5816d7ab008c99dbd691a3ebaaf8b5ae99956db35f7c250daca40ef6782e (4)
- M Fixtures/iOS/Project.xcodeproj/xcshareddata/xcdebugger/Breakpoints_v2.xcbkptlist https://github.com/tuist/XcodeProj/pull/739/files#diff-eabfd621a0c61935d1ac7763363a7770ab15588c910a6d492312413897289288 (8)
- M Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme https://github.com/tuist/XcodeProj/pull/739/files#diff-260186bccc6b14e7206dc20f6cef4bbf164d0a31fba4cddf52574db3598891b3 (55)
- A Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist https://github.com/tuist/XcodeProj/pull/739/files#diff-693f84790fb71552b98a3b234af82bfc876838558a82ab5f326f4e82c2855447 (41)
- A Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-debug.xcscheme https://github.com/tuist/XcodeProj/pull/739/files#diff-d2cfd6e5141718960162b8caccd1bcf7b3cd3cddcbbd8c0bfd60de036432af43 (58)
- A Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-release.xcscheme https://github.com/tuist/XcodeProj/pull/739/files#diff-4e01990d7b181f6398a4507b811fc919e2831bb532f20d5e74ea12727e8c48e6 (58)
- A Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/xcschememanagement.plist https://github.com/tuist/XcodeProj/pull/739/files#diff-481af6485d9ceda1908df541a5550de524f5bd264276900e3b17e60a94ada9dc (45)
- A Fixtures/iOS/Project.xcodeproj/xcuserdata/username2.xcuserdatad/xcschemes/iOSTests.xcscheme https://github.com/tuist/XcodeProj/pull/739/files#diff-a2f551f6f6ff6588c55029e139f2e70540ca5698a627fb99641c10e9cb4dcaa3 (55)
- M Sources/XcodeProj/Errors/Errors.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-2e91802a1d655319ebb90763a4591239c5f769360edfecab872701c3d598773e (16)
- M Sources/XcodeProj/Project/XCSharedData.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-d9813515fcdca420ec369da92701017d37747feec7abd4519c9cc008e06a3796 (11)
- A Sources/XcodeProj/Project/XCUserData.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-91c96251686399e9eecf84e72d4c486d45ebb411071049cbdb9d78c4b7febae4 (84)
- M Sources/XcodeProj/Project/XcodeProj.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-fa66e1c428ec70441e060c5e8cfcc78146a7485eaa5a57ab586063fa2dfeb6ac (131)
- M Sources/XcodeProj/Scheme/XCSchemeManagement.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-d92c5d3d02b4fd525536f4113a16fcad669b08e2936e4d8aa954ea2cc647fa5d (15)
- A Tests/XcodeProjTests/Project/XCUserDataTests.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-1de710cd732e868527208ac96d7a3b15075e50db03dc1826afc901c254bba669 (38)
- A Tests/XcodeProjTests/Project/XcodeProjTests.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-8075c174d2fe93cee0c43340e3efe00353c7904246d73304dc86deeae4d9d689 (56)
- M Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-55065e34288606fdfc846acb7583090de95cd05838908667a842847f9cd33693 (17)
- M Tests/XcodeProjTests/Scheme/XCSchemeTests.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-69b872ede661673d9bbfbf7bbe775d096ee66a9a86892971b14747e53213b16f (5)
- M Tests/XcodeProjTests/Tests/testWrite.swift https://github.com/tuist/XcodeProj/pull/739/files#diff-7ee17cff9a8fc67e599c12dde9f4fdda159e1c086df68d2bb3e81da4c80d7ffe (30)
Patch Links:
β Reply to this email directly, view it on GitHub https://github.com/tuist/XcodeProj/pull/739, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3UTM2MPCY4HZODT54LODM3WPH2BZANCNFSM6AAAAAATJ3O6EQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
haha wow thanks, I just missed it. Great!
π Hi I'm new here. Thanks for this project, it's great!
Short description π
XcodeProj doesn't support
xcuserdata
yet, this PR addsXCUserData
Background
XCSchemeManagement
is already implemented, but it's not included inSources/XcodeProj/Project/XcodeProj.swift
.XcodeProj
also currently does not feature the necessaryXCUserData
whereXCSchemeManagement
should be part of.In XcodeGen we are trying to add support for scheme management via
XCSchemeManagement
that should result in three options for schemes: visibility, order hints and wether or not a scheme is shared.When a scheme is not shared it should be written to
xcuserdata
instead ofxcshareddata
but sincexcuserdata
is not part of XcodeProj yet this is not possible at the moment and theshared: Bool
property ofXCSchemeManagement
is not very useful.Implementation π©βπ»π¨βπ»
XCUserData
&XCUserDataTests
XcodeProj.swift
so schemes and breakpoints could be written to both shared and user dataXCSharedData
toWritable
becauseXcodeProj.swift
was getting a bit bloated.XCSchemeManagement
toWritable
XcodeProjTests
to verify changes did not break anythingfunc testReadWriteProducesNoDiff(file:line:path:initModel:)
totestWrite.swift
to dry up the tests a bit.I'll add some review remarks and questions to the diff.
Questions
Sources/XcodeProj/Project
is a bit low. I found no tests for the code inXcodeProj.swift
that is responsible for writing files to disk.XCSharedData
is also lacking tests. I thought it would be too much out of scope for this PR, but maybe I can add those in another PR?Remarks?
I had good fun working on this today! I hope you see the added value.