@@ -109,6 +109,9 @@ public actor PackageParser {
109109 let libraryRegex = /\.target\s*\(\s*name:\s*"([^"]+)"[^.]*?dependencies:\s*\[([^\]]*(?:\[[^\]]*\][^\]]*)*)\]/
110110 let testRegex = /\.testTarget\s*\(\s*name:\s*"([^"]+)"[^.]*?dependencies:\s*\[([^\]]*(?:\[[^\]]*\][^\]]*)*)\]/
111111 let macroRegex = /\.macro\s*\(\s*name:\s*"([^"]+)"[^.]*?dependencies:\s*\[([^\]]*(?:\[[^\]]*\][^\]]*)*)\]/
112+ let systemLibraryRegex = /\.systemLibrary\s*\(\s*name:\s*"([^"]+)"[^)]*\)/
113+ let binaryTargetRegex = /\.binaryTarget\s*\(\s*name:\s*"([^"]+)"[^)]*\)/
114+ let pluginRegex = /\.plugin\s*\(\s*name:\s*"([^"]+)"[^.]*?dependencies:\s*\[([^\]]*(?:\[[^\]]*\][^\]]*)*)\]/
112115
113116 // Parse executable targets
114117 for match in targetsSection. matches ( of: executableRegex) {
@@ -166,9 +169,47 @@ public actor PackageParser {
166169 ) )
167170 }
168171
172+ // Parse system library targets (no dependencies to parse)
173+ for match in targetsSection. matches ( of: systemLibraryRegex) {
174+ let name = String ( match. 1 )
175+
176+ targets. append ( Target (
177+ name: name,
178+ type: . systemLibrary,
179+ dependencies: [ ] , // System libraries don't have Swift dependencies
180+ path: nil
181+ ) )
182+ }
183+
184+ // Parse binary targets (no dependencies to parse)
185+ for match in targetsSection. matches ( of: binaryTargetRegex) {
186+ let name = String ( match. 1 )
187+
188+ targets. append ( Target (
189+ name: name,
190+ type: . binaryTarget,
191+ dependencies: [ ] , // Binary targets don't have Swift dependencies
192+ path: nil
193+ ) )
194+ }
195+
196+ // Parse plugin targets
197+ for match in targetsSection. matches ( of: pluginRegex) {
198+ let name = String ( match. 1 )
199+ let dependenciesStr = String ( match. 2 )
200+ let dependencies = parseDependencyList ( dependenciesStr)
201+
202+ targets. append ( Target (
203+ name: name,
204+ type: . plugin,
205+ dependencies: dependencies,
206+ path: nil
207+ ) )
208+ }
209+
169210 // Parse targets without dependencies by looking for all target declarations
170211 // and seeing which ones don't have dependency arrays
171- let allTargetRegex = /\.(target|executableTarget|testTarget|macro)\s*\(\s*name:\s*"([^"]+)"([^)]*)\)/
212+ let allTargetRegex = /\.(target|executableTarget|testTarget|macro|plugin )\s*\(\s*name:\s*"([^"]+)"([^)]*)\)/
172213 var targetNamesWithDeps = Set < String > ( )
173214 for target in targets {
174215 targetNamesWithDeps. insert ( target. name)
@@ -194,6 +235,8 @@ public actor PackageParser {
194235 targetType = . test
195236 case " macro " :
196237 targetType = . library // Treat macros as library targets for dependency analysis
238+ case " plugin " :
239+ targetType = . plugin
197240 default : // "target"
198241 targetType = . library
199242 }
0 commit comments