Skip to content
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

xcode-archive step fails due to Package.resolved #367

Open
1 task done
ahmdmhasn opened this issue Dec 18, 2024 · 0 comments
Open
1 task done

xcode-archive step fails due to Package.resolved #367

ahmdmhasn opened this issue Dec 18, 2024 · 0 comments

Comments

@ahmdmhasn
Copy link

Troubleshooting

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 5.3.0
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME

Issue description

The xcode-archive step fails with the following error in our CI pipeline:

xcodebuild: error: Could not resolve package dependencies:  
  a resolved file is required when automatic dependency resolution is disabled and should be placed at...
This issue occurs when we run the xcodebuild command with the -disableAutomaticPackageResolution flag.
Context:

Our project includes both a .xcworkspace and a .xcodeproj.
One Package.resolved files exists in the workspace directory: <Project>.xcworkspace/xcshareddata/swiftpm/Package.resolved

The pipeline is configured to build the .xcworkspace file using the following command:

    - xcode-archive@5.1:
        inputs:
        - scheme: <Scheme>
        - configuration: Debug
        - distribution_method: ad-hoc
        - compile_bitcode: 'no'
        - upload_bitcode: 'no'
        - export_all_dsyms: 'yes'
        - xcodebuild_options: |
            -disableAutomaticPackageResolution
            -skipPackagePluginValidation
            -skipMacroValidation
Observations:

Both Package.resolved files are valid, but it is unclear which one the step should use.
Running locally with the same command works as expected.
Switching to build the .xcworkspace instead resolves the issue.

Bitrise info

Running resolve Swift package dependencies
[07:08:25] Resolving package dependencies...
[07:08:25] $ xcodebuild "-workspace" "/Users/[REDACTED]/git/ProjectName.xcworkspace" "-scheme" "SchemaName" "-configuration" "Debug" "-resolvePackageDependencies" "-resolvePackageDependencies" "-disableAutomaticPackageResolution" "-skipPackagePluginValidation" "-skipMacroValidation"
Command line invocation:
    /Applications/Xcode-16.1.0.app/Contents/Developer/usr/bin/xcodebuild -workspace /Users/[REDACTED]/git/ProjectName.xcworkspace -scheme Schema -configuration Debug -resolvePackageDependencies -resolvePackageDependencies -disableAutomaticPackageResolution -skipPackagePluginValidation -skipMacroValidation
...
Resolved source packages:
...
[07:11:16] Reading build settings...
[07:11:16] $ xcodebuild "-workspace" "/Users/[REDACTED]/git/ProjectName.xcworkspace" "-scheme" "Schema" "-configuration" "Debug" "-showBuildSettings"
...
[07:11:23] Reading build settings...
[07:11:23] $ xcodebuild "-project" "/Users/[REDACTED]/git/ProjectName.xcodeproj" "-target" "Target" "-configuration" "Debug" "-showBuildSettings" "-resolvePackageDependencies" "-disableAutomaticPackageResolution" "-skipPackagePluginValidation" "-skipMacroValidation"
Failed to execute Step main logic:
  failed to read project platform: /Users/[REDACTED]/git/ProjectName.xcworkspace: failed to get target (Target) build settings: xcodebuild "-project" "/Users/[REDACTED]/git/ProjectName.xcodeproj" "-target" "Schema" "-configuration" "Debug" "-showBuildSettings" "-resolvePackageDependencies" "-disableAutomaticPackageResolution" "-skipPackagePluginValidation" "-skipMacroValidation" command failed, output: Command line invocation:
  /Applications/Xcode-16.1.0.app/Contents/Developer/usr/bin/xcodebuild -project /Users/[REDACTED]/git/ProjectName.xcodeproj -target Schema -configuration Debug -showBuildSettings -resolvePackageDependencies -disableAutomaticPackageResolution -skipPackagePluginValidation -skipMacroValidation
  User defaults from command line:
  IDEPackageOnlyUseVersionsFromResolvedFile = YES
  IDEPackageSupportUseBuiltinSCM = YES
  Resolve Package Graph
  a resolved file is required when automatic dependency resolution is disabled and should be placed at /Users/[REDACTED]/git/ProjectName.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved. Running resolver because the following dependencies were added: 'swift-nio' (https://github.com/apple/swift-nio.git)
  2024-12-18 07:11:24.826 xcodebuild[35061:66303] Writing error result bundle to /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/ResultBundle_2024-18-12_07-11-0024.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/[REDACTED]/git/ProjectName.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved. Running resolver because the following dependencies were added: 'swift-nio' (https://github.com/apple/swift-nio.git)

Steps to reproduce

  1. Use xcode-archive@5.3
  2. Disable automatic package resolution
  3. Remove cache
  4. Run archive step
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant