-
Notifications
You must be signed in to change notification settings - Fork 60
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
Running actions replaces Swift Package Manager project file labels with generic names #59
Comments
I am seeing this same issue and it is very annoying 😞. Any idea when this will be looked at? |
Hey Guys, Do one of you have a small dummy project that I can repo in and add to the tests to fix? |
@jdouglas-nz I did a bit of digging and also believe this is a behavior of Xcodeproj. I believe they may have fixed this here: CocoaPods/Xcodeproj@bfe0a6d but it hasn't made it to an actual release from them. The latest release 1.19.0 doesn't include that commit. I could be wrong on if it was really fixed in that commit. |
@donileo I'm sure ( hopefully ) it's possible for me to target a commit for a dependency of this lib. I'll run this through a unit test and confirm that this happens for me, target that commit in particular (temporarily until it is released for realsies), release, and then re-release by removing that commit freeze "hack". How's that sound? |
@jdouglas-nz Here is a test project. Has some swift dependencies and a couple of schemes for dev/stage/prod, you will need to add a fastlane file with a lane and your versioning plugin to test I'm assuming. Sounds good. Hopefully you can pin xcodeproj to the latest master commit, I actually tried but wasn't able to, I'm not a ruby/gem expert in anyway though. Remember though I'm just guessing that commit above fixes the issue so maybe something else will be required for a fix to this issue. |
@donileo TY for the test project! I can repro - which is always a good start :) |
Small update: I noticed that with @simondelphia's invocation - all the Schemes in @donileo's test project are updated - that seems like a bug to me 😅 |
Decided to change tack and look at hacking a bit. Quick question - this is a reasonable amount of work - if you guys were to commit the changes (as in, the |
Yes, any time the project file is modified (e.g. add/remove a file or moving a file in the project navigator) the non-generic form returns. |
@jdouglas-nz Before you take on any work that may be too much can you just run xcodeproj against my test repo. First run the latest version and then the latest commit in master. If you can see that the culprit of this issue is in fact xcodeproj and that the latest commit fixes it I would just push them to release a new version and pin your project to that new version. As to what Xcodeproj commands to run I would run exactly the calls that your versioning plugin calls and see what you get. |
@simondelphia @jdouglas-nz I believe this issue has actually been fixed on xcodeproj. Its just that a release with this fix has not been made as it was fixed after 1.19 which is their latest version. Please see CocoaPods/Xcodeproj#799. I wouldn't do any additional work beyond seeing if you can get |
Yea looks like they're a bit overdue for a release |
@donileo @simondelphia I definitely can pin to whatever commit is on the latest master. I'd just rather be able to make sure that it actually fixes the issue 😅 I couldn't confirm that when I tried, but if you guys are ok, I can push out a gem targeting the latest master |
In my case I added |
@simondelphia can you test my suggested workaround above ^^^ and see if it works to resolve this issue? As far as I can see from my end I believe it does but can't say 100%. I went ahead and reset my swift package cache and committed the pbxproj back to the way that it should be (without the modifications this issue performed.) I then re-ran |
Hm well after doing that I don't see the issue with the generic labels but now I am seeing files previously listed as And these also go away if you change something in the project file (e.g. move a file around). So I guess the issue isn't resolved (at least not on that commit). Or this is a separate issue. |
These are two separate issues:
What I really don't get is why |
@donileo @simondelphia - hold the phone folks. I just realised my test project was the result of running fastlane-versioning-plugin on the project, as in, it was already |
Haven't seen Xcode do this, do you have any steps to achieve it? |
|
No, nothing changed unfortunately. |
@jdouglas-nz So some more digging.. I'm curious why for something as simple as bumping a version number which entails incrementing a number: Given that, it means it won't ever touch the file which is what we want.. I mean why would we want any side effects of swift package resolution to be done for something as simple as bumping a build.. I'm not sure myself how to tell it to skip the package resolution but it seems maybe that’s an option you can pass when invoking |
Oh yea I was wondering the same thing a while ago |
Any update on this? I just started using the plugin today and ran across this issue with the SPM packages being changed to generic names |
Folks! Xcodeproj just pushed an update out - I wrote some tests on my fork, and the tests pass! could one of you pls try target my PR Branch and see if this fixes it for you? TY |
Thanks for following up — I'm not seeing any of the problematic changes I noted before, so that's an improvement. Unfortunately I am getting four lines of things labeled as "(null)" converting to "BuildFile" (not sure what they are). e.g.,:
And then a whole bunch of Swift Package references (not all of them, oddly) getting ".git" appended to them e.g.,:
And these changes disappear if I then cause any changes to my project file (e.g., moving a file around in Xcode project navigator). |
Seems to be the same result as what I posted here #59 (comment) |
Note I just updated my Pluginfile to
I assume there wasn't anything else I would have needed to do? |
yeah, @simondelphia , I would assume that is all you have to do. This I was in the process of writing a horrible hack to fix this - which involves moving the project file to a temp directory, creating a git repo, making the change, then seeing if there are any bashed SwiftPM stuff.. It feels.. pretty horrible tbh. I'm not sure what else I can/should do -- so are you saying that even adding a new file through Xcode will randomly stuff around with these as well? |
I'll push out a release (which is basically just a |
This at least partially addresses the oddities that happen when using this plugin (and the xcodeproj gem) to make changes to an xcodeproj in a SwiftPM project.
What about the
I'm not sure what that means. If I just move a file around in Xcode the only changes to my project are the file that's been moved around. I was just saying that after running this versioning plugin, I get all these additional changes in my project file. That would be fine if that was just a one time thing, but Xcode automatically reverts these changes if you modify the project file. So if you committed these changes each time you would be constantly going back and forth and having a lot of extraneous changes in git hiding the actual changes you want. So my temporary solution has been to introduce a manual step where you have to manually move a file back and forth to remove these extra changes. If I could automate that somehow that would be helpful, but I haven't come up with a simple way to do that yet. |
I can confirm that the latest version of this gem from I also noticed the same issue as @simondelphia with Xcode doesn't let you edit the package URL for any packages you've added but you can find/replace in the xcodeproj file to fix this. I believe there are some known issues with Xcode package resolution getting confused if you have multiple references to an SPM package with and without the .git suffix so its probably a good idea to standardise on one of the other anyway. |
Yea that works, thank you! — now I just need to figure out what the deal is with these Seems I can just delete those — I guess they're left over from files being deleted and Xcode not cleaning them up properly. |
I'm going to go ahead and close this because it's working for me and seems like it worked for @donileo too. |
Amazing !! I might put something in the readme, at least until xcodeproj/Xcode SwiftPM stabilises 😅 |
When I run e.g.
increment_version_number_in_xcodeproj
:It runs xcodebuild with a
-resolvePackageDependencies
flag, and then it replaces all the SPM specific names in the project file with generic things likeRemoteSwiftPackageReference
SwiftPackageProductDependency
andBuildFile
. Running regular fastlane actions does not do this. The project still compiles and runs though, since I guess these names are just commented out labels, but it would still be preferable for this not to happen (because those labels are helpful and because I don't want to have to discard git changes every time I run fastlane with this plugin).For example:
becomes:
This SO issue is similar but it is talking about SwiftLint and has no solution yet.
Also, if you add / remove files within your Xcode project (in the Xcode application) the project file reverts all these changes.
The text was updated successfully, but these errors were encountered: