Skip to content

Commit 4b2073f

Browse files
DougGregorxedin
authored andcommitted
Rename TargetDescription -> Target
1 parent 18c9f0e commit 4b2073f

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

Sources/SwiftRefactor/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ add_swift_syntax_library(SwiftRefactor
4242
PackageManifest/SourceControlURL.swift
4343
PackageManifest/StringUtils.swift
4444
PackageManifest/SyntaxEditUtils.swift
45-
PackageManifest/TargetDescription.swift
45+
PackageManifest/Target.swift
4646
)
4747

4848
target_link_swift_syntax_libraries(SwiftRefactor PUBLIC

Sources/SwiftRefactor/PackageManifest/AddPluginUsage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import SwiftSyntaxBuilder
1919
public struct AddPluginUsage: ManifestEditRefactoringProvider {
2020
public struct Context {
2121
public let targetName: String
22-
public let pluginUsage: TargetDescription.PluginUsage
22+
public let pluginUsage: Target.PluginUsage
2323

24-
public init(targetName: String, pluginUsage: TargetDescription.PluginUsage) {
24+
public init(targetName: String, pluginUsage: Target.PluginUsage) {
2525
self.targetName = targetName
2626
self.pluginUsage = pluginUsage
2727
}

Sources/SwiftRefactor/PackageManifest/AddTarget.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import SwiftSyntaxBuilder
1717
/// Add a target to a manifest's source code.
1818
public struct AddTarget: ManifestEditRefactoringProvider {
1919
public struct Context {
20-
public let target: TargetDescription
20+
public let target: Target
2121
public let configuration: Configuration
2222

23-
public init(target: TargetDescription, configuration: Configuration = .init()) {
23+
public init(target: Target, configuration: Configuration = .init()) {
2424
self.target = target
2525
self.configuration = configuration
2626
}
@@ -187,7 +187,7 @@ public struct AddTarget: ManifestEditRefactoringProvider {
187187
/// source files.
188188
fileprivate static func addPrimarySourceFile(
189189
outerPath: RelativePath,
190-
target: TargetDescription,
190+
target: Target,
191191
configuration: Configuration,
192192
to auxiliaryFiles: inout AuxiliaryFiles
193193
) {
@@ -300,7 +300,7 @@ public struct AddTarget: ManifestEditRefactoringProvider {
300300
/// for a macro target.
301301
fileprivate static func addProvidedMacrosSourceFile(
302302
outerPath: RelativePath,
303-
target: TargetDescription,
303+
target: Target,
304304
to auxiliaryFiles: inout AuxiliaryFiles
305305
) {
306306
auxiliaryFiles.addSourceFile(
@@ -321,7 +321,7 @@ public struct AddTarget: ManifestEditRefactoringProvider {
321321
}
322322
}
323323

324-
fileprivate extension TargetDescription.Dependency {
324+
fileprivate extension Target.Dependency {
325325
/// Retrieve the name of the dependency
326326
var name: String {
327327
switch self {
@@ -349,7 +349,7 @@ fileprivate extension AuxiliaryFiles {
349349

350350
/// The set of dependencies we need to introduce to a newly-created macro
351351
/// target.
352-
fileprivate let macroTargetDependencies: [TargetDescription.Dependency] = [
352+
fileprivate let macroTargetDependencies: [Target.Dependency] = [
353353
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
354354
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
355355
]
@@ -375,7 +375,7 @@ fileprivate extension PackageDependency {
375375
}
376376
}
377377

378-
fileprivate extension TargetDescription {
378+
fileprivate extension Target {
379379
var sanitizedName: String {
380380
name
381381
.mangledToC99ExtendedIdentifier()

Sources/SwiftRefactor/PackageManifest/AddTargetDependency.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import SwiftSyntaxBuilder
1818
public struct AddTargetDependency: ManifestEditRefactoringProvider {
1919
public struct Context {
2020
/// The dependency to add.
21-
public var dependency: TargetDescription.Dependency
21+
public var dependency: Target.Dependency
2222

2323
/// The name of the target to which the dependency will be added.
2424
public var targetName: String
2525

26-
public init(dependency: TargetDescription.Dependency, targetName: String) {
26+
public init(dependency: Target.Dependency, targetName: String) {
2727
self.dependency = dependency
2828
self.targetName = targetName
2929
}
@@ -78,7 +78,7 @@ public struct AddTargetDependency: ManifestEditRefactoringProvider {
7878

7979
/// Implementation of adding a target dependency to an existing call.
8080
static func addTargetDependencyLocal(
81-
_ dependency: TargetDescription.Dependency,
81+
_ dependency: Target.Dependency,
8282
to targetCall: FunctionCallExprSyntax
8383
) throws -> FunctionCallExprSyntax {
8484
try targetCall.appendingToArrayArgument(

Sources/SwiftRefactor/PackageManifest/TargetDescription.swift renamed to Sources/SwiftRefactor/PackageManifest/Target.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import SwiftSyntax
1414

1515
/// Syntactic wrapper type that describes a target for refactoring
1616
/// purposes but does not interpret its contents.
17-
public struct TargetDescription {
17+
public struct Target {
1818
public let name: String
1919

2020
/// The type of target.
@@ -71,7 +71,7 @@ public struct TargetDescription {
7171
}
7272
}
7373

74-
extension TargetDescription: ManifestSyntaxRepresentable {
74+
extension Target: ManifestSyntaxRepresentable {
7575
/// The function name in the package manifest.
7676
private var functionName: String {
7777
switch type {
@@ -111,7 +111,7 @@ extension TargetDescription: ManifestSyntaxRepresentable {
111111
}
112112
}
113113

114-
extension TargetDescription.Dependency: ManifestSyntaxRepresentable {
114+
extension Target.Dependency: ManifestSyntaxRepresentable {
115115
func asSyntax() -> ExprSyntax {
116116
switch self {
117117
case .byName(name: let name):
@@ -129,7 +129,7 @@ extension TargetDescription.Dependency: ManifestSyntaxRepresentable {
129129
}
130130
}
131131

132-
extension TargetDescription.PluginUsage: ManifestSyntaxRepresentable {
132+
extension Target.PluginUsage: ManifestSyntaxRepresentable {
133133
func asSyntax() -> ExprSyntax {
134134
switch self {
135135
case .plugin(name: let name, package: nil):

Tests/SwiftRefactorTest/ManifestEditTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ final class ManifestEditTests: XCTestCase {
345345
],
346346
provider: AddTarget.self,
347347
context: .init(
348-
target: TargetDescription(name: "MyLib")
348+
target: Target(name: "MyLib")
349349
)
350350
)
351351
}
@@ -384,7 +384,7 @@ final class ManifestEditTests: XCTestCase {
384384
],
385385
provider: AddTarget.self,
386386
context: .init(
387-
target: TargetDescription(
387+
target: Target(
388388
name: "MyLib",
389389
dependencies: [
390390
.byName(name: "OtherLib"),
@@ -442,7 +442,7 @@ final class ManifestEditTests: XCTestCase {
442442
],
443443
provider: AddTarget.self,
444444
context: .init(
445-
target: TargetDescription(
445+
target: Target(
446446
name: "MyProgram target-name",
447447
type: .executable,
448448
dependencies: [
@@ -513,7 +513,7 @@ final class ManifestEditTests: XCTestCase {
513513
],
514514
provider: AddTarget.self,
515515
context: .init(
516-
target: TargetDescription(
516+
target: Target(
517517
name: "MyMacro target-name",
518518
type: .macro
519519
)
@@ -553,7 +553,7 @@ final class ManifestEditTests: XCTestCase {
553553
],
554554
provider: AddTarget.self,
555555
context: .init(
556-
target: TargetDescription(
556+
target: Target(
557557
name: "MyTest target-name",
558558
type: .test
559559
),

0 commit comments

Comments
 (0)