Skip to content

Introduces the new PIF builder for SwiftBuild #8405

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 5 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/PackageGraph/Resolution/ResolvedModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public struct ResolvedModule {
self.underlying.sources
}

let packageIdentity: PackageIdentity
package let packageIdentity: PackageIdentity

/// The underlying module represented in this resolved module.
public let underlying: Module
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftBuildSupport/BuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extension BuildSubset {
var pifTargetName: String {
switch self {
case .product(let name, _):
PackagePIFProjectBuilder.targetName(for: name)
_PackagePIFProjectBuilder.targetName(for: name)
case .target(let name, _):
name
case .allExcludingTests:
Expand Down
8 changes: 7 additions & 1 deletion Sources/SwiftBuildSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(SwiftBuildSupport STATIC
BuildSystem.swift
PackagePIFBuilder.swift
PackagePIFBuilder+Helpers.swift
PackagePIFBuilder+Plugins.swift
PackagePIFProjectBuilder.swift
PackagePIFProjectBuilder+Modules.swift
PackagePIFProjectBuilder+Products.swift
PIF.swift
PIFBuilder.swift
BuildSystem.swift
SwiftBuildSystem.swift)
target_link_libraries(SwiftBuildSupport PUBLIC
Build
Expand Down
10 changes: 5 additions & 5 deletions Sources/SwiftBuildSupport/PIFBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public final class PIFBuilder {
let sortedPackages = self.graph.packages
.sorted { $0.manifest.displayName < $1.manifest.displayName } // TODO: use identity instead?
var projects: [PIFProjectBuilder] = try sortedPackages.map { package in
try PackagePIFProjectBuilder(
try _PackagePIFProjectBuilder(
package: package,
parameters: self.parameters,
fileSystem: self.fileSystem,
Expand Down Expand Up @@ -247,7 +247,7 @@ class PIFProjectBuilder {
}
}

final class PackagePIFProjectBuilder: PIFProjectBuilder {
final class _PackagePIFProjectBuilder: PIFProjectBuilder {
private let package: ResolvedPackage
private let parameters: PIFBuilderParameters
private let fileSystem: FileSystem
Expand Down Expand Up @@ -1074,7 +1074,7 @@ final class AggregatePIFProjectBuilder: PIFProjectBuilder {
allIncludingTestsTarget.addBuildConfiguration(name: "Debug")
allIncludingTestsTarget.addBuildConfiguration(name: "Release")

for case let project as PackagePIFProjectBuilder in projects where project.isRootPackage {
for case let project as _PackagePIFProjectBuilder in projects where project.isRootPackage {
for case let target as PIFTargetBuilder in project.targets {
if target.productType != .unitTest {
allExcludingTestsTarget.addDependency(
Expand Down Expand Up @@ -1555,7 +1555,7 @@ extension ResolvedProduct {
var pifTargetGUID: PIF.GUID { "PACKAGE-PRODUCT:\(name)" }

var mainTarget: ResolvedModule {
modules.first { $0.type == underlying.type.targetType }!
modules.first { $0.type == underlying.type._targetType }!
}

/// Returns the recursive dependencies, limited to the target's package, which satisfy the input build environment,
Expand Down Expand Up @@ -1612,7 +1612,7 @@ extension Module {
}

extension ProductType {
var targetType: Module.Kind {
var _targetType: Module.Kind {
switch self {
case .executable:
.executable
Expand Down
Loading