-
Notifications
You must be signed in to change notification settings - Fork 32
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
Swift registry support #1016
Comments
Is this something you'd want to implement and PR @watt? We can answer questions in here if needed. |
I'm willing to try, though I will definitely need some guidance. Aside from updating the data models that map to JSON files, any initial thoughts on what logic might need to be touched? |
I'm not super familiar with this part of the code so maybe @cgrindel could be more helpful. I'd try updating this area first to support registry ID: https://github.com/cgrindel/rules_swift_package_manager/blob/main/gazelle/internal/swiftpkg/dependency.go and seeing how far we get. We likely just need to map into the package name which should be possible. |
@watt Thanks for filing this issue. What is added to the As a little background, I am currently working #924 which will radically change how external dependencies are downloaded. In essence, it relies on the information stored in the |
Unfortunately, we can't use the files downloaded in the At a minimum, I presume that the |
I drafted up an implementation in #1043. It'll surely need some work, but in the included example case, this works for me. This draft hardcodes a registry URL rather than reading swift_registry_package(
name = "swiftpkg_apple.swift_collections",
dependencies_index = "@//:swift_packages_index.json",
url = "https://artifactory.global.square/artifactory/api/swift/swift-test/apple/swift-collections/1.1.0.zip",
) Or to read the registry config later, during swift_registry_package(
name = "swiftpkg_apple.swift_collections",
dependencies_index = "@//:swift_packages_index.json",
id = "apple.swift-collections",
version = "1.1.0",
) The latter mirrors Package.swift more closely but the work involved will effectively be the same either way, I think? This draft generates rules like the former. |
Yes. The format is described here. I think picking a registry is a matter of merging the user config with project config, and then choosing either a scoped registry or the default.
Nope. Mine is stored in |
As part of #924, we are moving away from generating Bazel stuff in I like your second option. However, I think that it will be something closer to this: swift_registry_package(
name = "swiftpkg_apple_swift_collections",
registry_json = "@//:registries.json",
id = "apple.swift-collections",
version = "1.1.0",
) The repository rule can read the registries file look up the URL and perform the download. WDT? |
Ah, OK. Does that mean the
Is
|
I pushed an update that reads the registry config from starlark. For now, it uses a hardcoded path of |
It looks like there's currently no support for package dependencies resolved from a package registry. That is, packages defined with the
id
syntax:If Package.swift contains a dependency like this, the
swift_update_pkgs
task fails with this error:From a cursory look at the source it seems like registry dependencies aren't part of the data model. I'm not sure what additional changes would be necessary on top of that.
I'm guessing it might be a pain to build this out if one doesn't have access to a registry already, since there are no public Swift registries I am aware of. I'm happy to help test things or provide samples from a project resolved against a registry if it's useful.
The text was updated successfully, but these errors were encountered: