Skip to content

Commit 5a914f9

Browse files
authored
Merge pull request #1994 from ahoppen/ahoppen/automatically-infer-codegen-destination
If no destination is passed in CodeGeneration, place generated files in parent swift-syntax package
2 parents 1cd6c22 + 0eb1b1c commit 5a914f9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ struct TemplateSpec {
7070
@main
7171
struct GenerateSwiftSyntax: ParsableCommand {
7272
@Argument(help: "The path to the source directory (i.e. 'swift-syntax/Sources') where the source files are to be generated")
73-
var destination: String
73+
var destination: String = {
74+
let sourcesURL = URL(fileURLWithPath: #filePath)
75+
.deletingLastPathComponent()
76+
.deletingLastPathComponent()
77+
.deletingLastPathComponent()
78+
.deletingLastPathComponent()
79+
.appendingPathComponent("Sources")
80+
return sourcesURL.path
81+
}()
7482

7583
@Flag(help: "Enable verbose output")
7684
var verbose: Bool = false

0 commit comments

Comments
 (0)