Skip to content

Conversation

geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Sep 10, 2024

Add a README.md for Rust, explaining how developers can get started.

I'm happy to take suggestions for the TODOs I've left in the doc; alternatively we can merge this as-is and come back to them later.

@geoffw0 geoffw0 added the Rust Pull requests that update Rust code label Sep 10, 2024
rust/README.md Outdated

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.

TODO: are there any dependencies that aren't already CodeQL dependencies? bazel and rustc?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for bazel if one has the internal repo they can use tools/bazel. Otherwise bazelisk can be used as well. When building with this command no dependency on rust/cargo is there (everything is provided for by bazel)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And tools/bazel is found automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the link to Bazelisk.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And tools/bazel is found automatically?

In the dev environment setup internal doc it is recommended to add tools to PATH, so in that case yes, bazel (and some other dev goodies) are indeed found automatically 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm never quite sure which bits of dev env setup are required vs optional, but we'll go with it. Thanks.

@@ -0,0 +1,42 @@
# Rust on CodeQL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put a warning about this being experimental and unsupported, just in case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

rust/README.md Outdated

### Dependencies

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd scratch this: in any case this README is on this branch, so this information seems redundant. And once we merge to main, we've got nothing to update if this line is not present 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but I was hit by the gotcha of having only checked out the right branch on codeql this morning.

When do we plan to merge to main?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soon(TM) 🙂 I just need to double check that some changes I've done on the internal repo do not interfere with other rust compilation. And I would wait for this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the note.

rust/README.md Outdated
```
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 Users/YOURUSERNAME/semmle-code/ql
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this does not need an absolute path and gets joined with the home directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit fussy. --search-path ./ql works, I have a distaste for using the "current working directory" in a context like this where I'm not in control of it, but if someone can promise it will always be semmle-code then I'm OK with it. --search-path ~/semmle-code/ql and a few other variations of that I tried do not work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think I always used full absolute paths. Maybe I'd just put a generic /path/to/semmle-code/ql? Users is macos only, and in any case my local checkout for example is at /workspaces/semmle-code in codespace style

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


### 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably one needs to be on the rust-experiment branch?

Copy link
Contributor

@redsun82 redsun82 Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but we opted to not mention that as we'll all be in main pretty soon, I promise! 😉

Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks!

@redsun82 redsun82 merged commit 304e68d into github:rust-experiment Sep 11, 2024
3 checks passed
@geoffw0 geoffw0 deleted the readme branch October 15, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants