Skip to content

Commit 44f666c

Browse files
authored
Merge pull request #16585 from github/criemen/ruby-codeql-extractor-hack
Ruby: Change how we pull in `shared/tree-sitter-extractor` dependency
2 parents 5fa1b57 + b09f3c1 commit 44f666c

File tree

13 files changed

+670
-53
lines changed

13 files changed

+670
-53
lines changed

config/identical-files.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,5 +364,9 @@
364364
"Python model summaries test extension": [
365365
"python/ql/test/library-tests/dataflow/model-summaries/InlineTaintTest.ext.yml",
366366
"python/ql/test/library-tests/dataflow/model-summaries/NormalDataflowTest.ext.yml"
367+
],
368+
"shared tree-sitter extractor cargo.toml": [
369+
"shared/tree-sitter-extractor/Cargo.toml",
370+
"ruby/extractor/codeql-extractor-fake-crate/Cargo.toml"
367371
]
368372
}

ruby/actions/create-extractor-pack/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ runs:
77
id: os_version
88
- name: Cache entire extractor
99
id: cache-extractor
10-
uses: actions/cache@v3
10+
uses: actions/cache@v4
1111
with:
1212
path: ruby/extractor-pack
1313
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/scripts/create-extractor-pack.sh', 'ruby/extractor/**/Cargo.lock', 'ruby/actions/create-extractor-pack/action.yml') }}-${{ hashFiles('shared/tree-sitter-extractor') }}-${{ hashFiles('ruby/extractor/**/*.rs') }}-${{ hashFiles('ruby/codeql-extractor.yml', 'ruby/downgrades', 'ruby/tools', 'ruby/ql/lib/ruby.dbscheme', 'ruby/ql/lib/ruby.dbscheme.stats') }}
1414
- name: Cache cargo
15-
uses: actions/cache@v3
15+
uses: actions/cache@v4
1616
if: steps.cache-extractor.outputs.cache-hit != 'true'
1717
with:
1818
path: |
@@ -24,6 +24,5 @@ runs:
2424
if: steps.cache-extractor.outputs.cache-hit != 'true'
2525
shell: bash
2626
run: |
27-
cargo install cross --version 0.2.5
2827
scripts/create-extractor-pack.sh
2928
working-directory: ruby

ruby/extractor/.cargo/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
paths = ["../../shared/tree-sitter-extractor"]

ruby/extractor/BUILD.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ codeql_rust_binary(
1111
visibility = ["//visibility:public"],
1212
deps = all_crate_deps(
1313
normal = True,
14-
),
14+
) + [
15+
"//shared/tree-sitter-extractor:codeql-extractor",
16+
],
1517
)

ruby/extractor/Cargo.lock

Lines changed: 76 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ruby/extractor/Cargo.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[workspace]
12
[package]
23
name = "codeql-extractor-ruby"
34
description = "CodeQL Ruby extractor"
@@ -27,14 +28,8 @@ encoding = "0.2"
2728
lazy_static = "1.4.0"
2829
# Ideally, we'd like to pull this in via a relative path.
2930
# However, our bazel/rust tooling chokes on this, c.f. https://github.com/bazelbuild/rules_rust/issues/1525
30-
# Therefore, to break that dependency, we depend on it via a git dependency instead.
31-
# We should change this back to a path dependency once this issue is fixed.
32-
# We can't depend on this without a rev/branch specification, as the rules_rust code assumes the default branch
33-
# is called `master`, and if we pull this in with `branch=main`, then `cargo` works (and pins this at th current git SHA
34-
# of lock-file update time, but `rules_rust` pins generates a bazel rule that unconditionally downloads `main`, which
35-
# breaks build hermeticity. So, rev-pinning it is.
36-
# See also https://github.com/bazelbuild/rules_rust/issues/2502.
37-
codeql-extractor = { git = "https://github.com/github/codeql.git", rev = "0dbce3d077f6f31a8d660aea104ee31cacf6bacd" }
31+
# Therefore, we have a pretty bad hack in place instead, see README.md in the codeql-extractor-fake-crate directory.
32+
codeql-extractor = { path = "codeql-extractor-fake-crate" }
3833

3934
[patch.crates-io]
40-
tree-sitter = {git = "https://github.com/redsun82/tree-sitter.git", rev = "1f5c1112ceaa8fc6aff61d1852690407670d2a96"}
35+
tree-sitter = { git = "https://github.com/redsun82/tree-sitter.git", rev = "1f5c1112ceaa8fc6aff61d1852690407670d2a96" }

0 commit comments

Comments
 (0)