@@ -65,27 +65,27 @@ extension SwiftOpenAPIGeneratorPlugin: CommandPlugin {
65
65
var hadASuccessfulRun = false
66
66
67
67
for target in targets {
68
- print ( " Considering target ' \( target. name) ': " )
68
+ log ( " Considering target ' \( target. name) ': " )
69
69
guard let swiftTarget = target as? SwiftSourceModuleTarget else {
70
- print ( " - Not a swift source module. Can't generate OpenAPI code. " )
70
+ log ( " - Not a swift source module. Can't generate OpenAPI code. " )
71
71
continue
72
72
}
73
73
do {
74
- print ( " - Trying OpenAPI code generation. " )
74
+ log ( " - Trying OpenAPI code generation. " )
75
75
try runCommand (
76
76
targetWorkingDirectory: target. directory,
77
77
tool: context. tool,
78
78
sourceFiles: swiftTarget. sourceFiles,
79
79
targetName: target. name
80
80
)
81
- print ( " - ✅ OpenAPI code generation for target ' \( target. name) ' successfully completed. " )
81
+ log ( " - ✅ OpenAPI code generation for target ' \( target. name) ' successfully completed. " )
82
82
hadASuccessfulRun = true
83
83
} catch let error as PluginError {
84
84
if error. isMisconfigurationError {
85
- print ( " - Stopping because target isn't configured for OpenAPI code generation. " )
85
+ log ( " - Stopping because target is misconfigured for OpenAPI code generation. " )
86
86
throw error
87
87
} else {
88
- print ( " - OpenAPI code generation failed with error. " )
88
+ log ( " - OpenAPI code generation failed with error. " )
89
89
throw error
90
90
}
91
91
}
@@ -94,3 +94,7 @@ extension SwiftOpenAPIGeneratorPlugin: CommandPlugin {
94
94
guard hadASuccessfulRun else { throw PluginError . noTargetsWithExpectedFiles ( targetNames: targets. map ( \. name) ) }
95
95
}
96
96
}
97
+
98
+ private func log( _ message: @autoclosure ( ) -> String ) {
99
+ FileHandle . standardError. write ( Data ( message ( ) . appending ( " \n " ) . utf8) )
100
+ }
0 commit comments