Skip to content

Commit

Permalink
Merge pull request #141 from tishin/win-codegen-fix
Browse files Browse the repository at this point in the history
Fix source generation on Windows
  • Loading branch information
migueldeicaza authored Sep 30, 2023
2 parents 3118702 + e4eb729 commit 139c225
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Generator/Generator/Printer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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)
}
}
10 changes: 7 additions & 3 deletions Plugins/CodeGeneratorPlugin/plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down

0 comments on commit 139c225

Please sign in to comment.