From 70df1b9abefb4faead29e10d107539ffae92f497 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 10 Jan 2025 11:45:55 +0100 Subject: [PATCH 1/3] 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/3] 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. From bd2e8195c2142777bcf303714454c0f25270e1b9 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 22 Jan 2025 14:56:56 +0100 Subject: [PATCH 3/3] Rust: Apply suggestions from code review Co-authored-by: Simon Friis Vindum --- rust/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/README.md b/rust/README.md index bab00ae867dd..8be853bd5f2c 100644 --- a/rust/README.md +++ b/rust/README.md @@ -48,17 +48,17 @@ TODO ### Code Generation -If you do changes to either -* `ast-generator`, or +If you make changes to either +* `ast-generator/`, or * `schema/*.py` you'll need to regenerate code. You can do so running -```bash +```sh bazel run @codeql//rust/codegen ``` Sometimes, especially if resolving conflicts on generated files, you might need to run -```bash +```sh bazel run @codeql//rust/codegen -- --force ``` for code generation to succeed.