Closed BartoszCichecki closed 3 months ago
@BartoszCichecki Thanks for the report. This is happening because there is a package listed in your Project.xcodeproj
that is missing from your Package.resolved
so the plugin has nothing to check against. Do you know why this might be the case for your project? If you are able to put up an example repo I can take a look as well.
In the meantime, this crash has been fixed in 0.1.2 and a warning will print to your console or CI logs identifying the missing package.
Thanks for quick response. I updated to 0.1.2 and it doesn't crash, but it prints quite a bit of warnings now for what looks to be all packages. For example:
Unable to locate the current version for adjust/ios_sdk (https://github.com/adjust/ios_sdk) in Project.xcworkspace/xcshareddata/swiftpm/Package.resolved
and when I check the Package.resolved
file, I can find the version:
{
"package": "Adjust",
"repositoryURL": "https://github.com/adjust/ios_sdk",
"state": {
"branch": null,
"revision": "a7b50f187855dfc0fb84114c22661216393387ae",
"version": "4.32.1"
}
},
Danger is configured like this:
# SPM Version Updates
spm_version_updates.check_when_exact = true
spm_version_updates.report_above_maximum = true
spm_version_updates.check_for_updates("Project.xcodeproj")
Both dangerfile, Project.xcodeproj and Project.xcworkspace are in the root dir of the repo. Path to Package.resolved is also correct.
Maybe the parsing of Package.resolved is failiing? Let me know what info you need.
Hmm, I'm guessing this is due to how Xcode mangles repo URLs. Can you look at the Adjust URL in Project.xcodeproj/project.xcodeproj
?
4153F63E28FD5048003BEEA3 /* XCRemoteSwiftPackageReference "ios_sdk" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/adjust/ios_sdk";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.29.0;
};
};
In addition to having a Project.xcworkspace/xcshareddata/swiftpm/Package.resolved
do you also have a Project.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
file? (note in the second path project.xcworkspace
is always that name regardless of your actual project name).
Digging around I came across this link https://stackoverflow.com/a/71721448 which suggests there may be multiple .resolved files in projects that use both SPM and CocoaPods. (According to Apple the .xcodeproj form is canonically correct https://developer.apple.com/documentation/xcode/building-swift-packages-or-apps-that-use-them-in-continuous-integration-workflows#Use-the-expected-version-of-a-package-dependency )
I'll release a new version soon to handle this issue and the URL mangling cases, and also add more debug logging. In the meantime you can email me your Package.resolved if you're comfortable with that Harold . Martin @ gmail
Working on addressing the multiple resolved files in https://github.com/hbmartin/danger-spm_version_updates/pull/2 Will follow-up on the URL issue in another PR
Addressing URL issue in https://github.com/hbmartin/danger-spm_version_updates/pull/3
In addition to having a Project.xcworkspace/xcshareddata/swiftpm/Package.resolved do you also have a Project.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved file? (note in the second path project.xcworkspace is always that name regardless of your actual project name).
There is only 1 packaged resolved file: Project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Also tested 1.3 with exactly the same result.
I think we're finally on the verge of solving this... does your Package.resolved have "version": 1
?
If so it's not currently supported... but working on it now should be done tomorrow
Yes! Thanks! 👏
There is an issue while running this plugin:
Any workarounds?