Skip to content

Revert "Exclude XCBuildSupport when building with CMake (#7358)" #7371

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 3 commits into from
Feb 27, 2024
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
1 change: 1 addition & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ add_subdirectory(swift-run)
add_subdirectory(swift-test)
add_subdirectory(SwiftSDKCommand)
add_subdirectory(Workspace)
add_subdirectory(XCBuildSupport)
7 changes: 2 additions & 5 deletions Sources/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ target_link_libraries(Commands PUBLIC
SourceControl
TSCBasic
TSCUtility
Workspace)

target_compile_definitions(Commands
PRIVATE DISABLE_XCBUILD_SUPPORT)

Workspace
XCBuildSupport)
target_link_libraries(Commands PRIVATE
DriverSupport
$<$<NOT:$<PLATFORM_ID:Darwin>>:FoundationXML>)
Expand Down
7 changes: 0 additions & 7 deletions Sources/Commands/PackageCommands/DumpCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ import Basics
import CoreCommands
import Foundation
import PackageModel

#if !DISABLE_XCBUILD_SUPPORT
import XCBuildSupport
#endif

struct DumpSymbolGraph: SwiftCommand {
static let configuration = CommandConfiguration(
Expand Down Expand Up @@ -139,7 +136,6 @@ struct DumpPIF: SwiftCommand {
var preserveStructure: Bool = false

func run(_ swiftCommandState: SwiftCommandState) throws {
#if !DISABLE_XCBUILD_SUPPORT
let graph = try swiftCommandState.loadPackageGraph()
let pif = try PIFBuilder.generatePIF(
buildParameters: swiftCommandState.productsBuildParameters,
Expand All @@ -148,9 +144,6 @@ struct DumpPIF: SwiftCommand {
observabilityScope: swiftCommandState.observabilityScope,
preservePIFModelStructure: preserveStructure)
print(pif)
#else
fatalError("This subcommand is not available on the current platform")
#endif
}

var toolWorkspaceConfiguration: ToolWorkspaceConfiguration {
Expand Down
3 changes: 0 additions & 3 deletions Sources/Commands/PackageCommands/SwiftPackageCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import PackageModel
import SourceControl
import SPMBuildCore
import Workspace

#if !DISABLE_XCBUILD_SUPPORT
import XCBuildSupport
#endif

import enum TSCUtility.Diagnostics

Expand Down
3 changes: 0 additions & 3 deletions Sources/Commands/SwiftBuildCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import Build
import CoreCommands
import PackageGraph
import SPMBuildCore

#if !DISABLE_XCBUILD_SUPPORT
import XCBuildSupport
#endif

import class TSCBasic.Process
import var TSCBasic.stdoutStream
Expand Down
11 changes: 0 additions & 11 deletions Sources/CoreCommands/BuildSystemSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@

import Build
import SPMBuildCore

#if !DISABLE_XCBUILD_SUPPORT
import XCBuildSupport
#endif

import class Basics.ObservabilityScope
import struct PackageGraph.ModulesGraph
Expand Down Expand Up @@ -63,7 +60,6 @@ private struct NativeBuildSystemFactory: BuildSystemFactory {
}
}

#if !DISABLE_XCBUILD_SUPPORT
private struct XcodeBuildSystemFactory: BuildSystemFactory {
let swiftCommandState: SwiftCommandState

Expand Down Expand Up @@ -91,19 +87,12 @@ private struct XcodeBuildSystemFactory: BuildSystemFactory {
)
}
}
#endif

extension SwiftCommandState {
public var defaultBuildSystemProvider: BuildSystemProvider {
#if !DISABLE_XCBUILD_SUPPORT
.init(providers: [
.native: NativeBuildSystemFactory(swiftCommandState: self),
.xcode: XcodeBuildSystemFactory(swiftCommandState: self)
])
#else
.init(providers: [
.native: NativeBuildSystemFactory(swiftCommandState: self),
])
#endif
}
}
7 changes: 2 additions & 5 deletions Sources/CoreCommands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ target_link_libraries(CoreCommands PUBLIC
PackageGraph
TSCBasic
TSCUtility
Workspace)

target_compile_definitions(CoreCommands
PRIVATE DISABLE_XCBUILD_SUPPORT)

Workspace
XCBuildSupport)
target_link_libraries(CoreCommands PRIVATE
DriverSupport
$<$<NOT:$<PLATFORM_ID:Darwin>>:FoundationXML>)
Expand Down
25 changes: 25 additions & 0 deletions Sources/XCBuildSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2014 - 2020 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(XCBuildSupport STATIC
PIF.swift
PIFBuilder.swift
XCBuildDelegate.swift
XCBuildMessage.swift
XCBuildOutputParser.swift
XcodeBuildSystem.swift)
target_link_libraries(XCBuildSupport PUBLIC
Build
DriverSupport
TSCBasic
TSCUtility
PackageGraph
)

set_target_properties(XCBuildSupport PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
6 changes: 2 additions & 4 deletions Sources/swift-bootstrap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ target_link_libraries(swift-bootstrap PRIVATE
PackageModel
SwiftDriver
TSCBasic
TSCUtility)

target_compile_definitions(swift-bootstrap
PRIVATE DISABLE_XCBUILD_SUPPORT)
TSCUtility
XCBuildSupport)
7 changes: 0 additions & 7 deletions Sources/swift-bootstrap/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ import PackageGraph
import PackageLoading
import PackageModel
import SPMBuildCore

#if !DISABLE_XCBUILD_SUPPORT
import XCBuildSupport
#endif

import struct TSCBasic.KeyedPair
import func TSCBasic.topologicalSort
Expand Down Expand Up @@ -332,7 +329,6 @@ struct SwiftBootstrapBuildTool: ParsableCommand {
observabilityScope: self.observabilityScope
)
case .xcode:
#if !DISABLE_XCBUILD_SUPPORT
return try XcodeBuildSystem(
buildParameters: buildParameters,
packageGraphLoader: packageGraphLoader,
Expand All @@ -341,9 +337,6 @@ struct SwiftBootstrapBuildTool: ParsableCommand {
fileSystem: self.fileSystem,
observabilityScope: self.observabilityScope
)
#else
fatalError("SwiftPM was built without XCBuild support")
#endif
}
}

Expand Down