Skip to content

Bug: Plist - Error: Version 7 of workspace-state.json is not supported #148

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

Open
JulesMoorhouse opened this issue Jun 2, 2025 · 11 comments

Comments

@JulesMoorhouse
Copy link

JulesMoorhouse commented Jun 2, 2025

if test -d "/opt/homebrew/bin/"; then
  PATH="/opt/homebrew/bin/:${PATH}"
fi

export PATH

if command -v swift-package-list &> /dev/null; then
    OUTPUT_PATH=$SOURCE_ROOT/$TARGETNAME
    swift-package-list "$PROJECT_FILE_PATH" --output-type plist --output-path "$OUTPUT_PATH" --requires-license
else
    echo "warning: swift-package-list not installed, https://github.com/FelixHerrmann/swift-package-list"
    echo "use brew tap FelixHerrmann/tap"
    echo "use brew install swift-package-list"
fi

Hey,

I'm trying to generate a plist.

Admittedly I have some additional UI code in my version of this code.
But the building of the plist from my build phase fails...

I think the issue is that V7 is missing from...
I can see the PR to add this, but I think it's missing from :-

SwiftPackageListCore/Files/PackageResolved.swift

I've tried adding it, but I think an additional struct is required.

Please can this be added ?

Thanks,

Jules.

@FelixHerrmann
Copy link
Owner

Hey @JulesMoorhouse, are you on version 4.7.0 or higher? You can check with swift-package-list --version in your terminal.

@JulesMoorhouse
Copy link
Author

4.7.1

@FelixHerrmann
Copy link
Owner

Interesting, it is impossible to get this exact error in 4.7.1 with V7 (

throw RuntimeError("Version \(version.version) of workspace-state.json is not supported")
). Can you invoke the tool manually from your Terminal with swift-package-list <path-to-your-xcodeproj> --requires-license and see if there is the same error or if you get the JSON output?

@JulesMoorhouse
Copy link
Author

Ok, I've upgraded to 4.8.0

and ran

swift-package-list "/Users/jm/repos/MyApp/MyApp.xcodeproj" --requires-license

And get this error

Error: Version 7 of workspace-state.json is not supported

Hmmm, I right clicked on the package in Xcode and opened a terminal...

20:48 ➜  swift-package-list git:(4.8.0) make install
swift build --configuration release --product swift-package-list
Fetching https://github.com/apple/swift-argument-parser from cache
Fetched https://github.com/apple/swift-argument-parser from cache (0.93s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 1.5.0 (0.11s)
Computed https://github.com/apple/swift-argument-parser at 1.5.0 (0.00s)
Creating working copy for https://github.com/apple/swift-argument-parser
Working copy of https://github.com/apple/swift-argument-parser resolved at 1.5.0
Building for production...
[15/15] Linking swift-package-list
Build of product 'swift-package-list' complete! (12.21s)
sudo mkdir -p /usr/local/bin
Password:
sudo cp -f .build/release/swift-package-list /usr/local/bin/swift-package-list
20:49 ➜  swift-package-list git:(4.8.0) swift-package-list --version
4.1.0
20:49 ➜  swift-package-list git:(4.8.0) pwd
/Users/jm/Library/Developer/Xcode/DerivedData/MyApp-gzdxsjfyidrbogbyigwwikraorls/SourcePackages/checkouts/swift-package-list
20:49 ➜  swift-package-list git:(4.8.0)

Why does it say 4.1.0

Confused...

@JulesMoorhouse
Copy link
Author

Ahh I must have used homebrew originally.

Works now 👍

Cheers.

@JulesMoorhouse
Copy link
Author

So is it not possible to use the spm version in the build phase?

Seemed weird having two versions.

@FelixHerrmann
Copy link
Owner

Good to hear that you got it working now!

I recommend deciding on which way you want to use the tool in your project:

  • homebrew installation + run script with homebrew path addition
  • manual installation (clone repo & make install) + run script
  • use the build tool plugin from the package directly which requires no extra installation of the tool on each machine, Xcode handles that

The most seamless way IMO is the plugin, especially on a basic project setup like yours. Let me know if you want more guidance about that, the README section about that topic should be a good starting point.

Based on the run script you sent the config would be:

// SwiftPackageList configuration file
// Check out https://github.com/FelixHerrmann/swift-package-list#build-tool-plugin for all possible configuration options.

{
    project: {
        outputType: "plist",
        requiresLicense: true,
    },
}

@JulesMoorhouse
Copy link
Author

Ahhh that sounds great.
Can I add the plugin to my spm instead ?

@FelixHerrmann
Copy link
Owner

Yes, just add the plugin to the target and config to the project root. To clean up the existing setup remove the custom run script and the generated swift-package-list.plist from your project, this is handled by the build now and the output file gets injected automatically.

@JulesMoorhouse
Copy link
Author

Adding spl to my spm, doesn't show in the build tool from build phase 🤔

@FelixHerrmann
Copy link
Owner

So you have added the package in Project/Package Dependencies and in Target/Build Phases/Run Build Tool Plugins it does not appear? Xcode restart sometimes helps with such issues.

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

2 participants