Skip to content

Commit a7129c1

Browse files
committed
Swift: add --ql-format/--no-ql-format to codegen
1 parent b2b5fd2 commit a7129c1

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

swift/codegen/lib/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ def _init_options():
1515
Option("--dbscheme", tags=["dbscheme"], type=_abspath, default=paths.swift_dir / "ql/lib/swift.dbscheme")
1616
Option("--ql-output", tags=["ql"], type=_abspath, default=paths.swift_dir / "ql/lib/codeql/swift/generated")
1717
Option("--ql-stub-output", tags=["ql"], type=_abspath, default=paths.swift_dir / "ql/lib/codeql/swift/elements")
18+
Option("--ql-format", tags=["ql"], action="store_true", default=True)
19+
Option("--no-ql-format", tags=["ql"], action="store_false", dest="ql_format")
1820
Option("--codeql-binary", tags=["ql"], default="codeql")
1921
Option("--cpp-output", tags=["cpp"], type=_abspath, required=True)
2022
Option("--cpp-namespace", tags=["cpp"], default="codeql")

swift/codegen/qlgen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def generate(opts, renderer):
107107
renderer.render(all_imports, include_file)
108108

109109
renderer.cleanup(existing)
110-
format(opts.codeql_binary, renderer.written)
110+
if opts.ql_format:
111+
format(opts.codeql_binary, renderer.written)
111112

112113

113114
tags = ("schema", "ql")

swift/codegen/test/test_qlgen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def run_mock():
2323
def generate(opts, renderer, written=None):
2424
opts.ql_stub_output = stub_path()
2525
opts.ql_output = ql_output_path()
26+
opts.ql_format = True
2627
renderer.written = written or []
2728
return run_generation(qlgen.generate, opts, renderer)
2829

0 commit comments

Comments
 (0)