Hi all,
I would like to obtain the same result as Xcode's Update to Latest Package Versions.
I have tried to use:
xcodebuild -scheme SchemeName -resolvePackageDependencies
However it doesn't appear to always work...
Hi all,
I would like to obtain the same result as Xcode's Update to Latest Package Versions.
I have tried to use:
xcodebuild -scheme SchemeName -resolvePackageDependencies
However it doesn't appear to always work...
did it ever worked?
here is the things I've tried:
-disablePackageRepositoryCach
-clonedSourcePackagesDirPath
still xcodebuild resolves all packages to the ones we had and does not update
Nope, it appears there’s still no way to do this using xcodebuild
. Resolving packages without a resolved file will update packages if the cached checkout version is newer, but won’t actively update anything.
We have a GitHub action that updates to lastest packages once a week using this step:
- name: Update Swift packages
run: |
NEW_SPM_CLONE_DIR=$(mktemp -d)
find . -name Package.resolved -exec rm {} \;
./scripts/resolve-swift-package-dependencies.zsh $NEW_SPM_CLONE_DIR
./scripts/resolve-swift-package-dependencies.zsh $NEW_SPM_CLONE_DIR \
-workspace Workspace.xcworkspace -scheme Scheme
rm -rf $NEW_SPM_CLONE_DIR
and this script: resolve-swift-package-dependencies.zsh
#!/bin/zsh
if [[ $# -ge 1 ]]
then
echo Using Clone folder: $1
else
cat << EndOfUsage
Resolve Swift Packages Dependencies with one clean retry
Usage:
$ZSH_ARGZERO directory [additional options]
directory is where to clone dependent Swift Packages
additional options for xcodebuild, e.g. -workspace MyWorkspace.xcworkspace -scheme MyScheme
EndOfUsage
exit 1
fi
cloneFolder=$1
shift
xcodebuild $@ -resolvePackageDependencies -clonedSourcePackagesDirPath $cloneFolder
if [[ $? == 0 ]]
then
echo Resolved Swift Packages Dependencies on the first try
else
echo Removing clone folder: $cloneFolder
rm -rf $cloneFolder
echo ::notice:: Retrying package resolution
xcodebuild $@ -resolvePackageDependencies -clonedSourcePackagesDirPath $cloneFolder
fi
here is open source project with GitHub action to update dependencies:
So, essentially, delete the resolved file and the SPM cache and then try to resolve again?