XcodeProj icon indicating copy to clipboard operation
XcodeProj copied to clipboard

Add API to search for files in a group with path. Handles non-unique filenames in groups

Open itsthejb opened this issue 3 years ago β€’ 3 comments

Resolves https://github.com/tuist/xcodeproj/issues/670

Short description πŸ“

  • Add path based accessor for files in a group

Solution πŸ“¦

  • Simply generate a full path, using the available source root, so it's possible to filter on a complete abs/relative path, rather than just assuming that the filename is enough

Implementation πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

  • [x] Step 1: Add unit test
  • [x] Step 2: Implement file find method
  • [x] Step 3: Deprecate the name method

itsthejb avatar Mar 30 '22 12:03 itsthejb

Codecov Report

Merging #671 (a3188c3) into main (6f2c1a7) will decrease coverage by 0.00%. The diff coverage is 41.17%.

@@            Coverage Diff             @@
##             main     #671      +/-   ##
==========================================
- Coverage   84.75%   84.74%   -0.01%     
==========================================
  Files         157      157              
  Lines        8987     8995       +8     
==========================================
+ Hits         7617     7623       +6     
- Misses       1370     1372       +2     
Impacted Files Coverage Ξ”
Sources/XcodeProj/Objects/Files/PBXGroup.swift 78.57% <41.17%> (-0.28%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 6f2c1a7...a3188c3. Read the comment docs.

codecov-commenter avatar Mar 31 '22 06:03 codecov-commenter

Ok! This has now actually changed somewhat, and much improved (I hope!). The only real question is whether or not fullPath(sourceRoot:) might have some unexpected results in some situations; it seems not, though...

itsthejb avatar Mar 31 '22 11:03 itsthejb

@kwridan Thanks for investigating further. To be honest, going deeper into this in order to validate it worked as expected for all cases was beginning to stretch my understanding of PBXSourceTrees, which I've only semi-understanded over the years working in Xcode. I was also trying to set up a whole suite of unit tests (which are still in previous commits), but started chasing my tail and getting a headache... 🀯

So, when I realised there was already an implementation in there, I went with the approach of exposing that, rather than assuming DIY could be any better (probably worse)

Actually our original use case was avoiding duplicate files in groups, and this whole exercise has taught me that addFile(...) already has some form of this...

itsthejb avatar Apr 01 '22 08:04 itsthejb

Hola πŸ‘‹,

We want to let you know that your pull request has been marked as stale. It seems that there hasn't been any activity or updates on it for a while.

If you're still interested in having this pull request merged or reviewed, please provide any necessary updates or address any feedback that may have been given. We would be happy to continue the review process and consider merging it into the main branch.

However, if this pull request is no longer a priority or if you've decided to take a different approach, please let us know so we can close it accordingly.

Thank you for your understanding and contribution.

github-actions[bot] avatar Jun 27 '23 02:06 github-actions[bot]

Hola πŸ‘‹,

We want to let you know that we have decided to close your pull request #456 due to prolonged inactivity. Despite the initial interest and efforts put into the pull request, we haven't seen any updates or responses for a considerable period of time.

We understand that circumstances change and priorities shift, which may have led to this inactivity. If you still wish to contribute or have further discussions on this feature or bug fix, please don't hesitate to reopen the pull request and engage with the community.

We appreciate your understanding and the time you invested in submitting the pull request. Your contributions are valuable, and we hope to collaborate with you on future endeavors.

Thank you.

github-actions[bot] avatar Jul 02 '23 02:07 github-actions[bot]