Skip to content

Commit 08ab8fc

Browse files
committed
Remove the unused CapturedBuildInfo mechanism
1 parent a4ff7a7 commit 08ab8fc

File tree

9 files changed

+9
-930
lines changed

9 files changed

+9
-930
lines changed

Sources/SWBBuildSystem/BuildOperation.swift

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -310,62 +310,6 @@ package final class BuildOperation: BuildSystemOperation {
310310
return effectiveStatus
311311
}
312312

313-
// Helper method to emit information to the CAPTURED_BUILD_INFO_DIR. This is mainly to be able to gracefully return after emitting a warning if something goes wrong, because not being able to emit this info is typically not serious enough to want to abort the whole build.
314-
func emitCapturedBuildInfo(to path: Path) {
315-
// If the build description doesn't have captured build info, then we don't emit it. Otherwise we proceed.
316-
guard let capturedBuildInfo = buildDescription.capturedBuildInfo else {
317-
buildOutputDelegate.warning("no captured build info available for incremental build - not emitting it")
318-
return
319-
}
320-
321-
guard path.isAbsolute else {
322-
buildOutputDelegate.warning("CAPTURED_BUILD_INFO_DIR must be an absolute path, but is \(path.str) (skipping emitting captured build info)")
323-
return
324-
}
325-
326-
// Create the directory if necessary.
327-
if !fs.exists(path) {
328-
do {
329-
try fs.createDirectory(path, recursive: true)
330-
}
331-
catch {
332-
buildOutputDelegate.warning("Could not create directory for CAPTURED_BUILD_INFO_DIR (\(path.str)): \(error) (skipping emitting captured build info)")
333-
return
334-
}
335-
}
336-
else {
337-
guard fs.isDirectory(path) else {
338-
buildOutputDelegate.warning("CAPTURED_BUILD_INFO_DIR (\(path.str)) exists but is not a directory (skipping emitting captured build info)")
339-
return
340-
}
341-
}
342-
343-
// The output path includes our process ID, since there might be multiple builds dumping information here, e.g. if there's a script which invokes another xcodebuild instance.
344-
let pid = ProcessInfo.processInfo.processIdentifier
345-
let outputFilePath = path.join("xcodebuildCapturedInfo_\(pid).\(capturedBuildInfoFileExtension)")
346-
347-
// Write the captured build info to the file.
348-
do {
349-
try fs.write(outputFilePath, contents: capturedBuildInfo.propertyListItem.asJSONFragment() + "\n")
350-
}
351-
catch {
352-
buildOutputDelegate.warning("Could not write captured build info to '\(outputFilePath.str)': \(error)")
353-
return
354-
}
355-
356-
buildOutputDelegate.note("Wrote captured build info to \(outputFilePath.str)")
357-
}
358-
359-
// If we were asked to emit information about the targets being built, then do so now, unless we're in "dry run" mode.
360-
if !request.useDryRun, let capturedBuildInfoDir = environment?["CAPTURED_BUILD_INFO_DIR"] {
361-
if !capturedBuildInfoDir.isEmpty {
362-
// If the resolved path is not empty, then emit the captured build info.
363-
emitCapturedBuildInfo(to: Path(capturedBuildInfoDir))
364-
} else {
365-
buildOutputDelegate.warning("CAPTURED_BUILD_INFO_DIR is set but is empty (skipping emitting captured build info)")
366-
}
367-
}
368-
369313
// If task construction had errors, fail the build immediately, unless `continueBuildingAfterErrors` is set.
370314
if !request.continueBuildingAfterErrors && buildDescription.hadErrors {
371315
let effectiveStatus = BuildOperationEnded.Status.failed

Sources/SWBCore/CapturedBuildInfo.swift

Lines changed: 0 additions & 496 deletions
This file was deleted.

Sources/SWBTaskExecution/BuildDescription.swift

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,6 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
170170
/// Maps module names to the GUID of the configured target which will define them.
171171
package let definingTargetsByModuleName: [String: OrderedSet<ConfiguredTarget>]
172172

173-
/// Info captured about the build to be optionally written to a file.
174-
///
175-
/// This info is not serialized to the build description, and is only written out if it is not nil, so toggling the environment variable which emits this info needs to produce a new build description.
176-
package let capturedBuildInfo: CapturedBuildInfo?
177-
178173
/// The list of task construction diagnostics. They are getting serialized.
179174
package let diagnostics: [ConfiguredTarget?: [Diagnostic]]
180175

@@ -206,7 +201,7 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
206201
package let emitFrontendCommandLines: Bool
207202

208203
/// Load a build description from the given path.
209-
fileprivate init(inDir dir: Path, signature: BuildDescriptionSignature, taskStore: FrozenTaskStore, allOutputPaths: Set<Path>, rootPathsPerTarget: [ConfiguredTarget: [Path]], moduleCachePathsPerTarget: [ConfiguredTarget: [Path]], artifactInfoPerTarget: [ConfiguredTarget: ArtifactInfo], casValidationInfos: [CASValidationInfo], settingsPerTarget: [ConfiguredTarget: Settings], enableStaleFileRemoval: Bool = true, taskActionMap: [String: TaskAction.Type], targetTaskCounts: [ConfiguredTarget: Int], moduleSessionFilePath: Path?, diagnostics: [ConfiguredTarget?: [Diagnostic]], fs: any FSProxy, invalidationPaths: [Path], recursiveSearchPathResults: [RecursiveSearchPathResolver.CachedResult], copiedPathMap: [String: String], targetDependencies: [TargetDependencyRelationship], definingTargetsByModuleName: [String: OrderedSet<ConfiguredTarget>], capturedBuildInfo: CapturedBuildInfo?, bypassActualTasks: Bool, targetsBuildInParallel: Bool, emitFrontendCommandLines: Bool) throws {
204+
fileprivate init(inDir dir: Path, signature: BuildDescriptionSignature, taskStore: FrozenTaskStore, allOutputPaths: Set<Path>, rootPathsPerTarget: [ConfiguredTarget: [Path]], moduleCachePathsPerTarget: [ConfiguredTarget: [Path]], artifactInfoPerTarget: [ConfiguredTarget: ArtifactInfo], casValidationInfos: [CASValidationInfo], settingsPerTarget: [ConfiguredTarget: Settings], enableStaleFileRemoval: Bool = true, taskActionMap: [String: TaskAction.Type], targetTaskCounts: [ConfiguredTarget: Int], moduleSessionFilePath: Path?, diagnostics: [ConfiguredTarget?: [Diagnostic]], fs: any FSProxy, invalidationPaths: [Path], recursiveSearchPathResults: [RecursiveSearchPathResolver.CachedResult], copiedPathMap: [String: String], targetDependencies: [TargetDependencyRelationship], definingTargetsByModuleName: [String: OrderedSet<ConfiguredTarget>], bypassActualTasks: Bool, targetsBuildInParallel: Bool, emitFrontendCommandLines: Bool) throws {
210205
self.dir = dir
211206
self.signature = signature
212207
self.taskStore = taskStore
@@ -227,7 +222,6 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
227222
self.copiedPathMap = copiedPathMap
228223
self.targetDependencies = targetDependencies
229224
self.definingTargetsByModuleName = definingTargetsByModuleName
230-
self.capturedBuildInfo = capturedBuildInfo
231225
self.bypassActualTasks = bypassActualTasks
232226
self.targetsBuildInParallel = targetsBuildInParallel
233227
self.emitFrontendCommandLines = emitFrontendCommandLines
@@ -404,8 +398,6 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
404398
self.copiedPathMap = try deserializer.deserialize()
405399
self.targetDependencies = try deserializer.deserialize()
406400
self.definingTargetsByModuleName = try deserializer.deserialize()
407-
// We don't serialize the captured build info.
408-
self.capturedBuildInfo = nil
409401
self.bypassActualTasks = try deserializer.deserialize()
410402
self.targetsBuildInParallel = try deserializer.deserialize()
411403
self.emitFrontendCommandLines = try deserializer.deserialize()
@@ -563,9 +555,6 @@ package final class BuildDescriptionBuilder {
563555
// The map of settings per configured target.
564556
private let settingsPerTarget: [ConfiguredTarget: Settings]
565557

566-
/// Info captured about the build to be optionally written to a file.
567-
package let capturedBuildInfo: CapturedBuildInfo?
568-
569558
/// For processing Gate and Constructed Tasks in parallel.
570559
private let processTaskLock = SWBMutex(())
571560

@@ -574,7 +563,7 @@ package final class BuildDescriptionBuilder {
574563
/// - Parameters:
575564
/// - path: The path of a directory to store the build description to.
576565
/// - bypassActualTasks: If enabled, replace tasks with fake ones (`/usr/bin/true`).
577-
init(path: Path, signature: BuildDescriptionSignature, buildCommand: BuildCommand, taskAdditionalInputs: [Ref<any PlannedTask>: NodeList], mutatedNodes: Set<Ref<any PlannedNode>>, mutatingTasks: [Ref<any PlannedTask>: MutatingTaskInfo], bypassActualTasks: Bool, targetsBuildInParallel: Bool, emitFrontendCommandLines: Bool, moduleSessionFilePath: Path?, invalidationPaths: [Path], recursiveSearchPathResults: [RecursiveSearchPathResolver.CachedResult], copiedPathMap: [String: String], outputPathsPerTarget: [ConfiguredTarget?: [Path]], allOutputPaths: Set<Path>, rootPathsPerTarget: [ConfiguredTarget: [Path]], moduleCachePathsPerTarget: [ConfiguredTarget: [Path]], artifactInfoPerTarget: [ConfiguredTarget: ArtifactInfo], casValidationInfos: [BuildDescription.CASValidationInfo], staleFileRemovalIdentifierPerTarget: [ConfiguredTarget?: String], settingsPerTarget: [ConfiguredTarget: Settings], targetDependencies: [TargetDependencyRelationship], definingTargetsByModuleName: [String: OrderedSet<ConfiguredTarget>], workspace: Workspace, capturedBuildInfo: CapturedBuildInfo?) {
566+
init(path: Path, signature: BuildDescriptionSignature, buildCommand: BuildCommand, taskAdditionalInputs: [Ref<any PlannedTask>: NodeList], mutatedNodes: Set<Ref<any PlannedNode>>, mutatingTasks: [Ref<any PlannedTask>: MutatingTaskInfo], bypassActualTasks: Bool, targetsBuildInParallel: Bool, emitFrontendCommandLines: Bool, moduleSessionFilePath: Path?, invalidationPaths: [Path], recursiveSearchPathResults: [RecursiveSearchPathResolver.CachedResult], copiedPathMap: [String: String], outputPathsPerTarget: [ConfiguredTarget?: [Path]], allOutputPaths: Set<Path>, rootPathsPerTarget: [ConfiguredTarget: [Path]], moduleCachePathsPerTarget: [ConfiguredTarget: [Path]], artifactInfoPerTarget: [ConfiguredTarget: ArtifactInfo], casValidationInfos: [BuildDescription.CASValidationInfo], staleFileRemovalIdentifierPerTarget: [ConfiguredTarget?: String], settingsPerTarget: [ConfiguredTarget: Settings], targetDependencies: [TargetDependencyRelationship], definingTargetsByModuleName: [String: OrderedSet<ConfiguredTarget>], workspace: Workspace) {
578567
self.path = path
579568
self.signature = signature
580569
self.taskAdditionalInputs = taskAdditionalInputs
@@ -597,7 +586,6 @@ package final class BuildDescriptionBuilder {
597586
self.settingsPerTarget = settingsPerTarget
598587
self.targetDependencies = targetDependencies
599588
self.definingTargetsByModuleName = definingTargetsByModuleName
600-
self.capturedBuildInfo = capturedBuildInfo
601589
self.taskStore = TaskStore()
602590
}
603591

@@ -705,7 +693,7 @@ package final class BuildDescriptionBuilder {
705693
// Create the build description.
706694
let buildDescription: BuildDescription
707695
do {
708-
buildDescription = try BuildDescription(inDir: path, signature: signature, taskStore: frozenTaskStore, allOutputPaths: allOutputPaths, rootPathsPerTarget: rootPathsPerTarget, moduleCachePathsPerTarget: moduleCachePathsPerTarget, artifactInfoPerTarget: artifactInfoPerTarget, casValidationInfos: casValidationInfos, settingsPerTarget: settingsPerTarget, taskActionMap: taskActionMap, targetTaskCounts: targetTaskCounts, moduleSessionFilePath: moduleSessionFilePath, diagnostics: diagnosticsEngines.mapValues { engine in engine.diagnostics }, fs: fs, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, capturedBuildInfo: capturedBuildInfo, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines)
696+
buildDescription = try BuildDescription(inDir: path, signature: signature, taskStore: frozenTaskStore, allOutputPaths: allOutputPaths, rootPathsPerTarget: rootPathsPerTarget, moduleCachePathsPerTarget: moduleCachePathsPerTarget, artifactInfoPerTarget: artifactInfoPerTarget, casValidationInfos: casValidationInfos, settingsPerTarget: settingsPerTarget, taskActionMap: taskActionMap, targetTaskCounts: targetTaskCounts, moduleSessionFilePath: moduleSessionFilePath, diagnostics: diagnosticsEngines.mapValues { engine in engine.diagnostics }, fs: fs, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines)
709697
}
710698
catch {
711699
throw StubError.error("unable to create build description: \(error)")
@@ -1039,7 +1027,7 @@ extension BuildDescription {
10391027
// FIXME: Bypass actual tasks should go away, eventually.
10401028
//
10411029
// FIXME: This layering isn't working well, we are plumbing a bunch of stuff through here just because we don't want to talk to TaskConstruction.
1042-
static package func construct(workspace: Workspace, tasks: [any PlannedTask], path: Path, signature: BuildDescriptionSignature, buildCommand: BuildCommand, diagnostics: [ConfiguredTarget?: [Diagnostic]] = [:], indexingInfo: [(forTarget: ConfiguredTarget?, path: Path, indexingInfo: any SourceFileIndexingInfo)] = [], fs: any FSProxy = localFS, bypassActualTasks: Bool = false, targetsBuildInParallel: Bool = true, emitFrontendCommandLines: Bool = false, moduleSessionFilePath: Path? = nil, invalidationPaths: [Path] = [], recursiveSearchPathResults: [RecursiveSearchPathResolver.CachedResult] = [], copiedPathMap: [String: String] = [:], rootPathsPerTarget: [ConfiguredTarget:[Path]] = [:], moduleCachePathsPerTarget: [ConfiguredTarget: [Path]] = [:], artifactInfoPerTarget: [ConfiguredTarget: ArtifactInfo] = [:], casValidationInfos: [BuildDescription.CASValidationInfo] = [], staleFileRemovalIdentifierPerTarget: [ConfiguredTarget?: String] = [:], settingsPerTarget: [ConfiguredTarget: Settings] = [:], delegate: any BuildDescriptionConstructionDelegate, targetDependencies: [TargetDependencyRelationship] = [], definingTargetsByModuleName: [String: OrderedSet<ConfiguredTarget>], capturedBuildInfo: CapturedBuildInfo?, userPreferences: UserPreferences) async throws -> BuildDescription? {
1030+
static package func construct(workspace: Workspace, tasks: [any PlannedTask], path: Path, signature: BuildDescriptionSignature, buildCommand: BuildCommand, diagnostics: [ConfiguredTarget?: [Diagnostic]] = [:], indexingInfo: [(forTarget: ConfiguredTarget?, path: Path, indexingInfo: any SourceFileIndexingInfo)] = [], fs: any FSProxy = localFS, bypassActualTasks: Bool = false, targetsBuildInParallel: Bool = true, emitFrontendCommandLines: Bool = false, moduleSessionFilePath: Path? = nil, invalidationPaths: [Path] = [], recursiveSearchPathResults: [RecursiveSearchPathResolver.CachedResult] = [], copiedPathMap: [String: String] = [:], rootPathsPerTarget: [ConfiguredTarget:[Path]] = [:], moduleCachePathsPerTarget: [ConfiguredTarget: [Path]] = [:], artifactInfoPerTarget: [ConfiguredTarget: ArtifactInfo] = [:], casValidationInfos: [BuildDescription.CASValidationInfo] = [], staleFileRemovalIdentifierPerTarget: [ConfiguredTarget?: String] = [:], settingsPerTarget: [ConfiguredTarget: Settings] = [:], delegate: any BuildDescriptionConstructionDelegate, targetDependencies: [TargetDependencyRelationship] = [], definingTargetsByModuleName: [String: OrderedSet<ConfiguredTarget>], userPreferences: UserPreferences) async throws -> BuildDescription? {
10431031
var diagnostics = diagnostics
10441032

10451033
// We operate on the sorted tasks here to ensure that the list of task additional inputs is deterministic.
@@ -1302,7 +1290,7 @@ extension BuildDescription {
13021290
}
13031291

13041292
// Create the builder.
1305-
let builder = BuildDescriptionBuilder(path: path, signature: signature, buildCommand: buildCommand, taskAdditionalInputs: taskAdditionalInputs, mutatedNodes: Set(mutableNodes.keys), mutatingTasks: mutatingTasks, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines, moduleSessionFilePath: moduleSessionFilePath, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, outputPathsPerTarget: outputPathsPerTarget, allOutputPaths: Set(producers.keys.map { $0.instance.path }), rootPathsPerTarget: rootPathsPerTarget, moduleCachePathsPerTarget: moduleCachePathsPerTarget, artifactInfoPerTarget: artifactInfoPerTarget, casValidationInfos: casValidationInfos, staleFileRemovalIdentifierPerTarget: staleFileRemovalIdentifierPerTarget, settingsPerTarget: settingsPerTarget, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, workspace: workspace, capturedBuildInfo: capturedBuildInfo)
1293+
let builder = BuildDescriptionBuilder(path: path, signature: signature, buildCommand: buildCommand, taskAdditionalInputs: taskAdditionalInputs, mutatedNodes: Set(mutableNodes.keys), mutatingTasks: mutatingTasks, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines, moduleSessionFilePath: moduleSessionFilePath, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, outputPathsPerTarget: outputPathsPerTarget, allOutputPaths: Set(producers.keys.map { $0.instance.path }), rootPathsPerTarget: rootPathsPerTarget, moduleCachePathsPerTarget: moduleCachePathsPerTarget, artifactInfoPerTarget: artifactInfoPerTarget, casValidationInfos: casValidationInfos, staleFileRemovalIdentifierPerTarget: staleFileRemovalIdentifierPerTarget, settingsPerTarget: settingsPerTarget, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, workspace: workspace)
13061294
for (target, diagnostics) in diagnostics {
13071295
let engine = builder.diagnosticsEngines.getOrInsert(target, { DiagnosticsEngine() })
13081296
for diag in diagnostics {

0 commit comments

Comments
 (0)