rules_swift_package_manager icon indicating copy to clipboard operation
rules_swift_package_manager copied to clipboard

feat: use suffixed repo name as package name

Open watt opened this issue 1 year ago • 2 comments

Resolves #1057.

Following the recommendation from the discussion there, this uses the repo name suffixed with .rspm as the package name.

watt avatar May 14 '24 02:05 watt

From my quick read, it looks like passing package_name will be a noop if the package does not use the package access modifier. Is that correct?

That's my understanding, yes. I believe SwiftPM does this by default, using the package name in Package.swift.

watt avatar May 14 '24 21:05 watt

Seems that downstream compilation workers got confused by the @-prefixed package name and that caused tests to fail in CI. I've tweaked this slightly to trim the leading @.

watt avatar May 16 '24 01:05 watt

I'm having trouble confirming locally, but it seems like the failing tests are running with Xcode 14.3/Swift 5.8, which doesn't support the -package-name compiler argument. Is the expectation that rules_swift_package_manager should gate on Swift version, or should rules_swift be handling that?

watt avatar May 17 '24 01:05 watt

I'm having trouble confirming locally, but it seems like the failing tests are running with Xcode 14.3/Swift 5.8, which doesn't support the -package-name compiler argument. Is the expectation that rules_swift_package_manager should gate on Swift version, or should rules_swift be handling that?

We should be using 15.0.1 in CI. However, we are not locking the Xcode version for most of the examples.

@brentleyjones @luispadron Should we put this functionality behind a flag or settable on the Bazel module tag class/repository rule?

cgrindel avatar May 17 '24 12:05 cgrindel

rules_swift should ignore that attribute when it's not supported. If it doesn't, we should fix it.

brentleyjones avatar May 17 '24 12:05 brentleyjones

rules_swift should ignore that attribute when it's not supported. If it doesn't, we should fix it.

@brentleyjones Should I open an issue on rules_swift? Not sure what the next step ought to be here.

watt avatar May 21 '24 00:05 watt

I can look at fixing that tomorrow if no one else has time, but rules_swift releases are sort of blocked right now as we get some other stuff merged so not sure when this repo could pick that fix up

luispadron avatar May 21 '24 01:05 luispadron

Could/should we flag this in this repo based on the swift tools version of the Package.swift?

luispadron avatar May 21 '24 01:05 luispadron

@watt @cgrindel Brentley and I discussed a lil and it probably makes more sense to gate the setting of package_name in this repository and not in rules_swift. Reasoning being SPM wouldn't set this flag if its in an older package specification and it might be odd to have rules_swift just ignore package_name without some warning/failure when it's not supported by the compiler.

luispadron avatar May 21 '24 16:05 luispadron

it probably makes more sense to gate the setting of package_name in this repository and not in rules_swift

SGTM. What is the correct gate? The Swift tools version?

cgrindel avatar May 25 '24 18:05 cgrindel

Yeah I imagine that's how it works in SPM but haven't checked

luispadron avatar May 25 '24 19:05 luispadron

Just pushed an update that gates package_name behind the tools version. The semver parsing is naive but hopefully sufficient for this purpose. If not, please lmk!

watt avatar Jun 01 '24 01:06 watt