From 70df1b9abefb4faead29e10d107539ffae92f497 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 10 Jan 2025 11:45:55 +0100 Subject: [PATCH 1/2] Rust: give more options for building in `README.md` --- rust/README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rust/README.md b/rust/README.md index 2f9a7503abb7..d2e77e2a0016 100644 --- a/rust/README.md +++ b/rust/README.md @@ -11,10 +11,18 @@ If you don't have the `semmle-code` repo you may need to install Bazel manually, ### Building the Rust Extractor -This approach uses a released `codeql` version and is simpler to use for QL development. From your `semmle-code` directory run: +This approach uses a released `codeql` version and is simpler to use for QL development. From anywhere under your `semmle-code` or `codeql` directory you can run: ```bash bazel run @codeql//rust:install ``` + +You can use shorter versions of the above command: +```bash +bazel run //rust:install # if under the `codeql` checkout +bazel run rust:install # if at the root of the `codeql` checkout +bazel run :install # if at the `rust` directory of the `codeql` checkout +``` + You now need to create a [per-user CodeQL configuration file](https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file#using-a-codeql-configuration-file) and specify the option: ``` --search-path PATH/TO/semmle-code/ql From 7c0409da354d0f41e6c5b24b3fb95434ec837430 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 10 Jan 2025 11:50:49 +0100 Subject: [PATCH 2/2] Rust: add instructions for `codegen` in `README.md` --- rust/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rust/README.md b/rust/README.md index d2e77e2a0016..bab00ae867dd 100644 --- a/rust/README.md +++ b/rust/README.md @@ -48,4 +48,17 @@ TODO ### Code Generation -TODO +If you do changes to either +* `ast-generator`, or +* `schema/*.py` + +you'll need to regenerate code. You can do so running +```bash +bazel run @codeql//rust/codegen +``` + +Sometimes, especially if resolving conflicts on generated files, you might need to run +```bash +bazel run @codeql//rust/codegen -- --force +``` +for code generation to succeed.