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
8 changes: 4 additions & 4 deletions SourceKitStressTester/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ let package = Package(
.executable(name: "sk-swiftc-wrapper", targets: ["sk-swiftc-wrapper"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-package-manager.git", .exact("0.3.0")),
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
// FIXME: We should depend on master once master contains all the degybed files
.package(url: "https://github.com/apple/swift-syntax.git", .branch("master-gen")),

],
targets: [
.target(
name: "Common",
dependencies: ["Utility"]),
dependencies: ["TSCUtility"]),
.target(
name: "StressTester",
dependencies: ["Common", "Utility", "SwiftSyntax"]),
dependencies: ["Common", "TSCUtility", "SwiftSyntax"]),
.target(
name: "SwiftCWrapper",
dependencies: ["Common", "Utility"]),
dependencies: ["Common", "TSCUtility"]),

.target(
name: "sk-stress-test",
Expand Down
2 changes: 1 addition & 1 deletion SourceKitStressTester/Sources/Common/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

import Foundation
import Basic
import TSCBasic

public protocol Message: Codable, CustomStringConvertible {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ struct SourceKitDocument {
// FIXME: We don't supply a valid new name for initializer calls for local
// rename requests. Ignore these errors for now.
if response.isError, !response.description.contains("does not match the arity of the old name") {
throw SourceKitError.failed(.errorResponse, request: request, response: response.description.chomp())
throw SourceKitError.failed(.errorResponse, request: request, response: response.description.spm_chomp())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import Foundation
import Common
import Utility
import Basic
import TSCUtility
import TSCBasic
import SwiftSyntax

public struct StressTesterTool {
Expand Down Expand Up @@ -124,7 +124,7 @@ public struct StressTesterTool {
}
}

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

do {
Expand Down
14 changes: 7 additions & 7 deletions SourceKitStressTester/Sources/SwiftCWrapper/SwiftCWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import Common
import Foundation
import func Utility.createProgressBar
import protocol Utility.ProgressBarProtocol
import Basic
import class TSCUtility.PercentProgressAnimation
import protocol TSCUtility.ProgressAnimationProtocol
import TSCBasic

struct SwiftCWrapper {
let arguments: [String]
Expand Down Expand Up @@ -90,10 +90,10 @@ struct SwiftCWrapper {
guard !operations.isEmpty else { return swiftcResult.status }

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

let queue = FailFastOperationQueue(operations: operations, maxWorkers: maxJobs) { index, operation, completed, total -> Bool in
let message = "\(operation.file) (\(operation.summary)): \(operation.status.name)"
progress?.update(percent: completed * 100 / total, text: message)
progress?.update(step: completed, total: total, text: message)
orderingHandler?.complete(operation.responses, at: index, setLast: !operation.status.isPassed)
operation.responses.removeAll()
return operation.status.isPassed
Expand Down
2 changes: 1 addition & 1 deletion SourceKitStressTester/Sources/sk-stress-test/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import Foundation
import StressTester
import Basic
import TSCBasic

let stressTester = StressTesterTool(arguments: CommandLine.arguments)

Expand Down
2 changes: 1 addition & 1 deletion SourceKitStressTester/Sources/sk-swiftc-wrapper/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import Foundation
import SwiftCWrapper
import Basic
import TSCBasic

let wrapper = SwiftCWrapperTool(arguments: CommandLine.arguments,
environment: ProcessInfo.processInfo.environment)
Expand Down
4 changes: 2 additions & 2 deletions SwiftEvolve/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let package = Package(
.library(name: "SwiftEvolve", targets: ["SwiftEvolve"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-package-manager.git", .exact("0.3.0")),
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
// FIXME: We should depend on master once master contains all the degybed files
.package(url: "https://github.com/apple/swift-syntax.git", .branch("master-gen")),
],
Expand All @@ -22,7 +22,7 @@ let package = Package(
dependencies: ["SwiftEvolve"]),
.target(
name: "SwiftEvolve",
dependencies: ["Utility", "SwiftSyntax"]),
dependencies: ["TSCUtility", "SwiftSyntax"]),
.testTarget(
name: "SwiftEvolveTests",
dependencies: ["SwiftEvolve"])
Expand Down
12 changes: 6 additions & 6 deletions SwiftEvolve/Sources/SwiftEvolve/CommandLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
///
// -----------------------------------------------------------------------------

import Utility
import Basic
import TSCUtility
import TSCBasic

// MARK: Argument parsing

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

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

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

case let .exit(code: status):
return ["exit", String(status)]
Expand All @@ -135,15 +135,15 @@ extension SwiftEvolveTool.Step.Options {
fileprivate func arguments(with stageArgs: [String]) -> [String] {
var args = [command] + stageArgs
if let rulesFile = rulesFile {
args += ["--rules", rulesFile.asString]
args += ["--rules", rulesFile.pathString]
}
if replace {
args += ["--replace"]
}
if verbose {
args += ["--verbose"]
}
args += files.map { $0.asString }
args += files.map { $0.pathString }
return args
}
}
Expand Down
13 changes: 5 additions & 8 deletions SwiftEvolve/Sources/SwiftEvolve/SwiftEvolveTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Foundation
import SwiftSyntax
import Basic
import TSCBasic

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

if options.replace {
try withExtendedLifetime(
TemporaryFile(
dir: file.parentDirectory, prefix: "", suffix: file.basename,
deleteOnClose: true
)
) { tempFile in
try withTemporaryFile(dir: file.parentDirectory, prefix: "",
suffix: file.basename,
deleteOnClose: true) { tempFile in
tempFile.fileHandle.write(evolved.description)

_ = try withErrorContext(
Expand Down Expand Up @@ -186,7 +183,7 @@ extension SwiftEvolveTool {

extension URL {
init(_ path: AbsolutePath) {
self.init(fileURLWithPath: path.asString)
self.init(fileURLWithPath: path.pathString)
}
}

Expand Down
2 changes: 1 addition & 1 deletion SwiftEvolve/Tests/SwiftEvolveTests/CommandLineTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import XCTest
@testable import SwiftEvolve
import Basic
import TSCBasic

class CommandLineTests: XCTestCase {
func file(named name: String) -> AbsolutePath {
Expand Down
2 changes: 1 addition & 1 deletion SwiftEvolve/Tests/SwiftEvolveTests/TestUtils.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
import SwiftSyntax
@testable import SwiftEvolve
import Basic
import TSCBasic

extension SyntaxProtocol {
func filter<T: SyntaxProtocol>(whereIs type: T.Type) -> [T] {
Expand Down