tuist icon indicating copy to clipboard operation
tuist copied to clipboard

`.package.resolved` is not generated

Open tdkn opened this issue 8 months ago • 12 comments

What happened?

If you use Local Package with Xcode's default integration mechanism, the .package.resolved file is not generated by Tuist, so builds will fail on Xcode Cloud, which expects the existence of a *.xcworkspace/xcshareddata/swiftpm/Package.resolved file.

How do we reproduce it?

  1. Clone https://github.com/tdkn/tuist-minimal-reproduction (or zipped version is here)
  2. Run tuist generate --no-open
  3. The .package.resolved file should be present but is missing.
  4. Also, *.xcworkspace/xcshareddata/swiftpm/Package.resolved should have been generated, but it's not there.
  5. Simulate Xcode Cloud's Resolve package dependencies task locally.
  6. And then an error occurs.

Error log

Simulate Xcode Cloud's Resolve package dependencies task locally.

$ xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -disableAutomaticPackageResolution -workspace ./MyWorkspace.xcworkspace -scheme TuistMinimalReproduction -hideShellScriptEnvironment

The following error outputs:

Command line invocation:
    /Applications/Xcode-15.4.0.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -disableAutomaticPackageResolution -workspace ./MyWorkspace.xcworkspace -scheme TuistMinimalReproduction -hideShellScriptEnvironment

User defaults from command line:
    HideShellScriptEnvironment = YES
    IDEPackageOnlyUseVersionsFromResolvedFile = YES
    IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph
a resolved file is required when automatic dependency resolution is disabled and should be placed at /Users/tdkn/Workspaces/private/TuistMinimalReproduction/MyWorkspace.xcworkspace/xcshareddata/swiftpm/Package.resolved. Running resolver because the following dependencies were added: 'swift-algorithms' (https://github.com/apple/swift-algorithms)

Resolved source packages:
  MyPackage: /Users/tdkn/Workspaces/private/TuistMinimalReproduction/MyPackage

2024-05-28 16:08:50.337 xcodebuild[90624:1899640] Writing error result bundle to /var/folders/bz/2q5vvytd059by91lfx4b39380000gn/T/ResultBundle_2024-28-05_16-08-0050.xcresult
xcodebuild: error: Could not resolve package dependencies:
  a resolved file is required when automatic dependency resolution is disabled and should be placed at /Users/tdkn/Workspaces/private/TuistMinimalReproduction/MyWorkspace.xcworkspace/xcshareddata/swiftpm/Package.resolved. Running resolver because the following dependencies were added: 'swift-algorithms' (https://github.com/apple/swift-algorithms)

Screenshot of Xcode Cloud Log (Web) CleanShot 2024-05-28 at 16 50 49

macOS version

14.4.1

Tuist version

4.14.0

Xcode version

15.4

tdkn avatar May 28 '24 07:05 tdkn