Files
codeql/swift/codegen/BUILD.bazel
Paolo Tranquilli d5d1eb717d Swift: add structured C++ generated classes
This adds `cppgen`, creating structured C++ classes mirroring QL classes
out of `schema.yml`.

An example of generated code at the time of this commit can be found
[in this gist][1].

[1]: https://gist.github.com/redsun82/57304ddb487a8aa40eaa0caa695048fa

Closes https://github.com/github/codeql-c-team/issues/863
2022-05-04 18:20:25 +02:00

48 lines
1.1 KiB
Python

load("@swift_codegen_deps//:requirements.bzl", "requirement")
filegroup(
name = "schema",
srcs = ["schema.yml"],
visibility = ["//swift:__subpackages__"],
)
filegroup(
name = "schema_includes",
srcs = glob(["*.dbscheme"]),
visibility = ["//swift:__subpackages__"],
)
py_binary(
name = "codegen",
srcs = glob(
["*.py"],
exclude = ["trapgen.py"],
),
visibility = ["//swift/codegen/test:__pkg__"],
deps = ["//swift/codegen/lib"],
)
# as opposed to the above, that is meant to only be run with bazel run,
# we need to be precise with data dependencies of this which is meant be run during build
py_binary(
name = "trapgen",
srcs = ["trapgen.py"],
data = ["//swift/codegen/templates:trap"],
visibility = ["//swift:__subpackages__"],
deps = [
"//swift/codegen/lib",
requirement("toposort"),
],
)
py_binary(
name = "cppgen",
srcs = ["cppgen.py"],
data = ["//swift/codegen/templates:cpp"],
visibility = ["//swift:__subpackages__"],
deps = [
"//swift/codegen/lib",
requirement("toposort"),
],
)