XcodeGen
XcodeGen copied to clipboard
Xcode removing Package.resolved
Environment
- xcodegen version: 2.39.1
- Xcode version: 15.3
Description
I've encountered an issue where xcodegen
fails to retain the CleverTapGeofence
Swift Package Manager (SPM) dependency in the Package.resolved
file of the generated Xcode project. The dependency is correctly specified in the .yml
configuration file, and when dependencies are resolved directly through Xcode, the CleverTapGeofence
package is successfully added. However, upon generating the project with xcodegen
, this particular package is missing from Package.resolved
.
Steps to Reproduce
- Specify
CleverTapGeofence
package in the.yml
configuration file forxcodegen
. - Generate the Xcode project using
xcodegen
. - Observe that the
CleverTapGeofence
package is missing fromPackage.resolved
in the generated project.
Expected Behavior
The CleverTapGeofence
package, as specified in the .yml
file, should be retained in the Package.resolved
file of the generated project, similar to how it is retained when adding the package directly through Xcode's SPM integration.
Actual Behavior
The CleverTapGeofence
package is missing from the Package.resolved
file in the generated Xcode project, despite being specified in the .yml
configuration file for xcodegen
.
Additional Information
-
.yml
Configuration Snippet forCleverTapGeofence
:packages: CleverTapGeofence: url: https://github.com/CleverTap/clevertap-geofence-ios.git from: 1.0.4
This issue only happens with Xcode 15.3, after revert back to 15.2 it works as expected.
I have the same issue :) always have to resolve packages manually with 15.3
Also have this issue on xcode 15.3 (thx aapl)
As temporary solution you can add next lines to top of project.yml
options:
postGenCommand: xcodebuild -resolvePackageDependencies -project MyApp.xcodeproj -scheme MyApp
and replace "MyApp" to yours project name
(@wojciech-kulik FYI)
@Woit thanks for the workaround!
I've already reported this issue to Apple: FB13684602
It happens even if you just reset xcodeproj
in your external git client :). So it's not connected with XcodeGen.
In general, any modification of the project outside of Xcode will cause that.
Is the issue still present in Xcode 15.4?
Sadly this still seems to be present in Xcode 15.4 😞 How this issue still hasn't been fixed baffles me
Unfortunately triggering resolve packages in a postgen command didn't fix the issue for me.
What helps a bit is setting defaults write com.apple.dt.Xcode IDEPackageOnlyUseVersionsFromResolvedFile 1
. It will prevent Xcode from deleting the Packages.resolved file. Even though the project still won't build until packages are resolved, at least there's no longer a need to restore the package lock.