Skip to content

Migrate examples to Swift snippets #477

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
merged 3 commits into from
Jul 29, 2022
Merged

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Jun 28, 2022

This recently merged proposal will bring native support for running small scripts (snippets) in the context of the package directly via SPM (swift run [snippet]). Since the examples from this repo effectively serve the same purpose, this branch renames the Examples folder to Snippets to make them discoverable by SPM. Additionally, it adds a few minor tweaks (cleaning up the paths in the README.md and using trailing closures in the syntax builder example).

Copy link
Contributor

@kimdv kimdv left a comment

Choose a reason for hiding this comment

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

Cool! 🎉

@fwcd fwcd force-pushed the swift-snippets branch from a6990c7 to c3ff32e Compare July 27, 2022 16:01
@fwcd fwcd marked this pull request as ready for review July 27, 2022 16:02
@fwcd fwcd requested a review from ahoppen as a code owner July 27, 2022 16:02
@fwcd
Copy link
Member Author

fwcd commented Jul 27, 2022

I have rebased and tested this with a recent toolchain, swift build now builds the snippets too. The only thing left to do would be to update the build script, so the snippets are built/checked in CI too. Is there a way to do so without having to explicitly list all snippets in build_command?

@ahoppen
Copy link
Member

ahoppen commented Jul 27, 2022

My idea would be to change Builder.build() to build all products (i.e. remove the --product option from the swift build invocation). That could give us a performance improvement because all products are built in parallel and also builds the snippets.

@fwcd
Copy link
Member Author

fwcd commented Jul 29, 2022

Since this PR doesn't really regress anything regarding the snippets/examples, wdyt about moving the updates to the build script to a future PR once we figure out #531?

@swift-ci please test

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Sounds good to me 👍

@fwcd
Copy link
Member Author

fwcd commented Jul 29, 2022

The CI failure looks unrelated, if I read this correctly? I could try again later.

@ahoppen
Copy link
Member

ahoppen commented Jul 29, 2022

I think CI got confused because you mentioned another PR in the same comment that you triggered CI, so it tried to test this PR together with the mentioned PR.

@ahoppen
Copy link
Member

ahoppen commented Jul 29, 2022

@swift-ci Please test

@fwcd fwcd merged commit 8657d66 into swiftlang:main Jul 29, 2022
@fwcd fwcd deleted the swift-snippets branch July 29, 2022 18:13
@fwcd fwcd mentioned this pull request Oct 9, 2022
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.

3 participants