In my project I have an application and a swift package each in their own private GitHub repository.
When I develop a new feature, I create a branch “feature/feature-01234-app” in the app repository and a new branch “feature/feature-01234-sdk” in the swift package repository.
When I create the git pull-request for the application feature I want Xcode cloud to build the application using the special branch in the package repository.
Manually I can open Xcode locally , change the dependency in my project to take the latest changes from the feature branch, this results in changes in 2 files:
The internal file “project.pbxproj” contains a line “branch = develop;” is modified to “branch = “feature/feature-01234-sdk”;”
Package.resolved file changes after Xcode resolved dependencies with updated branch and some “revision” value that is generated by Xcode.
The problem is that I don’t want to commit these changes to git, I want my project to remain pointing to develop branch and write a script that generates these changes automatically when I create a pull request.
Questions:
Is there a way to change application project settings by telling Xcode to change branch package dependency from develop to a feature branch? ( I wrote a script for that but it seems risky to change project file with a bash script)
Is there a way to trigger Xcode to resolve dependencies after I changed the project file and generate the Package.resolved file again?
How is the revision field in the Package.resolved file calculated? Can It be done by a script?