newrelic / newrelic-ios-agent-spm

This repository hosts the Swift Package Manager deployment of the iOS agent
Apache License 2.0
15 stars 9 forks source link

Can't resolve packages #56

Open enasaz9 opened 3 weeks ago

enasaz9 commented 3 weeks ago

Whenever I'm trying to build the app and try to resolve packages I get an error.

Description

I can't resolve my packages and getting the below error using 7.5.1 package Screenshot 2024-08-21 at 1 15 09 PM

Steps to Reproduce

Expected Behavior

Relevant Logs / Console output

Your Environment

XCode Version 15.4 (15F31d)

Additional context

danielctull commented 3 weeks ago

We're seeing the same issues with the 7.5.1 package.swift file as well.

This is the output we see for resolving the package using Swift 5.10:

[1/1472] Fetching newrelic-ios-agent-spm
Fetched https://github.com/newrelic/newrelic-ios-agent-spm.git from cache (0.95s)
Computing version for https://github.com/newrelic/newrelic-ios-agent-spm.git
error: Invalid manifest (compiled with: ["/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.rCY6q5/vfs.yaml", "-L", "/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/usr/lib/swift/pm/ManifestAPI", "-swift-version", "5", "-I", "/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "5.3.0", "/Package.swift", "-Xfrontend", "-disable-implicit-concurrency-module-import", "-Xfrontend", "-disable-implicit-string-processing-module-import", "-v", "-o", "/tmp/TemporaryDirectory.zURgPa/newrelic-ios-agent-spm-manifest"])
/usr/bin/swift-frontend -frontend -c -primary-file /Package.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /usr/lib/swift/pm/ManifestAPI -vfsoverlay /tmp/TemporaryDirectory.rCY6q5/vfs.yaml -swift-version 5 -package-description-version 5.3.0 -new-driver-path /usr/bin/swift-driver -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -empty-abi-descriptor -resource-dir /usr/lib/swift -module-name main -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -o /tmp/TemporaryDirectory.CQLN7b/Package-1.o
error: fatalError
Swift version 5.10.1 (swift-5.10.1-RELEASE)
Target: x86_64-unknown-linux-gnu
/Package.swift:10:59: error: 'v10' is unavailable
        .iOS(.v9), .macOS(.v10_14), .tvOS(.v9), .watchOS(.v10)
                                                          ^~~
PackageDescription.SupportedPlatform:99:27: note: 'v10' was introduced in PackageDescription 5.9
        public static let v10: SupportedPlatform.WatchOSVersion
                          ^ in https://github.com/newrelic/newrelic-ios-agent-spm.git
TWiStErRob commented 3 weeks ago

Looks like this is fixed by https://github.com/newrelic/newrelic-ios-agent-spm/pull/57

cdillard-NewRelic commented 3 weeks ago

Hello @enasaz9 @danielctull @TWiStErRob . Thanks for raising this issue. We've fixed this in the 7.5.1 tag provided on this repository.

danielctull commented 3 weeks ago

@cdillard-NewRelic: Just for future reference, it's not a good idea to force-push tags to Swift package repositories as SPM has a security feature whereby it will reject new hashes for previously seen tags.

From the Swift 5.6 release post:

To increase the security of packages, SwiftPM performs trust on first use (TOFU) validation. The fingerprint of a package is now being recorded when the package is first downloaded from a Git repository. Subsequent downloads must have fingerprints matching previous recorded values, otherwise it would result in build warnings or failures depending on settings.

For anyone who had pulled the previous version 7.5.1, this will cause a the following package resolution failure:

Revision c7228afb2131f47e79f6f0ea8c6a2586802021a1 for newrelic-ios-agent-spm remoteSourceControl https://github.com/newrelic/newrelic-ios-agent-spm.git version 7.5.1 does not match previously recorded value 10764844ceac73e00d717e93aed31e8bb7c7ec23

For anyone else finding this problem, the fix for this is to find the fingerprint in ~/.swiftpm/security/fingerprints and remove the previous 7.5.1 reference.

cdillard-NewRelic commented 3 weeks ago

Ok, Thanks for the info. Let me know if you have any issues with 7.5.1