File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
native/swift/Tools/Sources/GenerateCancellable Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ struct GenerateCancellable: ParsableCommand {
3636
3737 let sourceCode = try String ( contentsOf: inputURL, encoding: . utf8)
3838 let extensionsCode = try generateExtensions ( sourceCode: sourceCode, logger: logger)
39+ guard !extensionsCode. isEmpty else {
40+ return
41+ }
3942
4043 try extensionsCode. write ( to: outputURL, atomically: true , encoding: . utf8)
4144
@@ -216,13 +219,18 @@ class ExtensionGenerator {
216219 )
217220 )
218221
222+ let content = sourceFile. description. trimmingCharacters ( in: . whitespacesAndNewlines)
223+ guard !content. isEmpty else {
224+ return " "
225+ }
226+
219227 return """
220228 // Do not modify. This file is automatically generated.
221229 // swiftlint:disable all
222230
223231 import Foundation
224232
225- \( sourceFile . description )
233+ \( content )
226234 """
227235 }
228236
You can’t perform that action at this time.
0 commit comments