Skip to content

Commit 6a2e45f

Browse files
authored
Revert "Include Swift Build support in second stage bootstrap builds" (#8366)
Reverts #8334 This seems to cause an issue in the incremental buildbots
1 parent 1b59346 commit 6a2e45f

File tree

6 files changed

+12
-42
lines changed

6 files changed

+12
-42
lines changed

Diff for: Sources/CoreCommands/BuildSystemSupport.swift

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ private struct SwiftBuildSystemFactory: BuildSystemFactory {
121121
explicitProduct: explicitProduct
122122
)
123123
},
124-
packageManagerResourcesDirectory: swiftCommandState.packageManagerResourcesDirectory,
125124
outputStream: outputStream ?? self.swiftCommandState.outputStream,
126125
logLevel: logLevel ?? self.swiftCommandState.logLevel,
127126
fileSystem: self.swiftCommandState.fileSystem,

Diff for: Sources/CoreCommands/Options.swift

-6
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,6 @@ public struct LocationOptions: ParsableArguments {
146146
completion: .directory
147147
)
148148
public var pkgConfigDirectories: [AbsolutePath] = []
149-
150-
@Option(
151-
help: .init("Specify alternate path to search for SwiftPM resources.", visibility: .hidden),
152-
completion: .directory
153-
)
154-
public var packageManagerResourcesDirectory: AbsolutePath?
155149

156150
@Flag(name: .customLong("ignore-lock"), help: .hidden)
157151
public var ignoreLock: Bool = false

Diff for: Sources/CoreCommands/SwiftCommandState.swift

-14
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ public final class SwiftCommandState {
227227

228228
/// Path to the shared configuration directory
229229
public let sharedConfigurationDirectory: AbsolutePath
230-
231-
/// Path to the package manager's own resources directory.
232-
public let packageManagerResourcesDirectory: AbsolutePath?
233230

234231
/// Path to the cross-compilation Swift SDKs directory.
235232
public let sharedSwiftSDKsDirectory: AbsolutePath
@@ -374,17 +371,6 @@ public final class SwiftCommandState {
374371
warning: "`--experimental-swift-sdks-path` is deprecated and will be removed in a future version of SwiftPM. Use `--swift-sdks-path` instead."
375372
)
376373
}
377-
378-
if let packageManagerResourcesDirectory = options.locations.packageManagerResourcesDirectory {
379-
self.packageManagerResourcesDirectory = packageManagerResourcesDirectory
380-
} else if let cwd = localFileSystem.currentWorkingDirectory {
381-
self.packageManagerResourcesDirectory = try? AbsolutePath(validating: CommandLine.arguments[0], relativeTo: cwd)
382-
.parentDirectory.parentDirectory.appending(components: ["share", "pm"])
383-
} else {
384-
self.packageManagerResourcesDirectory = try? AbsolutePath(validating: CommandLine.arguments[0])
385-
.parentDirectory.parentDirectory.appending(components: ["share", "pm"])
386-
}
387-
388374
self.sharedSwiftSDKsDirectory = try fileSystem.getSharedSwiftSDKsDirectory(
389375
explicitDirectory: options.locations.swiftSDKsDirectory ?? options.locations.deprecatedSwiftSDKsDirectory
390376
)

Diff for: Sources/SwiftBuildSupport/SwiftBuildSystem.swift

+11-15
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,12 @@ func withService(
6262
func withSession(
6363
service: SWBBuildService,
6464
name: String,
65-
packageManagerResourcesDirectory: Basics.AbsolutePath?,
6665
body: @escaping (
6766
_ session: SWBBuildServiceSession,
6867
_ diagnostics: [SwiftBuild.SwiftBuildMessage.DiagnosticInfo]
6968
) async throws -> Void
7069
) async throws {
71-
switch await service.createSession(name: name, resourceSearchPaths: packageManagerResourcesDirectory.map { [$0.pathString] } ?? [], cachePath: nil, inferiorProductsPath: nil, environment: nil) {
70+
switch await service.createSession(name: name, cachePath: nil, inferiorProductsPath: nil, environment: nil) {
7271
case (.success(let session), let diagnostics):
7372
do {
7473
try await body(session, diagnostics)
@@ -160,7 +159,6 @@ private final class PlanningOperationDelegate: SWBPlanningOperationDelegate, Sen
160159
public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
161160
private let buildParameters: BuildParameters
162161
private let packageGraphLoader: () async throws -> ModulesGraph
163-
private let packageManagerResourcesDirectory: Basics.AbsolutePath?
164162
private let logLevel: Basics.Diagnostic.Severity
165163
private var packageGraph: AsyncThrowingValueMemoizer<ModulesGraph> = .init()
166164
private var pifBuilder: AsyncThrowingValueMemoizer<PIFBuilder> = .init()
@@ -211,15 +209,13 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
211209
public init(
212210
buildParameters: BuildParameters,
213211
packageGraphLoader: @escaping () async throws -> ModulesGraph,
214-
packageManagerResourcesDirectory: Basics.AbsolutePath?,
215212
outputStream: OutputByteStream,
216213
logLevel: Basics.Diagnostic.Severity,
217214
fileSystem: FileSystem,
218215
observabilityScope: ObservabilityScope
219216
) throws {
220217
self.buildParameters = buildParameters
221218
self.packageGraphLoader = packageGraphLoader
222-
self.packageManagerResourcesDirectory = packageManagerResourcesDirectory
223219
self.outputStream = outputStream
224220
self.logLevel = logLevel
225221
self.fileSystem = fileSystem
@@ -260,16 +256,16 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
260256
header: ""
261257
)
262258

263-
do {
264-
try await withSession(service: service, name: self.buildParameters.pifManifest.pathString, packageManagerResourcesDirectory: self.packageManagerResourcesDirectory) { session, _ in
265-
// Load the workspace, and set the system information to the default
266-
do {
267-
try await session.loadWorkspace(containerPath: self.buildParameters.pifManifest.pathString)
268-
try await session.setSystemInfo(.default())
269-
} catch {
270-
self.observabilityScope.emit(error: error.localizedDescription)
271-
throw error
272-
}
259+
do {
260+
try await withSession(service: service, name: buildParameters.pifManifest.pathString) { session, _ in
261+
// Load the workspace, and set the system information to the default
262+
do {
263+
try await session.loadWorkspace(containerPath: self.buildParameters.pifManifest.pathString)
264+
try await session.setSystemInfo(.default())
265+
} catch {
266+
self.observabilityScope.emit(error: error.localizedDescription)
267+
throw error
268+
}
273269

274270
// Find the targets to build.
275271
let configuredTargets: [SWBConfiguredTarget]

Diff for: Sources/swift-bootstrap/main.swift

-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ struct SwiftBootstrapBuildTool: AsyncParsableCommand {
361361
return try SwiftBuildSystem(
362362
buildParameters: buildParameters,
363363
packageGraphLoader: asyncUnsafePackageGraphLoader,
364-
packageManagerResourcesDirectory: nil,
365364
outputStream: TSCBasic.stdoutStream,
366365
logLevel: logLevel,
367366
fileSystem: self.fileSystem,

Diff for: Utilities/bootstrap

+1-5
Original file line numberDiff line numberDiff line change
@@ -544,11 +544,6 @@ def install_swiftpm(prefix, args):
544544
dest = os.path.join(prefix, "lib", "swift", "pm", "PluginAPI")
545545
install_dylib(args, "PackagePlugin", dest, ["PackagePlugin"])
546546

547-
# Install resource bundles produced during the build.
548-
for file in os.listdir(args.bin_dir):
549-
if file.endswith('.bundle') or file.endswith('.resources'):
550-
install_binary(args, file, os.path.join(os.path.join(prefix, "share"), "pm"))
551-
552547

553548
# Helper function that installs a dynamic library and a set of modules to a particular directory.
554549
@log_entry_exit
@@ -856,6 +851,7 @@ def get_swiftpm_env_cmd(args):
856851

857852
if args.llbuild_link_framework:
858853
env_cmd.append("SWIFTPM_LLBUILD_FWK=1")
854+
env_cmd.append("SWIFTPM_NO_SWBUILD_DEPENDENCY=1")
859855
env_cmd.append("SWIFTCI_USE_LOCAL_DEPS=1")
860856
env_cmd.append("SWIFTPM_MACOS_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target)
861857

0 commit comments

Comments
 (0)