Skip to content

Commit 479e17b

Browse files
authored
Merge pull request #97 from ahoppen/stresstester-depend-on-master
Make the stress tester and SwiftEvolve depend on SwiftPM's master branch
2 parents 0cb1972 + 3deed60 commit 479e17b

File tree

12 files changed

+33
-36
lines changed

12 files changed

+33
-36
lines changed

SourceKitStressTester/Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ let package = Package(
99
.executable(name: "sk-swiftc-wrapper", targets: ["sk-swiftc-wrapper"]),
1010
],
1111
dependencies: [
12-
.package(url: "https://github.com/apple/swift-package-manager.git", .exact("0.3.0")),
12+
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
1313
// FIXME: We should depend on master once master contains all the degybed files
1414
.package(url: "https://github.com/apple/swift-syntax.git", .branch("master-gen")),
1515

1616
],
1717
targets: [
1818
.target(
1919
name: "Common",
20-
dependencies: ["Utility"]),
20+
dependencies: ["TSCUtility"]),
2121
.target(
2222
name: "StressTester",
23-
dependencies: ["Common", "Utility", "SwiftSyntax"]),
23+
dependencies: ["Common", "TSCUtility", "SwiftSyntax"]),
2424
.target(
2525
name: "SwiftCWrapper",
26-
dependencies: ["Common", "Utility"]),
26+
dependencies: ["Common", "TSCUtility"]),
2727

2828
.target(
2929
name: "sk-stress-test",

SourceKitStressTester/Sources/Common/Message.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Foundation
14-
import Basic
14+
import TSCBasic
1515

1616
public protocol Message: Codable, CustomStringConvertible {}
1717

SourceKitStressTester/Sources/StressTester/SourceKitDocument.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ struct SourceKitDocument {
295295
// FIXME: We don't supply a valid new name for initializer calls for local
296296
// rename requests. Ignore these errors for now.
297297
if response.isError, !response.description.contains("does not match the arity of the old name") {
298-
throw SourceKitError.failed(.errorResponse, request: request, response: response.description.chomp())
298+
throw SourceKitError.failed(.errorResponse, request: request, response: response.description.spm_chomp())
299299
}
300300
}
301301

SourceKitStressTester/Sources/StressTester/StressTesterTool.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
import Foundation
1414
import Common
15-
import Utility
16-
import Basic
15+
import TSCUtility
16+
import TSCBasic
1717
import SwiftSyntax
1818

1919
public struct StressTesterTool {
@@ -124,7 +124,7 @@ public struct StressTesterTool {
124124
}
125125
}
126126

127-
let absoluteFile = URL(fileURLWithPath: arguments.get(file)!.path.asString)
127+
let absoluteFile = URL(fileURLWithPath: arguments.get(file)!.path.pathString)
128128
let args = Array(arguments.get(compilerArgs)!.dropFirst())
129129

130130
do {

SourceKitStressTester/Sources/SwiftCWrapper/SwiftCWrapper.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
import Common
1414
import Foundation
15-
import func Utility.createProgressBar
16-
import protocol Utility.ProgressBarProtocol
17-
import Basic
15+
import class TSCUtility.PercentProgressAnimation
16+
import protocol TSCUtility.ProgressAnimationProtocol
17+
import TSCBasic
1818

1919
struct SwiftCWrapper {
2020
let arguments: [String]
@@ -90,10 +90,10 @@ struct SwiftCWrapper {
9090
guard !operations.isEmpty else { return swiftcResult.status }
9191

9292
// Run the operations, reporting progress
93-
let progress: ProgressBarProtocol?
93+
let progress: ProgressAnimationProtocol?
9494
if !suppressOutput {
95-
progress = createProgressBar(forStream: stderrStream, header: "Stress testing SourceKit...")
96-
progress?.update(percent: 0, text: "Scheduling \(operations.count) operations")
95+
progress = PercentProgressAnimation(stream: stderrStream, header: "Stress testing SourceKit...")
96+
progress?.update(step: 0, total: operations.count, text: "Scheduling \(operations.count) operations")
9797
} else {
9898
progress = nil
9999
}
@@ -109,7 +109,7 @@ struct SwiftCWrapper {
109109

110110
let queue = FailFastOperationQueue(operations: operations, maxWorkers: maxJobs) { index, operation, completed, total -> Bool in
111111
let message = "\(operation.file) (\(operation.summary)): \(operation.status.name)"
112-
progress?.update(percent: completed * 100 / total, text: message)
112+
progress?.update(step: completed, total: total, text: message)
113113
orderingHandler?.complete(operation.responses, at: index, setLast: !operation.status.isPassed)
114114
operation.responses.removeAll()
115115
return operation.status.isPassed

SourceKitStressTester/Sources/sk-stress-test/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414
import StressTester
15-
import Basic
15+
import TSCBasic
1616

1717
let stressTester = StressTesterTool(arguments: CommandLine.arguments)
1818

SourceKitStressTester/Sources/sk-swiftc-wrapper/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414
import SwiftCWrapper
15-
import Basic
15+
import TSCBasic
1616

1717
let wrapper = SwiftCWrapperTool(arguments: CommandLine.arguments,
1818
environment: ProcessInfo.processInfo.environment)

SwiftEvolve/Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let package = Package(
1010
.library(name: "SwiftEvolve", targets: ["SwiftEvolve"])
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/apple/swift-package-manager.git", .exact("0.3.0")),
13+
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
1414
// FIXME: We should depend on master once master contains all the degybed files
1515
.package(url: "https://github.com/apple/swift-syntax.git", .branch("master-gen")),
1616
],
@@ -22,7 +22,7 @@ let package = Package(
2222
dependencies: ["SwiftEvolve"]),
2323
.target(
2424
name: "SwiftEvolve",
25-
dependencies: ["Utility", "SwiftSyntax"]),
25+
dependencies: ["TSCUtility", "SwiftSyntax"]),
2626
.testTarget(
2727
name: "SwiftEvolveTests",
2828
dependencies: ["SwiftEvolve"])

SwiftEvolve/Sources/SwiftEvolve/CommandLine.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
///
1515
// -----------------------------------------------------------------------------
1616

17-
import Utility
18-
import Basic
17+
import TSCUtility
18+
import TSCBasic
1919

2020
// MARK: Argument parsing
2121

@@ -74,7 +74,7 @@ extension SwiftEvolveTool.Step {
7474
let files: PositionalArgument<[PathArgument]>
7575

7676
init() {
77-
parser = Utility.ArgumentParser(usage: usage, overview: overview)
77+
parser = ArgumentParser(usage: usage, overview: overview)
7878
rulesFile = parser.add(option: "--rules", kind: PathArgument.self,
7979
usage: "<PATH> JSON specification of plan generation rules")
8080
seed = parser.add(option: "--seed", kind: UInt64.self,
@@ -119,7 +119,7 @@ extension SwiftEvolveTool.Step: CustomStringConvertible {
119119
return options.arguments(with: ["--seed", String(seed)])
120120

121121
case let .evolve(planFile: planFile, options: options):
122-
return options.arguments(with: ["--plan", planFile.asString])
122+
return options.arguments(with: ["--plan", planFile.pathString])
123123

124124
case let .exit(code: status):
125125
return ["exit", String(status)]
@@ -135,15 +135,15 @@ extension SwiftEvolveTool.Step.Options {
135135
fileprivate func arguments(with stageArgs: [String]) -> [String] {
136136
var args = [command] + stageArgs
137137
if let rulesFile = rulesFile {
138-
args += ["--rules", rulesFile.asString]
138+
args += ["--rules", rulesFile.pathString]
139139
}
140140
if replace {
141141
args += ["--replace"]
142142
}
143143
if verbose {
144144
args += ["--verbose"]
145145
}
146-
args += files.map { $0.asString }
146+
args += files.map { $0.pathString }
147147
return args
148148
}
149149
}

SwiftEvolve/Sources/SwiftEvolve/SwiftEvolveTool.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import Foundation
1818
import SwiftSyntax
19-
import Basic
19+
import TSCBasic
2020

2121
public class SwiftEvolveTool {
2222
enum Step: Hashable {
@@ -137,12 +137,9 @@ extension SwiftEvolveTool {
137137
let evolved = evolver.evolve(in: parsed, at: URL(file))
138138

139139
if options.replace {
140-
try withExtendedLifetime(
141-
TemporaryFile(
142-
dir: file.parentDirectory, prefix: "", suffix: file.basename,
143-
deleteOnClose: true
144-
)
145-
) { tempFile in
140+
try withTemporaryFile(dir: file.parentDirectory, prefix: "",
141+
suffix: file.basename,
142+
deleteOnClose: true) { tempFile in
146143
tempFile.fileHandle.write(evolved.description)
147144

148145
_ = try withErrorContext(
@@ -186,7 +183,7 @@ extension SwiftEvolveTool {
186183

187184
extension URL {
188185
init(_ path: AbsolutePath) {
189-
self.init(fileURLWithPath: path.asString)
186+
self.init(fileURLWithPath: path.pathString)
190187
}
191188
}
192189

0 commit comments

Comments
 (0)