Skip to content

Commit 7a937c7

Browse files
committed
Minor fixes
1 parent 195db6c commit 7a937c7

File tree

7 files changed

+29
-30
lines changed

7 files changed

+29
-30
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ let package = Package(
197197
.target(
198198
/** Parse `@package` marks */
199199
name: "ScriptParse",
200-
dependencies: ["SwiftSyntax", "SwiftToolsSupport-auto", "ArgumentParser"]
200+
dependencies: ["SwiftToolsSupport-auto", "ArgumentParser", "SwiftSyntax"]
201201
),
202202

203203
.target(
@@ -249,7 +249,7 @@ let package = Package(
249249
name: "swift-script",
250250
dependencies: ["Commands"]),
251251
.target(
252-
/** Manages and runs a script */
252+
/** Parse `@package` marks */
253253
name: "package-parser",
254254
dependencies: ["ScriptParse"]),
255255
.target(

Sources/Commands/SwiftScriptTool.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
This source file is part of the Swift.org open source project
2+
This source file is part of the Swift.org open source project
33

4-
Copyright 2015 - 2016 Apple Inc. and the Swift project authors
5-
Licensed under Apache License v2.0 with Runtime Library Exception
4+
Copyright 2015 - 2021 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
66

7-
See http://swift.org/LICENSE.txt for license information
8-
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9-
*/
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
1010

1111
import ArgumentParser
1212
import Basics
@@ -179,7 +179,7 @@ extension SwiftScriptTool {
179179

180180
@OptionGroup()
181181
var options: ScriptToolOptions
182-
182+
183183
func run(_ swiftTool: SwiftTool, as productName: String, at cacheDirPath: AbsolutePath) throws {
184184
try swiftTool.getActiveWorkspace().clean(with: swiftTool.diagnostics)
185185
}
@@ -194,12 +194,12 @@ extension SwiftScriptTool {
194194

195195
@OptionGroup()
196196
var options: ScriptToolOptions
197-
197+
198198
func run(_ swiftTool: SwiftTool, as productName: String, at cacheDirPath: AbsolutePath) throws {
199199
try localFileSystem.removeFileTree(cacheDirPath)
200200
}
201201
}
202-
202+
203203
struct Update: ScriptCommand {
204204
static let configuration = CommandConfiguration(
205205
abstract: "Update package dependencies")
@@ -209,11 +209,11 @@ extension SwiftScriptTool {
209209

210210
@OptionGroup()
211211
var options: ScriptToolOptions
212-
212+
213213
@Flag(name: [.long, .customShort("n")],
214214
help: "Display the list of dependencies that can be updated")
215215
var dryRun: Bool = false
216-
216+
217217
@Argument(help: "The packages to update")
218218
var packages: [String] = []
219219

@@ -284,10 +284,10 @@ extension SwiftScriptTool {
284284
struct ResolveOptions: ParsableArguments {
285285
@Option(help: "The version to resolve at", transform: { Version(string: $0) })
286286
var version: Version?
287-
287+
288288
@Option(help: "The branch to resolve at")
289289
var branch: String?
290-
290+
291291
@Option(help: "The revision to resolve at")
292292
var revision: String?
293293

@@ -298,7 +298,7 @@ extension SwiftScriptTool {
298298
struct Resolve: ScriptCommand {
299299
static let configuration = CommandConfiguration(
300300
abstract: "Resolve package dependencies")
301-
301+
302302
@OptionGroup(_hiddenFromHelp: true)
303303
var swiftOptions: SwiftToolOptions
304304

@@ -307,7 +307,7 @@ extension SwiftScriptTool {
307307

308308
@OptionGroup()
309309
var resolveOptions: ResolveOptions
310-
310+
311311
func run(_ swiftTool: SwiftTool, as productName: String, at cacheDirPath: AbsolutePath) throws {
312312
// If a package is provided, use that to resolve the dependencies.
313313
if let packageName = resolveOptions.packageName {
@@ -351,11 +351,11 @@ fileprivate func run(
351351
/// - Parameter stream: Stream used for logging
352352
fileprivate func logPackageChanges(changes: [(PackageReference, Workspace.PackageStateChange)], pins: PinsStore, on stream: OutputByteStream = TSCBasic.stdoutStream) {
353353
let changes = changes.filter { $0.1 != .unchanged }
354-
354+
355355
stream <<< "\n"
356356
stream <<< "\(changes.count) dependenc\(changes.count == 1 ? "y has" : "ies have") changed\(changes.count > 0 ? ":" : ".")"
357357
stream <<< "\n"
358-
358+
359359
for (package, change) in changes {
360360
let currentVersion = pins.pinsMap[package.identity]?.state.description ?? ""
361361
switch change {

Sources/ScriptParse/Models.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99

1010
FIXME: This is a temporary alternative of the frontend implementation.
11-
*/
11+
*/
1212

1313
import struct Foundation.URL
1414
import TSCBasic
@@ -31,7 +31,7 @@ struct PackageModel: Codable {
3131
struct PackageDependency: Codable {
3232
let package: PackageModel
3333
var modules: [String] = []
34-
34+
3535
init(of package: PackageModel) {
3636
self.package = package
3737
}

Sources/ScriptParse/ScriptParse.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99

1010
FIXME: This is a temporary alternative of the frontend implementation.
11-
*/
11+
*/
1212

1313
import SwiftSyntax
1414
import TSCBasic
@@ -23,14 +23,13 @@ public struct ScriptParse: ParsableCommand {
2323
encoder.outputFormatting = .prettyPrinted
2424
return encoder
2525
}()
26-
26+
2727
public init() {}
2828
}
2929

3030
extension ScriptParse {
3131
static func parse(_ path: AbsolutePath) throws -> ScriptDependencies {
3232
let syntaxTree = try SyntaxParser.parse(path.asURL)
33-
// let converter = SourceLocationConverter(file: path.basename, tree: syntaxTree)
3433

3534
var inPackageScope = false
3635
var keyStatements: [CodeBlockItemSyntax] = []
@@ -90,13 +89,13 @@ extension ScriptParse {
9089
}
9190
return ScriptDependencies(sourceFile: path, modules: collected)
9291
}
93-
92+
9493
public func run() throws {
9594
let path = try AbsolutePath(validating: file)
9695
let json = try ScriptParse.manifest(for: path)
9796
print(String(data: json, encoding: .utf8)!)
9897
}
99-
98+
10099
// FIXME: This should be removed some day.
101100
public static func manifest(for path: AbsolutePath) throws -> Data {
102101
let output = try parse(path)

Sources/ScriptParse/StatementKind.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99

1010
FIXME: This is a temporary alternative of the frontend implementation.
11-
*/
11+
*/
1212

1313
import SwiftSyntax
1414

Sources/ScriptParse/misc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99

1010
FIXME: This is a temporary alternative of the frontend implementation.
11-
*/
11+
*/
1212

1313
import SwiftSyntax
1414
import Foundation

Sources/ScriptingCore/Models.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public struct PackageModel: Codable {
1616
public let raw: String
1717
public let url: Foundation.URL?
1818
public let path: AbsolutePath?
19-
public let _name: String?
19+
private let _name: String?
2020

2121
public var name: String {
2222
if let name = _name {
@@ -37,7 +37,7 @@ public struct PackageModel: Codable {
3737
public struct PackageDependency: Codable {
3838
public let package: PackageModel
3939
public var modules: [String] = []
40-
40+
4141
init(of package: PackageModel) {
4242
self.package = package
4343
}

0 commit comments

Comments
 (0)