diff --git a/Generator/Generator/Printer.swift b/Generator/Generator/Printer.swift index dfb183ecd..b49fea403 100644 --- a/Generator/Generator/Printer.swift +++ b/Generator/Generator/Printer.swift @@ -59,7 +59,7 @@ class Printer { return } } - try! result.write(toFile: file, atomically: true, encoding: .utf8) + try! result.write(toFile: file, atomically: false, encoding: .utf8) } } @@ -81,6 +81,6 @@ actor PrinterFactory { return } } - try! result.write(toFile: file, atomically: true, encoding: .utf8) + try! result.write(toFile: file, atomically: false, encoding: .utf8) } } diff --git a/Plugins/CodeGeneratorPlugin/plugin.swift b/Plugins/CodeGeneratorPlugin/plugin.swift index 92a65267a..6dd9da4e8 100644 --- a/Plugins/CodeGeneratorPlugin/plugin.swift +++ b/Plugins/CodeGeneratorPlugin/plugin.swift @@ -26,17 +26,21 @@ import PackagePlugin outputFiles.append(genSourcesDir.appending(subpath: "Generated.swift")) arguments.append(context.package.directory.appending(subpath: "doc")) arguments.append("--singlefile") + let cmd: Command = Command.prebuildCommand( + displayName: "Generating Swift API from \(api) to \(genSourcesDir)", + executable: generator, + arguments: arguments, + outputFilesDirectory: genSourcesDir) #else outputFiles.append (contentsOf: knownBuiltin.map { genSourcesDir.appending(["generated-builtin", $0])}) outputFiles.append (contentsOf: known.map { genSourcesDir.appending(["generated", $0])}) - #endif - let cmd: Command = Command.buildCommand( - displayName: "Generating Swift API ffrom \(api) to \(genSourcesDir)", + displayName: "Generating Swift API from \(api) to \(genSourcesDir)", executable: generator, arguments: arguments, inputFiles: [api], outputFiles: outputFiles) + #endif return [cmd] }