Add support for Swift Package Manager 5.6 #174
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Swift Package Manager 5.6, bundled with Xcode 13.3 (currently in beta), updates the
Package.resolved
format to a new version 2. The JSON itself slightly changes, preventing LicensePlist from extracting correct dependency information.This PR adds support for the new V2 format while preserving compatibility with version 1. Any feedback or improvement proposals are of course welcome.
Thank you very much for considering this PR and for this really helpful tool.
Format changes
While the
Package.resolved
JSON V2 format is quite similar to V1, thepackage
field has been replaced with a similaridentity
field:Its value reflects the repository name more than the package name, thus the output delivered by license-plist slightly changes in comparison to the output generated from V1 format.
Code changes
I added a few internal types to parse the V2 format while renaming existing types used to parse the V1 format. I kept
SwiftPackage
to consolidate common dependency information. V1 and V2 parsing are attempted in sequence, with their results simply mapped to this common type. No other changes are required.Test suite
I added a few test cases for the V2 format and added a V1 suffix to existing tests.