-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Ruby: Change how we pull in shared/tree-sitter-extractor
dependency
#16585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2aa4561
to
f6a3106
Compare
Previously, we pulled in the shared tree-sitter extractor via a `git` dependency in `Cargo.toml` to address a `rules_rust` limitation (no `path` dependencies outside of the cargo workspace)). This was a problem, as that means we're cloning `github/codeql` _again_ for the build, which is quite slow. I found another way that is faster, and still produces correct builds for both `cargo`` and `rules_rust`: * Cargo depends on a fake crate that has the same dependencies as the real crate (thanks to `sync-files.py`). Therefore, cargo pulls in the right dependencies into the lockfile, which bazel targets * For local builds, we override the path to that dependency in a cargo config, so we're pulling in the correct code * rules_rust only uses `path` dependencies for collecting transitive dependencies, it never pulls in the code from there. So far that, we manually provide a `BUILD.bazel` file for the shared extractor, and depend on that.
f6a3106
to
8c46b61
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ingenious!
Ah, one more note: If this weren't a public repository/windows support wouldn't be a concern, I'd have symlinked the files, or even the project directory, but that then creates problems for people checking out the repo on Windows that don't have symlinks enabled. All our developers need to have those enabled anyways for bazel to work, but external contributors probably haven't, so that's a non-starter. |
23b7645
to
6c88b95
Compare
We've removed cross from the internal build when converting to bazel, mirror that here.
6c88b95
to
b09f3c1
Compare
|
||
[patch.crates-io] | ||
tree-sitter = {git = "https://github.com/redsun82/tree-sitter.git", rev = "1f5c1112ceaa8fc6aff61d1852690407670d2a96"} | ||
tree-sitter = { git = "https://github.com/redsun82/tree-sitter.git", rev = "1f5c1112ceaa8fc6aff61d1852690407670d2a96" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have our own fork of tree-sitter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's unrelated to this PR, and is I believe no longer necessary:
tree-sitter/tree-sitter#3352 was merged (which broke our build otherwise), and we're now waiting on tree-sitter cutting a new release for us to pull in that fix via crates.io instead of git.
Previously, we pulled in the shared tree-sitter extractor via a
git
dependency inCargo.toml
to address arules_rust
limitation (nopath
dependencies outside of the cargo workspace)). This was a problem, as that means we're cloninggithub/codeql
again for the build, which is quite slow.I found another way that is faster, and still produces correct builds for both
cargo`` and
rules_rust`:sync-files.py
). Therefore, cargo pulls in the right dependencies into the lockfile, which bazel targetspath
dependencies for collecting transitive dependencies, it never pulls in the code from there. So far that, we manually provide aBUILD.bazel
file for the shared extractor, and depend on that.The git dependency was also a major source of slowdown for the upcoming bzlmod/rules_rust conversion, so we needed to get rid of it for that reason, too.