Skip to content

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented Sep 4, 2025

Snippets are treated as executable targets with the native build system.

This change updates the PIF Builder to support snippet, giving Snippet support with the Swift Build build system.

Depends on: swiftlang/swift-build#775
Fixes: #9040
issue: rdar://158630024
issue: rdar://147705448

Snippets are treated as executable targets with the native build system.

This change updates the PIF Builder to support snippet, giving Snippet
support with the Swift Build build system.

Depends on: swiftlang/swift-build#775
Fixes: swiftlang#9040
issue: rdar://158630024
issue: rdar://147705448
@bkhouri
Copy link
Contributor Author

bkhouri commented Sep 4, 2025

@swift-ci test

@bkhouri bkhouri marked this pull request as ready for review September 4, 2025 18:39
@owenv
Copy link
Contributor

owenv commented Sep 4, 2025

What's here looks good, I just have a few follow up questions

The proposal says:

Snippet targets automatically depend on any library targets declared in their host package, so snippets are free to import those modules.
Are those dependencies getting captured in the PIF right now? Would be good to have a test that imports of API from the package works

It also says:

Snippet targets will be built by default when running swift build --build-snippets. This is consistent with how building tests is an explicit choice, like when running swift test or swift build --build-tests.

Right now, PIFBuilder.buildAggregateProject is adding snippets to the "all-including-tests" target AFAICT, which will cause the snippets to build with just swift test. We might need to add a new aggregate which pulls in snippets that clients can opt into

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.

Add Snippet support for the SwiftBuild Integration
2 participants