Skip to content

Rename Build module to NativeBuildSupport #8571

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
39 changes: 20 additions & 19 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ let swiftPMDataModelProduct = (
let swiftPMProduct = (
name: "SwiftPM",
targets: swiftPMDataModelProduct.targets + [
"Build",
"NativeBuildSupport",
"LLBuildManifest",
"SourceKitLSPAPI",
"SPMLLBuild",
Expand Down Expand Up @@ -205,11 +205,11 @@ let package = Package(
name: "SourceKitLSPAPI",
dependencies: [
"Basics",
"Build",
"PackageGraph",
"PackageLoading",
"PackageModel",
"SPMBuildCore",
"NativeBuildSupport",
],
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
Expand Down Expand Up @@ -451,29 +451,28 @@ let package = Package(
]
),
.target(
/** Builds Modules and Products */
name: "Build",
name: "DriverSupport",
dependencies: [
"Basics",
"LLBuildManifest",
"PackageGraph",
"SPMBuildCore",
"SPMLLBuild",
"PackageModel",
.product(name: "SwiftDriver", package: "swift-driver"),
.product(name: "OrderedCollections", package: "swift-collections"),
"DriverSupport",
],
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
.target(
name: "DriverSupport",
name: "NativeBuildSupport",
dependencies: [
"Basics",
"PackageModel",
"LLBuildManifest",
"PackageGraph",
"SPMBuildCore",
"SPMLLBuild",
.product(name: "SwiftDriver", package: "swift-driver"),
.product(name: "OrderedCollections", package: "swift-collections"),
"DriverSupport",
],
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
Expand All @@ -500,7 +499,9 @@ let package = Package(
"PackageGraph",
],
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: commonExperimentalFeatures
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
Copy link
Contributor

Choose a reason for hiding this comment

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

question: out of curiosity, why did we add the -static flag here if we this PR is renaming BuildSupport to NativeBuildSupport?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All those targets are supposed to have it, it was accidentally missed from this one before.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we need it any more when building with Swift 6.1.

]
),
.target(
/** High level functionality */
Expand Down Expand Up @@ -544,11 +545,11 @@ let package = Package(
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"Basics",
"Build",
"PackageLoading",
"PackageModel",
"PackageGraph",
"Workspace",
"NativeBuildSupport",
"XCBuildSupport",
"SwiftBuildSupport",
],
Expand All @@ -565,12 +566,12 @@ let package = Package(
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "OrderedCollections", package: "swift-collections"),
"Basics",
"Build",
"CoreCommands",
"PackageGraph",
"PackageModelSyntax",
"SourceControl",
"Workspace",
"NativeBuildSupport",
"XCBuildSupport",
"SwiftBuildSupport",
] + swiftSyntaxDependencies(["SwiftIDEUtils"]),
Expand Down Expand Up @@ -666,10 +667,10 @@ let package = Package(
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "OrderedCollections", package: "swift-collections"),
"Basics",
"Build",
"PackageGraph",
"PackageLoading",
"PackageModel",
"NativeBuildSupport",
"XCBuildSupport",
"SwiftBuildSupport",
],
Expand Down Expand Up @@ -749,7 +750,7 @@ let package = Package(
/** SwiftPM internal build test suite support library */
name: "_InternalBuildTestSupport",
dependencies: [
"Build",
"NativeBuildSupport",
"XCBuildSupport",
"SwiftBuildSupport",
"_InternalTestSupport"
Expand Down Expand Up @@ -830,7 +831,7 @@ let package = Package(
),
.testTarget(
name: "BuildTests",
dependencies: ["Build", "PackageModel", "Commands", "_InternalTestSupport", "_InternalBuildTestSupport"]
dependencies: ["NativeBuildSupport", "PackageModel", "Commands", "_InternalTestSupport", "_InternalBuildTestSupport"]
),
.testTarget(
name: "LLBuildManifestTests",
Expand Down Expand Up @@ -982,7 +983,7 @@ if ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] ==
dependencies: [
"swift-package-manager",
"Basics",
"Build",
"NativeBuildSupport",
"Commands",
"PackageModel",
"PackageModelSyntax",
Expand Down
2 changes: 1 addition & 1 deletion Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_compile_definitions(USE_IMPL_ONLY_IMPORTS)

add_subdirectory(_AsyncFileSystem)
add_subdirectory(Basics)
add_subdirectory(Build)
add_subdirectory(Commands)
add_subdirectory(CompilerPluginSupport)
add_subdirectory(CoreCommands)
add_subdirectory(DriverSupport)
add_subdirectory(LLBuildManifest)
add_subdirectory(NativeBuildSupport)
add_subdirectory(PackageDescription)
add_subdirectory(PackageFingerprint)
add_subdirectory(PackageGraph)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ target_link_libraries(Commands PUBLIC
SwiftCollections::OrderedCollections
ArgumentParser
Basics
Build
CoreCommands
LLBuildManifest
NativeBuildSupport
PackageGraph
PackageModelSyntax
SourceControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import PackageModel
import SourceControl
import SPMBuildCore
import Workspace
import XCBuildSupport

import enum TSCUtility.Diagnostics

Expand Down
7 changes: 3 additions & 4 deletions Sources/Commands/SwiftBuildCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
import ArgumentParser
import Basics

import Build

@_spi(SwiftPMInternal)
import CoreCommands

import PackageGraph

import SPMBuildCore
import XCBuildSupport
import SwiftBuildSupport

private import NativeBuildSupport
private import SwiftBuildSupport

import class Basics.AsyncProcess
import var TSCBasic.stdoutStream
Expand Down
7 changes: 4 additions & 3 deletions Sources/CoreCommands/BuildSystemSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
//===----------------------------------------------------------------------===//

import Basics
import Build
import SPMBuildCore
import XCBuildSupport
import SwiftBuildSupport
import PackageGraph
import Workspace

private import NativeBuildSupport
private import XCBuildSupport
private import SwiftBuildSupport

import class Basics.ObservabilityScope
import struct PackageGraph.ModulesGraph
import struct PackageLoading.FileRuleDescription
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreCommands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ add_library(CoreCommands
target_link_libraries(CoreCommands PUBLIC
ArgumentParser
Basics
Build
NativeBuildSupport
PackageGraph
TSCBasic
TSCUtility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ extension ResolvedProduct {
guard let macroModule = self.modules.first else {
throw InternalError("macro product \(self.name) has no targets")
}
return Build.getLLBuildTargetName(macro: macroModule, buildParameters: buildParameters)
return NativeBuildSupport.getLLBuildTargetName(macro: macroModule, buildParameters: buildParameters)
case .plugin:
throw InternalError("unexpectedly asked for the llbuild target name of a plugin product")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(Build
add_library(NativeBuildSupport
BuildDescription/ClangModuleBuildDescription.swift
BuildDescription/PluginBuildDescription.swift
BuildDescription/ProductBuildDescription.swift
Expand All @@ -30,26 +30,26 @@ add_library(Build
LLBuildProgressTracker.swift
SwiftCompilerOutputParser.swift
TestObservation.swift)
target_link_libraries(Build PUBLIC
target_link_libraries(NativeBuildSupport PUBLIC
TSCBasic
Basics
SwiftCollections::OrderedCollections
PackageGraph
SPMBuildCore)
target_link_libraries(Build PRIVATE
target_link_libraries(NativeBuildSupport PRIVATE
DriverSupport
LLBuildManifest
SPMLLBuild
SwiftDriver)
target_link_libraries(Build INTERFACE
target_link_libraries(NativeBuildSupport INTERFACE
llbuildSwift)

# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(Build PROPERTIES
set_target_properties(NativeBuildSupport PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

install(TARGETS Build
install(TARGETS NativeBuildSupport
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS Build)
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS NativeBuildSupport)
8 changes: 4 additions & 4 deletions Sources/SourceKitLSPAPI/BuildDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import TSCBasic
// Ideally wouldn't expose these (it defeats the purpose of this module), but we should replace this entire API with
// a BSP server, so this is good enough for now (and LSP is using all these types internally anyway).
import Basics
import Build
import NativeBuildSupport
import PackageGraph
internal import PackageLoading
internal import PackageModel
Expand Down Expand Up @@ -201,14 +201,14 @@ private struct WrappedSwiftTargetBuildDescription: BuildTarget {
}

public struct BuildDescription {
private let buildPlan: Build.BuildPlan
private let buildPlan: NativeBuildSupport.BuildPlan

/// The inputs of the build plan so we don't need to re-compute them on every call to
/// `fileAffectsSwiftOrClangBuildSettings`.
private let inputs: [Build.BuildPlan.Input]
private let inputs: [NativeBuildSupport.BuildPlan.Input]

/// Wrap an already constructed build plan.
public init(buildPlan: Build.BuildPlan) {
public init(buildPlan: NativeBuildSupport.BuildPlan) {
self.buildPlan = buildPlan
self.inputs = buildPlan.inputs
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SourceKitLSPAPI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_library(SourceKitLSPAPI STATIC
PluginTargetBuildDescription.swift)
target_link_libraries(SourceKitLSPAPI PUBLIC
Basics
Build
NativeBuildSupport
PackageGraph
SPMBuildCore)
target_link_libraries(SourceKitLSPAPI PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftBuildSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ add_library(SwiftBuildSupport STATIC
PIFBuilder.swift
SwiftBuildSystem.swift)
target_link_libraries(SwiftBuildSupport PUBLIC
Build
DriverSupport
SPMBuildCore
TSCBasic
TSCUtility
PackageGraph
Expand Down
2 changes: 1 addition & 1 deletion Sources/XCBuildSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ add_library(XCBuildSupport STATIC
XCBuildOutputParser.swift
XcodeBuildSystem.swift)
target_link_libraries(XCBuildSupport PUBLIC
Build
DriverSupport
SPMBuildCore
TSCBasic
TSCUtility
SwiftCollections::OrderedCollections
Expand Down
Loading