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

Add support for Swift Package Manager 5.6 #174

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

defagos
Copy link
Contributor

@defagos defagos commented Feb 3, 2022

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, the package field has been replaced with a similar identity field:

// Version 1
{
  "package": "AppCenter",
  "repositoryURL": "https://github.com/microsoft/appcenter-sdk-apple.git",
  "state": {
    "branch": null,
    "revision": "b84bc8a39ff04bc8d5ae7b4d230c171c562891aa",
    "version": "4.4.1"
  }
}

// Version 2
{
  "identity" : "appcenter-sdk-apple",
  "kind" : "remoteSourceControl",
  "location" : "https://github.com/microsoft/appcenter-sdk-apple.git",
  "state" : {
    "revision" : "b84bc8a39ff04bc8d5ae7b4d230c171c562891aa",
    "version" : "4.4.1"
  }
}

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.

@mono0926 mono0926 merged commit cde447b into mono0926:main Mar 1, 2022
@mono0926
Copy link
Owner

mono0926 commented Mar 1, 2022

@defagos

Thank you for the pull request 👍
Sorry for the long delay in merging 🙏
Version 3.18.0 has been released 🚀
https://github.com/mono0926/LicensePlist/releases/tag/3.18.0

@defagos
Copy link
Contributor Author

defagos commented Mar 1, 2022

Thank you very much for merging my PR and for releasing a new version!

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

Successfully merging this pull request may close these issues.

2 participants