skip to Main Content

After retagging a git commit I’m no longer able to fetch the package, because SP Manager uses some cache which I can’t find and clean. Getting error:

Revision 30c16cab9c718416fee2191ff2ac0b6f91eeb511 for base
remoteSourceControl https://github.com/myUser/myRepo version 1.0.0
does not match previously recorded value

I cleaned all known to me places: local .build folder, SPM caches in Home and Library/Caches folders, DerivedData, removed Package.resolved.
Using Swift 5.7, trying to generate via swift package generate-xcodeproj.
Does anyone know where this cache is?

2

Answers


  1. It depends on whether you’re building via Xcode, or directly via swift build.

    Xcode keeps its packages in ~/Library/Developer/Xcode/DerivedData/<your project>/SourcePackages/checkouts/.

    SPM keeps them in .build/checkouts of the project folder.

    In general, you should never change the commit a version tag points to, for precisely the reasons you experienced. The version numbers form the identity of a package version (not a commit hash, hash of the files, or anything like that). All the systems that are made to work with package rely on the notion that equal version number means they’re identical. You’re invalidating this assumption, and you’ll cause bugs all over. Release a new minor version with your fix, instead.

    Login or Signup to reply.
  2. This one solves the issue for me.

    rm -rf ~/Library/Caches/org.swift.swiftpm
    rm -rf ~/Library/org.swift.swiftpm
    

    From https://blog.todosobreios.com/solucionar-problemas-de-swift-pacakge-manager-spm/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search