Swift: add --ql-format/--no-ql-format to codegen

This commit is contained in:
Paolo Tranquilli
2022-05-05 18:33:05 +02:00
parent b2b5fd281f
commit a7129c1f4c
3 changed files with 5 additions and 1 deletions

View File

@@ -15,6 +15,8 @@ def _init_options():
Option("--dbscheme", tags=["dbscheme"], type=_abspath, default=paths.swift_dir / "ql/lib/swift.dbscheme")
Option("--ql-output", tags=["ql"], type=_abspath, default=paths.swift_dir / "ql/lib/codeql/swift/generated")
Option("--ql-stub-output", tags=["ql"], type=_abspath, default=paths.swift_dir / "ql/lib/codeql/swift/elements")
Option("--ql-format", tags=["ql"], action="store_true", default=True)
Option("--no-ql-format", tags=["ql"], action="store_false", dest="ql_format")
Option("--codeql-binary", tags=["ql"], default="codeql")
Option("--cpp-output", tags=["cpp"], type=_abspath, required=True)
Option("--cpp-namespace", tags=["cpp"], default="codeql")

View File

@@ -107,7 +107,8 @@ def generate(opts, renderer):
renderer.render(all_imports, include_file)
renderer.cleanup(existing)
format(opts.codeql_binary, renderer.written)
if opts.ql_format:
format(opts.codeql_binary, renderer.written)
tags = ("schema", "ql")

View File

@@ -23,6 +23,7 @@ gen_import_prefix = "other.path."
def generate(opts, renderer, written=None):
opts.ql_stub_output = stub_path()
opts.ql_output = ql_output_path()
opts.ql_format = True
renderer.written = written or []
return run_generation(qlgen.generate, opts, renderer)