Skip to content

Commit afa0236

Browse files
committed
Emit modules dependencies
1 parent 6869838 commit afa0236

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Sources/XCRemoteCache/Commands/SwiftFrontend/SwiftFrontendArgInput.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ public struct SwiftFrontendArgInput {
145145
file: primaryInputFilesURLs[i],
146146
dependencies: dependenciesPaths.get(i).map(URL.init(fileURLWithPath:)),
147147
object: outputPaths.get(i).map(URL.init(fileURLWithPath:)),
148-
swiftDependencies: dependenciesPaths.get(i).map(URL.init(fileURLWithPath:))
148+
// for now - swift-dependencies are not requested in the driver compilation mode
149+
swiftDependencies: nil
149150
)
150151
return new
151152
}
@@ -156,7 +157,7 @@ public struct SwiftFrontendArgInput {
156157
steps: steps,
157158
outputs: .map(compilationFileMap),
158159
target: target,
159-
inputs: .list(outputPaths),
160+
inputs: .list(inputPaths),
160161
exampleWorkspaceFilePath: outputPaths[0]
161162
)
162163
} else {
@@ -185,7 +186,8 @@ public struct SwiftFrontendArgInput {
185186
compileFilesScope: .none,
186187
emitModule: SwiftcContext.SwiftcStepEmitModule(
187188
objcHeaderOutput: URL(fileURLWithPath: objcHeaderOutput),
188-
modulePathOutput: URL(fileURLWithPath: outputPaths[0])
189+
modulePathOutput: URL(fileURLWithPath: outputPaths[0]),
190+
dependencies: URL(fileURLWithPath: dependenciesPaths[0])
189191
)
190192
)
191193
return try .init(
@@ -194,7 +196,7 @@ public struct SwiftFrontendArgInput {
194196
steps: steps,
195197
outputs: .map([:]),
196198
target: target,
197-
inputs: .list([]),
199+
inputs: .list(inputPaths),
198200
exampleWorkspaceFilePath: objcHeaderOutput
199201
)
200202
}

Sources/XCRemoteCache/Commands/Swiftc/SwiftcContext.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public struct SwiftcContext {
2323
public struct SwiftcStepEmitModule {
2424
let objcHeaderOutput: URL
2525
let modulePathOutput: URL
26+
let dependencies: URL?
2627
}
2728
public enum SwiftcStepCompileFilesScope {
2829
case none
@@ -126,7 +127,8 @@ public struct SwiftcContext {
126127
compileFilesScope: .all,
127128
emitModule: SwiftcStepEmitModule(
128129
objcHeaderOutput: URL(fileURLWithPath: (input.objcHeaderOutput)),
129-
modulePathOutput: URL(fileURLWithPath: input.modulePathOutput)
130+
modulePathOutput: URL(fileURLWithPath: input.modulePathOutput),
131+
dependencies: nil
130132
)
131133
)
132134
let outputs = CompilationFilesOutputs.fileMap(input.filemap)

Sources/XCRemoteCache/Commands/Swiftc/XCSwiftc.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public class XCSwiftAbstract<InputArgs> {
7878
let markerWriter = FileMarkerWriter(markerURL, fileAccessor: fileManager)
7979

8080
let inputReader: SwiftcInputReader
81+
// TODO: consider renaming
82+
// outputs and outputs of the swift step are described in a map together
83+
// and the file/list is named "output"
8184
switch context.outputs {
8285
case .fileMap(let path):
8386
inputReader = SwiftcFilemapInputEditor(URL(fileURLWithPath: path), fileManager: fileManager)
@@ -86,7 +89,7 @@ public class XCSwiftAbstract<InputArgs> {
8689
// TODO: check if first 2 ars can always be `nil`
8790
// with Xcode 13, inputs via cmd are only used for compilations
8891
inputReader = StaticSwiftcInputReader(
89-
moduleDependencies: nil,
92+
moduleDependencies: context.steps.emitModule?.dependencies,
9093
swiftDependencies: nil,
9194
compilationFiles: Array(map.values)
9295
)

Sources/XCRemoteCache/Utils/Array+Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Foundation
2121

2222
public extension Array {
2323
func get(_ i: Index) -> Element? {
24-
guard count < i else {
24+
guard count > i else {
2525
return nil
2626
}
2727
return self[i]

0 commit comments

Comments
 (0)