File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
import Foundation
2
2
3
3
enum SwiftFormatter {
4
- static func run( ) {
4
+ static func run( source : String ) {
5
5
print ( " Formatting generated Swift files... " )
6
6
let task = Process ( )
7
- task. standardOutput = FileHandle . standardOutput
8
7
task. standardError = FileHandle . standardError
9
- task. arguments = [ " -c " , " swiftformat Sources/DOMKit/WebIDL " ]
8
+ task. arguments = [ " -c " , " swiftformat \( source ) " ]
10
9
task. launchPath = " /bin/zsh "
11
10
task. launch ( )
12
11
task. waitUntilExit ( )
Original file line number Diff line number Diff line change @@ -16,10 +16,11 @@ func main() {
16
16
contents. append ( try IDLBuilder . generateStrings ( ) )
17
17
print ( " Generating union protocols... " )
18
18
contents. append ( try IDLBuilder . generateUnions ( ) )
19
+ let outputPath = try IDLBuilder . writeFile (
20
+ named: " Generated " ,
21
+ content: contents. joined ( separator: " \n \n " ) . source)
19
22
20
- try IDLBuilder . writeFile ( named: " Generated " , content: contents. joined ( separator: " \n \n " ) . source)
21
-
22
- SwiftFormatter . run ( )
23
+ SwiftFormatter . run ( source: outputPath)
23
24
print ( " Done in \( Int ( Date ( ) . timeIntervalSince ( startTime) * 1000 ) ) ms. " )
24
25
} catch {
25
26
handleDecodingError ( error)
You can’t perform that action at this time.
0 commit comments