apple / swift-crypto

Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
https://apple.github.io/swift-crypto
Apache License 2.0
1.47k stars 164 forks source link

Cannot resolve the dependencies with swift package registry #295

Open erikgadireddi opened 3 days ago

erikgadireddi commented 3 days ago

Question Checklist

Question Subject

How to make the Package.swift of this project work with swift package resolve --use-registry-identity-for-scm if I am using swift package registry where is the swift-asn1 package hosted. I have everything set up correctly, but I am still getting error: error: 'apple.swift-crypto': product 'SwiftASN1' required by package 'apple.swift-crypto' target '_CryptoExtras' not found in package 'swift-asn1'. Did you mean '.product(name: "SwiftASN1", package: "apple.swift-asn1")'? It seems to me the line below from Package.swift, does not work properly with this command swift package resolve --use-registry-identity-for-scm : .product(name: "SwiftASN1", package: "swift-asn1") in Package.swift . I already filled a bug issue in spm: https://github.com/swiftlang/swift-package-manager/issues/8116 , but I still hope I can somehow find a way how to make it work..

What I tried:

1. Attempt

I would guess the .product(name: "SwiftASN1", package: "swift-asn1") should be .product(name: "SwiftASN1", package: "apple.swift-asn1"), but then the spm returns error: error: 'swift-crypto': unknown package 'apple.swift-asn1' in dependencies of target '_CryptoExtras'; valid packages are: 'swift-asn1' (from 'https://github.com/apple/swift-asn1.git') I would guess the spm should resolve it but it does not...

2. Attempt

Changing the url to id: .package(id: "https://github.com/apple/swift-asn1.git", from: "1.2.0") Based on the swift package registry readme I got: error: 'error: 'swift-crypto': invalid manifest (evaluation failed) Invalid package identifier: 'https://github.com/apple/swift-asn1.git' So this does not seem to work as expected as well.

Question Description

The package has id apple.swift-asn1 based on the syntax scope.name. I have also the package metadata such as remoteUrls: [git@github.com:apple/swift-asn1.git, https://github.com/apple/swift-asn1.git]. The swift-package-registry is hosted on artifactory.

Tools versions: swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4) Target: arm64-apple-macosx14.0 Darwin M-FVFFG20KQ05P 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:46 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T8103 arm64

Lukasa commented 3 days ago

Hrm, this seems like a question for Swift Package Manager: I'm not sure how this is supposed to work. If they can give guidance we'll happily adopt it.