Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Introduces the new PIF builder for SwiftBuild #8405

Merged
merged 5 commits into from
Mar 27, 2025
Merged

Conversation

pmattos
Copy link
Contributor

@pmattos pmattos commented Mar 24, 2025

Introduces the new PIF builder for packages in SwiftBuildSupport.

Motivation:

This continues the work started by PR 8271, introducing now our new PIF builder for packages. As expected, this will happen in the new SwiftBuildSupport target, introduced to support the just released Swift Build project.

Modifications:

This 1st PR only includes the new code in the corresponding SwiftBuildSupport/PIFPackageBuilder*.swift source files. The code isn't actually being used (or unit tested) just yet.

The code still uses the older SWBProjectModel.PIF API to build the PIF data model. In an upcoming PR, I will be migrating this over to the newer SwiftBuild.ProjectModel API, and then finally replacing the original code to actually use the PIF builder to send package build information to Swift Build.

PS. I did run SwiftFormat in all new code, as indicated by the contributors guide.

Result:

This marks the start of our package PIF builder unification (i.e., between Xcode and SwiftPM).

Tracked by rdar://147767772.

@jakepetroules
Copy link
Contributor

@swift-ci test

@dschaefer2
Copy link
Member

Make sure you add the new files to the CMakeLists.txt file.

@pmattos
Copy link
Contributor Author

pmattos commented Mar 25, 2025

@swift-ci test

@jakepetroules
Copy link
Contributor

@swift-ci test

@pmattos
Copy link
Contributor Author

pmattos commented Mar 26, 2025

@swift-ci test

@jakepetroules
Copy link
Contributor

/home/build-user/swiftpm/Sources/SwiftBuildSupport/PIFBuilder.swift:1558:52: error: value of type 'ProductType' has no member 'targetType'

What's going on here?

@pmattos
Copy link
Contributor Author

pmattos commented Mar 26, 2025

@swift-ci test

@pmattos
Copy link
Contributor Author

pmattos commented Mar 26, 2025

/home/build-user/swiftpm/Sources/SwiftBuildSupport/PIFBuilder.swift:1558:52: error: value of type 'ProductType' has no member 'targetType'

What's going on here?

@jakepetroules We had this duplicated extension ProductType but since I added #if canImport(SwiftBuild) my version vanished, hence the error. I just added back the original extension (for now at least).

@jakepetroules
Copy link
Contributor

@swift-ci test linux self hosted

@pmattos
Copy link
Contributor Author

pmattos commented Mar 26, 2025

@swift-ci test macos smoke test

@jakepetroules
Copy link
Contributor

@swift-ci please test macos

@jakepetroules
Copy link
Contributor

@swift-ci test windows

@pmattos pmattos merged commit 23f32be into main Mar 27, 2025
5 checks passed
@pmattos pmattos deleted the pmattos/new_pif_builder branch March 27, 2025 01:28
pmattos added a commit that referenced this pull request Apr 5, 2025
…8441)

### Motivation:

The goal is to adopt the new `SwiftBuild.ProjectModel` API. This new API
provides a *typesafer* and *modern* way of building PIFs
programmatically.

This continues the work I started in PR #8405, introducing now our new
PIF builder for packages.

### Modifications:

Replaces all `SwiftBuild.PIF` (aka, `SWBProjectModel.PIF`) API usage, in
`PackagePIFBuilder`, with the new `SwiftBuild.ProjectModel` API instead.

### Result:

`PackagePIFBuilder` is now modernized... but still not actually used.
This will come in my next pull request.

Tracked by rdar://147526957.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants