-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Create an alternate SwiftPM build system called Swift Build #8271
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ public enum BuildSubset { | |
} | ||
|
||
/// A protocol that represents a build system used by SwiftPM for all build operations. This allows factoring out the | ||
/// implementation details between SwiftPM's `BuildOperation` and the XCBuild backed `XCBuildSystem`. | ||
/// implementation details between SwiftPM's `BuildOperation` and the Swift Build backed `SwiftBuildSystem`. | ||
public protocol BuildSystem: Cancellable { | ||
|
||
/// The delegate used by the build system. | ||
|
@@ -130,6 +130,7 @@ public struct BuildSystemProvider { | |
// TODO: In the future, we may want this to be about specific capabilities of a build system rather than choosing a concrete one. | ||
public enum Kind: String, CaseIterable { | ||
case native | ||
case swiftbuild | ||
case xcode | ||
} | ||
|
||
|
@@ -172,6 +173,7 @@ extension BuildSystemProvider.Kind { | |
public var usesXcodeBuildEngine: Bool { | ||
switch self { | ||
case .native: return false | ||
case .swiftbuild: return false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chore (blocking): this should return "true" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SwiftBuild isn't using any Xcode or its build engine. It's unclear what this check is for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable name may be incorrect, but this is meant to determine if the underlying build engine uses the same "build output directory structure" as Xcode. Setting this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SwiftBuild doesn't use the same directory structure. |
||
case .xcode: return true | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import SPMBuildCore | ||
import PackageModel | ||
|
||
extension BuildConfiguration { | ||
public var swiftbuildName: String { | ||
switch self { | ||
case .debug: "Debug" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: can we have the build configuration confirm to "ConvertibleString" ? |
||
case .release: "Release" | ||
} | ||
} | ||
} | ||
|
||
extension BuildSubset { | ||
var pifTargetName: String { | ||
switch self { | ||
case .product(let name, _): | ||
PackagePIFProjectBuilder.targetName(for: name) | ||
case .target(let name, _): | ||
name | ||
case .allExcludingTests: | ||
PIFBuilder.allExcludingTestsTargetName | ||
case .allIncludingTests: | ||
PIFBuilder.allIncludingTestsTargetName | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This source file is part of the Swift open source project | ||
# | ||
# Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
# Licensed under Apache License v2.0 with Runtime Library Exception | ||
# | ||
# See http://swift.org/LICENSE.txt for license information | ||
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
|
||
add_library(SwiftBuildSupport STATIC | ||
PIF.swift | ||
PIFBuilder.swift | ||
BuildSystem.swift | ||
SwiftBuildSystem.swift) | ||
target_link_libraries(SwiftBuildSupport PUBLIC | ||
Build | ||
DriverSupport | ||
TSCBasic | ||
TSCUtility | ||
PackageGraph | ||
) | ||
|
||
set_target_properties(SwiftBuildSupport PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) |
Uh oh!
There was an error while loading. Please reload this page.