Skip to content

Commit 7a90723

Browse files
xedinbnbarham
authored andcommitted
[Commands] Adopt changes to package manifest refactoring actions
Previously package manifest refactoring actions conformed to a custom refactoring provider and produced a `PackageEdit` that, in addition to manifest file changes, included a list of auxiliary files. This is no longer the case and all package manifest refactoring actions are now responsible only for manifest file transformations, the rest is handled by the commands themselves.
1 parent dcead94 commit 7a90723

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

Sources/Commands/PackageCommands/AddDependency.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ extension SwiftPackageCommand {
255255
}
256256
}
257257

258-
let editResult = try AddPackageDependency.manifestRefactor(
258+
let editResult = try AddPackageDependency.textRefactor(
259259
syntax: manifestSyntax,
260260
in: .init(dependency: packageDependency)
261261
)

Sources/Commands/PackageCommands/AddProduct.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extension SwiftPackageCommand {
9393
targets: targets
9494
)
9595

96-
let editResult = try SwiftRefactor.AddProduct.manifestRefactor(
96+
let editResult = try SwiftRefactor.AddProduct.textRefactor(
9797
syntax: manifestSyntax,
9898
in: .init(product: product)
9999
)

Sources/Commands/PackageCommands/AddSetting.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ extension SwiftPackageCommand {
126126
}
127127
}
128128

129-
let editResult: PackageEdit
129+
let editResult: [SourceEdit]
130130

131131
switch setting {
132132
case .experimentalFeature:

Sources/Commands/PackageCommands/AddTarget.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ extension SwiftPackageCommand {
129129
url: url,
130130
checksum: checksum
131131
)
132-
let editResult = try AddPackageTarget.manifestRefactor(
132+
133+
let editResult = try AddPackageTarget.textRefactor(
133134
syntax: manifestSyntax,
134135
in: .init(
135136
target: target,

Sources/Commands/PackageCommands/AddTargetDependency.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ extension SwiftPackageCommand {
7373
dependency = .target(name: dependencyName)
7474
}
7575

76-
let editResult = try SwiftRefactor.AddTargetDependency.manifestRefactor(
76+
let editResult = try SwiftRefactor.AddTargetDependency.textRefactor(
7777
syntax: manifestSyntax,
7878
in: .init(
7979
dependency: dependency,

Sources/Commands/Utilities/RefactoringSupport.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Basics
1515
@_spi(PackageRefactor) import SwiftRefactor
1616
import SwiftSyntax
1717

18-
package extension PackageEdit {
18+
package extension [SourceEdit] {
1919
/// Apply the edits for the given manifest to the specified file system,
2020
/// updating the manifest to the given manifest
2121
func applyEdits(
@@ -32,7 +32,7 @@ package extension PackageEdit {
3232
}
3333

3434
let updatedManifestSource = FixItApplier.apply(
35-
edits: manifestEdits,
35+
edits: self,
3636
to: manifest
3737
)
3838
try filesystem.writeFileContents(

0 commit comments

Comments
 (0)