rules_swift_package_manager icon indicating copy to clipboard operation
rules_swift_package_manager copied to clipboard

Support for `package` access modifier

Open watt opened this issue 1 year ago • 3 comments

SE-0386 introduced the package access level. Packages using this require a -package-name argument to the compiler, which rules_swift rules support via a package_name argument.

SE-0386 says this about the package name:

The build system should make a best effort to ensure that package names are unique. The Swift Package Manager already has a concept of a package identity string for every package. This string is verified to be unique, and it already works as a package name, so SwiftPM will pass it down automatically. Other build systems such as Bazel may need to introduce a new build setting for a package name.

Since RSPM translates rules from SwiftPM, I think using the SwiftPM package name from Package.swift directly is the most obvious thing to do here. It should be fairly straightforward to copy this to the package_name arg when generating swift rules.

watt avatar May 04 '24 01:05 watt

That name probably isn’t unique enough if we consider that non-rules_swift_package_manager targets can also set a package_name. It probably also needs a rspm prefix/suffix.

I agree with the feature request though.

brentleyjones avatar May 04 '24 02:05 brentleyjones

What if we used the repo name as the package name? For example, if the package identifier is foo-bar, the repo name would be swiftpkg_foo_bar. Would that be sufficient?

cgrindel avatar May 04 '24 20:05 cgrindel

I would still want a .rspm suffix. Just to prevent collisions more. But yeah that works.

brentleyjones avatar May 05 '24 13:05 brentleyjones