Skip to content

Pin SwiftSyntaxBuilder version for generate-swiftsyntaxbuilder #826

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

Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Sep 21, 2022

This pretty much re-opens #580 on top of current main.

This resolves a bootstrapping issue that running generate-swiftsyntaxbuilder might modify SwiftSyntaxBuilder, which in turn makes it impossible to build and run generate-swiftsyntaxbuilder.

Copy link
Member

@fwcd fwcd left a comment

Choose a reason for hiding this comment

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

Looks good, just some minor notes below!

import PackageDescription

let package = Package(
name: "SwiftSyntaxGeneration",
Copy link
Member

@fwcd fwcd Sep 22, 2022

Choose a reason for hiding this comment

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

Should the package name match the folder name? For consistency, wdyt about naming the package (and the folder) in PascalCase, i.e. CodeGeneration without the hyphen?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I renamed it.

"--gyb-only",
action="store_true",
help="""
Only generate gyb templates (and not generate-swift-syntax-builder's templates)
Copy link
Member

Choose a reason for hiding this comment

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

I know this wasn't a change introduced in this PR, but I think Python doesn't automatically dedent multi-line strings like Swift, so we should probably use something like .strip() or textwrap.dedent to avoid ending up with strange formatting in the help output.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I’ll set up another PR for it.

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 just checked and these messages get automatically demented because we use argparse.RawDescriptionHelpFormatter.

Copy link
Member

Choose a reason for hiding this comment

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

Ah interesting, didn't know about that, nice! 👍

@ahoppen ahoppen force-pushed the ahoppen/pin-swiftsyntaxbuilder-version branch from 04cbd9e to f6a4532 Compare September 23, 2022 09:02
ahoppen and others added 2 commits September 23, 2022 11:02
This resolves a bootstrapping issue that running `generate-swiftsyntaxbuilder` might modify `SwiftSyntaxBuilder`, which in turn makes it impossible to build and run `generate-swiftsyntaxbuilder`.

Co-Authored-By: fwcd <[email protected]>
Since we pin a SwiftSyntaxBuilder version for generate-swiftsyntaxbuilder, we no longer need to perform gyb-generation in two phases.
@ahoppen ahoppen force-pushed the ahoppen/pin-swiftsyntaxbuilder-version branch from f6a4532 to 149604c Compare September 23, 2022 09:03
@ahoppen
Copy link
Member Author

ahoppen commented Sep 23, 2022

swiftlang/swift#61226

@swift-ci Please test

@ahoppen ahoppen merged commit 0d39242 into swiftlang:main Sep 23, 2022
@ahoppen ahoppen deleted the ahoppen/pin-swiftsyntaxbuilder-version branch September 23, 2022 12:17
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