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 {
216216 targets: [ " \( pkgname) " ]),
217217 ]
218218 """ )
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+ """ )
219228 } else if packageType == . macro {
220229 pkgParams. append ( """
221230 products: [
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ class InitTests: XCTestCase {
168168 let manifest = path. appending ( " Package.swift " )
169169 XCTAssertFileExists ( manifest)
170170 let manifestContents : String = try localFileSystem. readFileContents ( manifest)
171+ XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " targets: [ \" MyCommandPlugin \" ] " ) ) )
171172 XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " capability: .command(intent: .custom(verb " ) ) )
172173
173174 let source = path. appending ( " Plugins " , " MyCommandPlugin " , " plugin.swift " )
@@ -196,6 +197,7 @@ class InitTests: XCTestCase {
196197 let manifest = path. appending ( " Package.swift " )
197198 XCTAssertFileExists ( manifest)
198199 let manifestContents : String = try localFileSystem. readFileContents ( manifest)
200+ XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " targets: [ \" MyBuildToolPlugin \" ] " ) ) )
199201 XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " capability: .buildTool() " ) ) )
200202
201203 let source = path. appending ( " Plugins " , " MyBuildToolPlugin " , " plugin.swift " )
You can’t perform that action at this time.
0 commit comments