Skip to content

Commit 3ecc734

Browse files
committed
fixup! external dependency hashing for incremental
1 parent 3d02171 commit 3ecc734

File tree

4 files changed

+123
-4
lines changed

4 files changed

+123
-4
lines changed

Sources/SwiftDriver/Execution/DriverExecutor.swift

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public protocol DriverExecutor {
2727
forceResponseFiles: Bool,
2828
recordedInputMetadata: [TypedVirtualPath: FileMetadata]) throws -> ProcessResult
2929

30+
func execute(job: Job,
31+
forceResponseFiles: Bool,
32+
recordedInputModificationDates: [TypedVirtualPath: TimePoint]) throws -> ProcessResult
33+
34+
3035
/// Execute multiple jobs, tracking job status using the provided execution delegate.
3136
/// Pass in the `IncrementalCompilationState` to allow for incremental compilation.
3237
/// Pass in the `InterModuleDependencyGraph` to allow for module dependency tracking.
@@ -37,6 +42,13 @@ public protocol DriverExecutor {
3742
recordedInputMetadata: [TypedVirtualPath: FileMetadata]
3843
) throws
3944

45+
func execute(workload: DriverExecutorWorkload,
46+
delegate: JobExecutionDelegate,
47+
numParallelJobs: Int,
48+
forceResponseFiles: Bool,
49+
recordedInputModificationDates: [TypedVirtualPath: TimePoint]
50+
) throws
51+
4052
/// Execute multiple jobs, tracking job status using the provided execution delegate.
4153
func execute(jobs: [Job],
4254
delegate: JobExecutionDelegate,
@@ -45,6 +57,13 @@ public protocol DriverExecutor {
4557
recordedInputMetadata: [TypedVirtualPath: FileMetadata]
4658
) throws
4759

60+
func execute(jobs: [Job],
61+
delegate: JobExecutionDelegate,
62+
numParallelJobs: Int,
63+
forceResponseFiles: Bool,
64+
recordedInputModificationDates: [TypedVirtualPath: TimePoint]
65+
) throws
66+
4867
/// Launch a process with the given command line and report the result.
4968
@discardableResult
5069
func checkNonZeroExit(args: String..., environment: [String: String]) throws -> String
@@ -53,6 +72,34 @@ public protocol DriverExecutor {
5372
func description(of job: Job, forceResponseFiles: Bool) throws -> String
5473
}
5574

75+
extension DriverExecutor {
76+
public func execute(job: Job,
77+
forceResponseFiles: Bool,
78+
recordedInputMetadata: [TypedVirtualPath: FileMetadata]) throws -> ProcessResult
79+
{
80+
return try execute(job: job, forceResponseFiles: forceResponseFiles, recordedInputModificationDates: recordedInputMetadata.mapValues { $0.mTime })
81+
}
82+
83+
84+
public func execute(workload: DriverExecutorWorkload,
85+
delegate: JobExecutionDelegate,
86+
numParallelJobs: Int,
87+
forceResponseFiles: Bool,
88+
recordedInputMetadata: [TypedVirtualPath: FileMetadata]
89+
) throws {
90+
try execute(workload: workload, delegate: delegate, numParallelJobs: numParallelJobs, forceResponseFiles: forceResponseFiles, recordedInputModificationDates: recordedInputMetadata.mapValues { $0.mTime })
91+
}
92+
93+
public func execute(jobs: [Job],
94+
delegate: JobExecutionDelegate,
95+
numParallelJobs: Int,
96+
forceResponseFiles: Bool,
97+
recordedInputMetadata: [TypedVirtualPath: FileMetadata]
98+
) throws {
99+
try execute(jobs: jobs, delegate: delegate, numParallelJobs: numParallelJobs, forceResponseFiles: forceResponseFiles, recordedInputModificationDates: recordedInputMetadata.mapValues { $0.mTime })
100+
}
101+
}
102+
56103
public struct DriverExecutorWorkload {
57104
public let continueBuildingAfterErrors: Bool
58105
public enum Kind {
@@ -121,14 +168,14 @@ extension DriverExecutor {
121168
delegate: JobExecutionDelegate,
122169
numParallelJobs: Int,
123170
forceResponseFiles: Bool,
124-
recordedInputMetadata: [TypedVirtualPath: FileMetadata]
171+
recordedInputModificationDates: [TypedVirtualPath: TimePoint]
125172
) throws {
126173
try execute(
127174
workload: .all(jobs),
128175
delegate: delegate,
129176
numParallelJobs: numParallelJobs,
130177
forceResponseFiles: forceResponseFiles,
131-
recordedInputMetadata: recordedInputMetadata)
178+
recordedInputModificationDates: recordedInputModificationDates)
132179
}
133180

134181
static func computeReturnCode(exitStatus: ProcessResult.ExitStatus) -> Int {

Sources/SwiftDriver/ToolingInterface/SimpleExecutor.swift

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,45 @@ import class TSCBasic.Process
4545
public func execute(workload: DriverExecutorWorkload, delegate: JobExecutionDelegate,
4646
numParallelJobs: Int, forceResponseFiles: Bool,
4747
recordedInputMetadata: [TypedVirtualPath : FileMetadata]) throws {
48-
fatalError("Unsupported operation on current executor")
48+
fatalError("Unsupported operation on current executor")
4949
}
5050

51+
public func execute(job: Job,
52+
forceResponseFiles: Bool,
53+
recordedInputModificationDates: [TypedVirtualPath : TimePoint]) throws -> ProcessResult {
54+
fatalError("Unsupported legacy operation on current executor")
55+
}
56+
57+
public func execute(workload: DriverExecutorWorkload, delegate: JobExecutionDelegate,
58+
numParallelJobs: Int, forceResponseFiles: Bool,
59+
recordedInputModificationDates: [TypedVirtualPath : TimePoint]) throws {
60+
fatalError("Unsupported operation on current executor")
61+
}
62+
63+
public func execute(jobs: [Job],
64+
delegate: JobExecutionDelegate,
65+
numParallelJobs: Int,
66+
forceResponseFiles: Bool,
67+
recordedInputModificationDates: [TypedVirtualPath: TimePoint]) throws {
68+
fatalError("Unsupported legacy operation on current executor")
69+
}
70+
71+
public func execute(
72+
jobs: [Job],
73+
delegate: JobExecutionDelegate,
74+
numParallelJobs: Int,
75+
forceResponseFiles: Bool,
76+
recordedInputMetadata: [TypedVirtualPath: FileMetadata]
77+
) throws {
78+
try execute(
79+
workload: .all(jobs),
80+
delegate: delegate,
81+
numParallelJobs: numParallelJobs,
82+
forceResponseFiles: forceResponseFiles,
83+
recordedInputMetadata: recordedInputMetadata)
84+
}
85+
86+
5187
public func checkNonZeroExit(args: String..., environment: [String : String]) throws -> String {
5288
try Process.checkNonZeroExit(arguments: args, environment: environment)
5389
}

Sources/SwiftDriverExecution/SwiftDriverExecutor.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ public final class SwiftDriverExecutor: DriverExecutor {
7070
}
7171
}
7272

73+
public func execute(job: Job,
74+
forceResponseFiles: Bool,
75+
recordedInputModificationDates: [TypedVirtualPath : TimePoint]) throws -> ProcessResult {
76+
fatalError("Unsuppored legacy operation on current executor")
77+
}
78+
7379
public func execute(workload: DriverExecutorWorkload,
7480
delegate: JobExecutionDelegate,
7581
numParallelJobs: Int = 1,
@@ -88,6 +94,14 @@ public final class SwiftDriverExecutor: DriverExecutor {
8894
try llbuildExecutor.execute(env: env, fileSystem: fileSystem)
8995
}
9096

97+
public func execute(workload: DriverExecutorWorkload,
98+
delegate: JobExecutionDelegate,
99+
numParallelJobs: Int = 1,
100+
forceResponseFiles: Bool = false,
101+
recordedInputModificationDates: [TypedVirtualPath: TimePoint]) throws {
102+
fatalError("Unsuppored legacy operation on current executor")
103+
}
104+
91105
@discardableResult
92106
public func checkNonZeroExit(args: String..., environment: [String: String] = ProcessEnv.vars) throws -> String {
93107
return try Process.checkNonZeroExit(arguments: args, environment: environment)

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5887,7 +5887,29 @@ final class SwiftDriverTests: XCTestCase {
58875887
func description(of job: Job, forceResponseFiles: Bool) throws -> String {
58885888
fatalError()
58895889
}
5890-
}
5890+
5891+
public func execute(job: Job,
5892+
forceResponseFiles: Bool,
5893+
recordedInputModificationDates: [TypedVirtualPath : TimePoint]) throws -> ProcessResult {
5894+
fatalError("This DriverExecutor protocol method is only for backwards compatibility and should not be called directly")
5895+
}
5896+
5897+
public func execute(workload: DriverExecutorWorkload,
5898+
delegate: JobExecutionDelegate,
5899+
numParallelJobs: Int,
5900+
forceResponseFiles: Bool,
5901+
recordedInputModificationDates: [TypedVirtualPath : TimePoint]) throws {
5902+
fatalError("This DriverExecutor protocol method is only for backwards compatibility and should not be called directly")
5903+
}
5904+
5905+
public func execute(jobs: [Job],
5906+
delegate: JobExecutionDelegate,
5907+
numParallelJobs: Int,
5908+
forceResponseFiles: Bool,
5909+
recordedInputModificationDates: [TypedVirtualPath: TimePoint]) throws {
5910+
fatalError("This DriverExecutor protocol method is only for backwards compatibility and should not be called directly")
5911+
}
5912+
}
58915913

58925914
// Override path to libSwiftScan to force the fallback of using the executor
58935915
var hideSwiftScanEnv = ProcessEnv.vars

0 commit comments

Comments
 (0)