Skip to content

Commit d3db503

Browse files
committed
[Commands] Switch AddProduct to use refactoring action from swift-syntax
1 parent c1037f5 commit d3db503

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Sources/Commands/PackageCommands/AddProduct.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ import Basics
1515
import CoreCommands
1616
import Foundation
1717
import PackageGraph
18-
import PackageModel
19-
import PackageModelSyntax
2018
import SwiftParser
19+
@_spi(PackageRefactor) import SwiftRefactor
2120
import SwiftSyntax
2221
import TSCBasic
2322
import TSCUtility
@@ -80,23 +79,23 @@ extension SwiftPackageCommand {
8079
}
8180

8281
// Map the product type.
83-
let type: ProductType = switch self.type {
82+
let type: ProductDescription.ProductType = switch self.type {
8483
case .executable: .executable
8584
case .library: .library(.automatic)
8685
case .dynamicLibrary: .library(.dynamic)
8786
case .staticLibrary: .library(.static)
8887
case .plugin: .plugin
8988
}
9089

91-
let product = try ProductDescription(
90+
let product = ProductDescription(
9291
name: name,
9392
type: type,
9493
targets: targets
9594
)
9695

97-
let editResult = try PackageModelSyntax.AddProduct.addProduct(
98-
product,
99-
to: manifestSyntax
96+
let editResult = try SwiftRefactor.AddProduct.manifestRefactor(
97+
syntax: manifestSyntax,
98+
in: .init(product: product)
10099
)
101100

102101
try editResult.applyEdits(

0 commit comments

Comments
 (0)