@@ -100,24 +100,21 @@ extension FormatterPlugin: XcodeCommandPlugin {
100100// baseArguments.append(contentsOf: ["--swiftversion", version])
101101// }
102102
103- for target in context. xcodeProject. targets {
104- guard let target = target as? SourceModuleTarget else { continue }
105-
106- var arguments = baseArguments
107- arguments. append ( target. directory. string)
108-
109- let process = Process ( )
110- process. executableURL = swiftFormatExec
111- process. arguments = arguments
112- try process. run ( )
113- process. waitUntilExit ( )
114-
115- if process. terminationReason == . exit && process. terminationStatus == 0 {
116- Diagnostics . remark ( " Formatted the source code in \( target. directory) . " )
117- } else {
118- let problem = " \( process. terminationReason) : \( process. terminationStatus) "
119- Diagnostics . error ( " swift-format invocation failed: \( problem) " )
120- }
103+ var arguments = baseArguments
104+ let path = context. xcodeProject. directory. string
105+ arguments. append ( path)
106+
107+ let process = Process ( )
108+ process. executableURL = swiftFormatExec
109+ process. arguments = arguments
110+ try process. run ( )
111+ process. waitUntilExit ( )
112+
113+ if process. terminationReason == . exit && process. terminationStatus == 0 {
114+ Diagnostics . remark ( " Formatted the source code in \( path) . " )
115+ } else {
116+ let problem = " \( process. terminationReason) : \( process. terminationStatus) "
117+ Diagnostics . error ( " swift-format invocation failed: \( problem) " )
121118 }
122119 }
123120}
0 commit comments