mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Merge pull request #12164 from github/redsun82/swift-codegen-outside-bazel
Swift: make `codegen` run also outside `bazel`
This commit is contained in:
@@ -19,6 +19,13 @@ separated list to select what to generate (choosing among `dbscheme`, `ql`, `tra
|
||||
C++ code is generated during build (see [`swift/extractor/trap/BUILD.bazel`](../extractor/trap/BUILD.bazel)). After a
|
||||
build you can browse the generated code in `bazel-bin/swift/extractor/trap/generated`.
|
||||
|
||||
For debugging you can also run `./codegen.py` directly. You must then ensure dependencies are installed, which you can
|
||||
with the command
|
||||
|
||||
```bash
|
||||
pip3 install -r ./requirements.txt
|
||||
```
|
||||
|
||||
## Implementation notes
|
||||
|
||||
The suite uses [mustache templating](https://mustache.github.io/) for generation. Templates are
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import pathlib
|
||||
import os
|
||||
import sys
|
||||
import importlib
|
||||
import types
|
||||
import pathlib
|
||||
import typing
|
||||
|
||||
if 'BUILD_WORKSPACE_DIRECTORY' not in os.environ:
|
||||
# we are not running with `bazel run`, set up module search path
|
||||
_repo_root = pathlib.Path(__file__).resolve().parents[2]
|
||||
sys.path.append(str(_repo_root))
|
||||
|
||||
from swift.codegen.lib import render, paths
|
||||
from swift.codegen.generators import generate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user