Repository navigation
Make "swift-" prefix optional in MainSnapshotParser - #240
cmcgee1024 merged 2 commits into
Conversation
Existing tools like `swiftenv` use `DEVELOPMENT-SNAPSHOT-YYYY-mm-dd-a` for main snapshots, without the `swift-` prefix. The `MainSnapshotParser` should be able to handle this and this change mirrors the `ReleaseSnapshotParser` in this regard, which already supports both `swift-` prefixed and unprefixed versions.
| /// - main-snapshot | ||
| /// - main-SNAPSHOT-YYYY-mm-dd | ||
| /// - main-SNAPSHOT | ||
| /// - swift-DEVELOPMENT-SNAPSHOT-YYYY-mm-dd-a |
There was a problem hiding this comment.
question: Since the swift prefix is optional with this change, should the examples with the swift prefix remain here to indicate that these are valid selectors?
There was a problem hiding this comment.
I made this example style aligned with ReleaseSnapshotParser's comment, but just changed to include them.
| struct MainSnapshotParser: ToolchainSelectorParser { | ||
| static let regex: Regex<(Substring, Substring?)> = | ||
| try! Regex("^(?:main-snapshot|swift-DEVELOPMENT-SNAPSHOT|main-SNAPSHOT)(?:-([0-9]{4}-[0-9]{2}-[0-9]{2}))?(?:-a)?$") | ||
| try! Regex("^(?:swift-)?(?:main-snapshot|DEVELOPMENT-SNAPSHOT|main-SNAPSHOT)(?:-([0-9]{4}-[0-9]{2}-[0-9]{2}))?(?:-a)?$") |
There was a problem hiding this comment.
question: Does this regex now permit selections like swift-main-snapshot-YYYY-mm-dd-a? Does this make sense as a potential selector?
There was a problem hiding this comment.
Yes, it's intentional. Given that we already accept swift-a.b-snapshot-YYYY-mm-dd, it makes main and release channel selectors more consistent.
cmcgee1024
left a comment
There was a problem hiding this comment.
Thank you for your contribution. Overall this looks good. I've added a couple of questions.
|
@swift-ci test macOS |
|
@swift-ci test macOS |
|
Thanks again @kateinoigakukun for your contribution. |
Existing tools like
swiftenvuseDEVELOPMENT-SNAPSHOT-YYYY-mm-dd-afor main snapshots, without theswift-prefix. TheMainSnapshotParsershould be able to handle this and this change mirrors theReleaseSnapshotParserin this regard, which already supports bothswift-prefixed and unprefixed versions.