Skip to content
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
56 changes: 0 additions & 56 deletions Sources/SWBBuildSystem/BuildOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -310,62 +310,6 @@ package final class BuildOperation: BuildSystemOperation {
return effectiveStatus
}

// 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.
func emitCapturedBuildInfo(to path: Path) {
// If the build description doesn't have captured build info, then we don't emit it. Otherwise we proceed.
guard let capturedBuildInfo = buildDescription.capturedBuildInfo else {
buildOutputDelegate.warning("no captured build info available for incremental build - not emitting it")
return
}

guard path.isAbsolute else {
buildOutputDelegate.warning("CAPTURED_BUILD_INFO_DIR must be an absolute path, but is \(path.str) (skipping emitting captured build info)")
return
}

// Create the directory if necessary.
if !fs.exists(path) {
do {
try fs.createDirectory(path, recursive: true)
}
catch {
buildOutputDelegate.warning("Could not create directory for CAPTURED_BUILD_INFO_DIR (\(path.str)): \(error) (skipping emitting captured build info)")
return
}
}
else {
guard fs.isDirectory(path) else {
buildOutputDelegate.warning("CAPTURED_BUILD_INFO_DIR (\(path.str)) exists but is not a directory (skipping emitting captured build info)")
return
}
}

// 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.
let pid = ProcessInfo.processInfo.processIdentifier
let outputFilePath = path.join("xcodebuildCapturedInfo_\(pid).\(capturedBuildInfoFileExtension)")

// Write the captured build info to the file.
do {
try fs.write(outputFilePath, contents: capturedBuildInfo.propertyListItem.asJSONFragment() + "\n")
}
catch {
buildOutputDelegate.warning("Could not write captured build info to '\(outputFilePath.str)': \(error)")
return
}

buildOutputDelegate.note("Wrote captured build info to \(outputFilePath.str)")
}

// If we were asked to emit information about the targets being built, then do so now, unless we're in "dry run" mode.
if !request.useDryRun, let capturedBuildInfoDir = environment?["CAPTURED_BUILD_INFO_DIR"] {
if !capturedBuildInfoDir.isEmpty {
// If the resolved path is not empty, then emit the captured build info.
emitCapturedBuildInfo(to: Path(capturedBuildInfoDir))
} else {
buildOutputDelegate.warning("CAPTURED_BUILD_INFO_DIR is set but is empty (skipping emitting captured build info)")
}
}

// If task construction had errors, fail the build immediately, unless `continueBuildingAfterErrors` is set.
if !request.continueBuildingAfterErrors && buildDescription.hadErrors {
let effectiveStatus = BuildOperationEnded.Status.failed
Expand Down
1 change: 0 additions & 1 deletion Sources/SWBCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ add_library(SWBCore
BuildRuleAction.swift
BuildRuleCondition.swift
BuildRuleSet.swift
CapturedBuildInfo.swift
ClangModuleVerifier/ModuleVerifierFilenameMap.swift
ClangModuleVerifier/ModuleVerifierFramework.swift
ClangModuleVerifier/ModuleVerifierHeader.swift
Expand Down
496 changes: 0 additions & 496 deletions Sources/SWBCore/CapturedBuildInfo.swift

This file was deleted.

2 changes: 0 additions & 2 deletions Sources/SWBCore/DependencyResolution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import struct SWBProtocol.RunDestinationInfo
import SWBMacro

public protocol TargetGraph: Sendable {
var workspaceContext: WorkspaceContext { get }

var allTargets: OrderedSet<ConfiguredTarget> { get }

func dependencies(of target: ConfiguredTarget) -> [ConfiguredTarget]
Expand Down
6 changes: 3 additions & 3 deletions Sources/SWBCore/TargetDependencyResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public struct TargetBuildGraph: TargetGraph, Sendable {
}

/// The workspace context this graph is for.
public let workspaceContext: WorkspaceContext
private let workspaceContext: WorkspaceContext

/// The build request the graph is for.
public let buildRequest: BuildRequest
private let buildRequest: BuildRequest

public let buildRequestContext: BuildRequestContext
private let buildRequestContext: BuildRequestContext

/// The complete list of configured targets, in topological order. That is, each target will be included in the array only after all of the targets that it depends on (unless there is a target dependency cycle).
public let allTargets: OrderedSet<ConfiguredTarget>
Expand Down
14 changes: 2 additions & 12 deletions Sources/SWBCore/WorkspaceSettingsCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final class WorkspaceSettingsCache: Sendable {
}

/// Get the cached settings for the given parameters, without considering the context of any project/target.
public func getCachedSettings(_ parameters: BuildParameters, buildRequestContext: BuildRequestContext, purpose: SettingsPurpose = .build, filesSignature: ([Path]) -> FilesSignature) -> Settings {
public func getCachedSettings(_ parameters: BuildParameters, buildRequestContext: BuildRequestContext, purpose: SettingsPurpose, filesSignature: ([Path]) -> FilesSignature) -> Settings {
let key = SettingsCacheKey(parameters: parameters, projectGUID: nil, targetGUID: nil, purpose: purpose, provisioningTaskInputs: nil, impartedBuildProperties: nil)

// Check if there were any changes in used xcconfigs
Expand All @@ -80,20 +80,10 @@ final class WorkspaceSettingsCache: Sendable {
}
}

/// Get the cached settings for the given parameters and project.
public func getCachedSettings(_ parameters: BuildParameters, project: Project, purpose: SettingsPurpose = .build, provisioningTaskInputs: ProvisioningTaskInputs? = nil, impartedBuildProperties: [ImpartedBuildProperties]? = nil, buildRequestContext: BuildRequestContext, filesSignature: ([Path]) -> FilesSignature) -> Settings {
return getCachedSettings(parameters, project: project, target: nil, purpose: purpose, provisioningTaskInputs: provisioningTaskInputs, impartedBuildProperties: impartedBuildProperties, buildRequestContext: buildRequestContext, filesSignature: filesSignature)
}

/// Get the cached settings for the given parameters and target.
public func getCachedSettings(_ parameters: BuildParameters, target: Target, purpose: SettingsPurpose = .build, provisioningTaskInputs: ProvisioningTaskInputs? = nil, impartedBuildProperties: [ImpartedBuildProperties]? = nil, buildRequestContext: BuildRequestContext, filesSignature: ([Path]) -> FilesSignature) -> Settings {
return getCachedSettings(parameters, project: workspaceContext.workspace.project(for: target), target: target, purpose: purpose, provisioningTaskInputs: provisioningTaskInputs, impartedBuildProperties: impartedBuildProperties, buildRequestContext: buildRequestContext, filesSignature: filesSignature)
}

/// Private method to get the cached settings for the given parameters, project, and target.
///
/// - remark: This is internal so that clients don't somehow call this with a project which doesn't match the target, except for `BuildRequestContext` which has a cover method for it. There are public methods covering this one.
internal func getCachedSettings(_ parameters: BuildParameters, project: Project, target: Target? = nil, purpose: SettingsPurpose = .build, provisioningTaskInputs: ProvisioningTaskInputs? = nil, impartedBuildProperties: [ImpartedBuildProperties]? = nil, buildRequestContext: BuildRequestContext, filesSignature: ([Path]) -> FilesSignature) -> Settings {
internal func getCachedSettings(_ parameters: BuildParameters, project: Project, target: Target?, purpose: SettingsPurpose, provisioningTaskInputs: ProvisioningTaskInputs?, impartedBuildProperties: [ImpartedBuildProperties]?, buildRequestContext: BuildRequestContext, filesSignature: ([Path]) -> FilesSignature) -> Settings {
let key = SettingsCacheKey(parameters: parameters, projectGUID: project.guid, targetGUID: target?.guid, purpose: purpose, provisioningTaskInputs: provisioningTaskInputs, impartedBuildProperties: impartedBuildProperties)

// Check if there were any changes in used xcconfigs
Expand Down
Loading