parent directory.. | ||||
View all files | ||||
If you don't have the semmle-code repo you may need to install Bazel manually, e.g. from https://github.com/bazelbuild/bazelisk.
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:
You can use shorter versions of the above command:
You now need to create a per-user CodeQL configuration file and specify the option:
(wherever the codeql checkout is on your system)
You can now use the Rust extractor e.g. to run Rust tests from the command line or in VSCode.
This approach allows you to build a Rust extractor with a CLI built from source. From your semmle-code directory run:
You can now invoke it directly, for example to run some tests:
TODO
If you make changes to either
you'll need to regenerate code. You can do so running
Sometimes, especially if resolving conflicts on generated files, you might need to run
for code generation to succeed.
Here's a rundown of the typical actions to perform to do a rust-analyzer (and other dependencies) update. A one-time setup consists in installing cargo-edit with cargo install cargo-edit. On Ubuntu that also requires sudo apt install libssl-dev pkg-config.
From the root of the codeql repo checkout, run a Cargo upgrade:
Look at a diff of the Cargo.toml files: if all ra_ap_ prefixed dependencies have been updated to the same number, go on to the next step. Otherwise, it means the latest rust-analyzer update has not been fully rolled out to all its crates in crates.io. All ra_ap_ versions must agree! Downgrade by hand to the minimum one you see, and run a cargo update after that to fix the Cargo.lock file.
Commit the changes, skipping pre-commit hooks if you have them enabled:
Regenerate vendored bazel files (these allow faster builds, particularly on CI where it has to start from scratch each time), commit the changes:
Run codegen
Take note whether rust/schema/ast.py was changed. That might need tweaks, new tests and/or downgrade/upgrade scripts down the line.
Try compiling
If you had to do any changes, commit them. If you updated the rust toolchain, running rust/lint.py might reformat or apply new lints to the code.
Check with CI if everything is in order.
Run DCA with database caching disabled. Iterate on the code if needed.
If in step 5 the schema was updated, add upgrade/downgrade scripts and a change note. This is best done last to reduce the chance of merge conflicts (none of the other testing depends on having upgrade and downgrade scripts in place). See Upgrading a language database schema.