Skip to content

Commit 8213bbb

Browse files
committed
Rust: Add a README.md
1 parent ef06b55 commit 8213bbb

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

rust/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Rust on CodeQL
2+
3+
## Development
4+
5+
### Dependencies
6+
7+
At present you need to be in the `rust-experiment` branch (or a branch on top of that) in both the `semmle-code` and `codeql` repos.
8+
9+
TODO: are there any dependencies that aren't already CodeQL dependencies? bazel and rustc?
10+
11+
### Building the Rust Extractor
12+
13+
This approach uses a released `codeql` version and is simpler to use for QL development. From your `semmle-code` directory run:
14+
```bash
15+
bazel run @codeql//rust:rust-installer
16+
```
17+
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:
18+
```
19+
--search-path Users/YOURUSERNAME/semmle-code/ql
20+
```
21+
(or wherever the `ql` directory is on your system)
22+
23+
You can now use the Rust extractor e.g. to run Rust tests from the command line or in VSCode.
24+
25+
### Building the Rust Extractor (as a sembuild target)
26+
27+
This approach allows you to build a Rust extractor with a CLI built from source. From your `semmle-code` directory run:
28+
```bash
29+
./build target/intree/codeql-rust
30+
```
31+
You can now invoke it directly, for example to run some tests:
32+
```bash
33+
./target/intree/codeql-rust/codeql test run ql/rust/ql/test/PATH/TO/TEST/
34+
```
35+
36+
### Building a Database
37+
38+
TODO
39+
40+
### Code Generation
41+
42+
TODO

0 commit comments

Comments
 (0)