We've been observing some performance issues using crate_universe on CI. Therefore, we're moving to vendor the auto-generated BUILD files in our repository. This should provide a nice speed boost, while getting rid of the complexity of the "rust cache" job we've been using when we had a lot of git dependencies. This PR includes a vendor script, and I'll put up a CI job internally that runs that vendor script on Cargo.toml and Cargo.lock changes, to check that the vendored files are in sync.
Rust on CodeQL
Warning
Rust support for CodeQL is experimental. No support is offered. QL and database interfaces will change and break without notice or deprecation periods.
Development
Dependencies
If you don't have the semmle-code repo you may need to install Bazel manually, e.g. from https://github.com/bazelbuild/bazelisk.
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:
bazel run @codeql//rust:rust-installer
You now need to create a per-user CodeQL configuration file and specify the option:
--search-path PATH/TO/semmle-code/ql
(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.
Building the Rust Extractor (as a sembuild target)
This approach allows you to build a Rust extractor with a CLI built from source. From your semmle-code directory run:
./build target/intree/codeql-rust
You can now invoke it directly, for example to run some tests:
./target/intree/codeql-rust/codeql test run ql/rust/ql/test/PATH/TO/TEST/
Building a Database
TODO
Code Generation
TODO