File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,15 @@ public final class InitPackage {
216
216
targets: [ " \( pkgname) " ]),
217
217
]
218
218
""" )
219
+ } else if packageType == . buildToolPlugin || packageType == . commandPlugin {
220
+ pkgParams. append ( """
221
+ products: [
222
+ // Products define the executables and libraries a package produces, making them visible to other packages.
223
+ .plugin(
224
+ name: " \( pkgname) " ,
225
+ targets: [ " \( pkgname) " ]),
226
+ ]
227
+ """ )
219
228
} else if packageType == . macro {
220
229
pkgParams. append ( """
221
230
products: [
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ class InitTests: XCTestCase {
168
168
let manifest = path. appending ( " Package.swift " )
169
169
XCTAssertFileExists ( manifest)
170
170
let manifestContents : String = try localFileSystem. readFileContents ( manifest)
171
+ XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " targets: [ \" MyCommandPlugin \" ] " ) ) )
171
172
XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " capability: .command(intent: .custom(verb " ) ) )
172
173
173
174
let source = path. appending ( " Plugins " , " MyCommandPlugin " , " plugin.swift " )
@@ -196,6 +197,7 @@ class InitTests: XCTestCase {
196
197
let manifest = path. appending ( " Package.swift " )
197
198
XCTAssertFileExists ( manifest)
198
199
let manifestContents : String = try localFileSystem. readFileContents ( manifest)
200
+ XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " targets: [ \" MyBuildToolPlugin \" ] " ) ) )
199
201
XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " capability: .buildTool() " ) ) )
200
202
201
203
let source = path. appending ( " Plugins " , " MyBuildToolPlugin " , " plugin.swift " )
You can’t perform that action at this time.
0 commit comments