Skip to content

Commit 304e68d

Browse files
authored
Merge pull request github#17426 from geoffw0/readme
Rust: Add a README.md
2 parents f464759 + 7c95bb2 commit 304e68d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

rust/README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Rust on CodeQL
2+
3+
> [!WARNING]
4+
> Rust support for CodeQL is experimental. No support is offered. QL and database interfaces will change and break without notice or deprecation periods.
5+
6+
## Development
7+
8+
### Dependencies
9+
10+
If you don't have the `semmle-code` repo you may need to install Bazel manually, e.g. from https://github.com/bazelbuild/bazelisk.
11+
12+
### Building the Rust Extractor
13+
14+
This approach uses a released `codeql` version and is simpler to use for QL development. From your `semmle-code` directory run:
15+
```bash
16+
bazel run @codeql//rust:rust-installer
17+
```
18+
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:
19+
```
20+
--search-path PATH/TO/semmle-code/ql
21+
```
22+
(wherever the `codeql` checkout is on your system)
23+
24+
You can now use the Rust extractor e.g. to run Rust tests from the command line or in VSCode.
25+
26+
### Building the Rust Extractor (as a sembuild target)
27+
28+
This approach allows you to build a Rust extractor with a CLI built from source. From your `semmle-code` directory run:
29+
```bash
30+
./build target/intree/codeql-rust
31+
```
32+
You can now invoke it directly, for example to run some tests:
33+
```bash
34+
./target/intree/codeql-rust/codeql test run ql/rust/ql/test/PATH/TO/TEST/
35+
```
36+
37+
### Building a Database
38+
39+
TODO
40+
41+
### Code Generation
42+
43+
TODO

0 commit comments

Comments
 (0)