Skip to content

Conversation

kateinoigakukun
Copy link
Member

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.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)?$")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Does this regex now permit selections like swift-main-snapshot-YYYY-mm-dd-a? Does this make sense as a potential selector?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@cmcgee1024 cmcgee1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution. Overall this looks good. I've added a couple of questions.

@cmcgee1024
Copy link
Member

@swift-ci test macOS

@cmcgee1024
Copy link
Member

@swift-ci test macOS

@cmcgee1024 cmcgee1024 merged commit 09e12af into swiftlang:main Mar 5, 2025
19 checks passed
@cmcgee1024
Copy link
Member

Thanks again @kateinoigakukun for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants