Skip to content

Commit 55cc092

Browse files
authored
Merge branch 'main' into redsun82-rust-analyzer-update
2 parents e51dc86 + 05c40ea commit 55cc092

13 files changed

Lines changed: 43 additions & 61 deletions

File tree

CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/go/codeql-tools/ @github/codeql-go @github/code-scanning-language-coverage
1212
/go/downgrades/ @github/codeql-go @github/code-scanning-language-coverage
1313
/go/extractor/ @github/codeql-go @github/code-scanning-language-coverage
14-
/go/extractor-smoke-test/ @github/codeql-go @github/code-scanning-language-coverage
1514
/go/ql/test/extractor-tests/ @github/codeql-go @github/code-scanning-language-coverage
1615
/java/ @github/codeql-java
1716
/javascript/ @github/codeql-javascript

go/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ test: all build/testdb/check-upgrade-path
5858
# use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported
5959
env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --search-path .. --check-diff-informed --consistency-queries ql/consistency-queries --compilation-cache=$(cache) --dynamic-join-order-mode=$(rtjo)
6060
cd extractor; $(BAZEL) test ...
61-
bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1)
6261

6362
.PHONY: build/testdb/check-upgrade-path
6463
build/testdb/check-upgrade-path : build/testdb/go.dbscheme ql/lib/go.dbscheme

go/extractor-smoke-test/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

go/extractor-smoke-test/expected.csv

Lines changed: 0 additions & 12 deletions
This file was deleted.

go/extractor-smoke-test/go.mod

Lines changed: 0 additions & 3 deletions
This file was deleted.

go/extractor-smoke-test/main.go

Lines changed: 0 additions & 8 deletions
This file was deleted.

go/extractor-smoke-test/test.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

go/ql/integration-tests/test-extraction/test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ def test_traced(codeql, go):
55

66
def test_autobuild(codeql, go):
77
codeql.database.create(source_root="src", extractor_option = ["extract_tests=true"])
8+
9+
def test_autobuild_traced(codeql, go):
10+
# Autobuild under build tracing must produce the same database as untraced
11+
# autobuild and explicit traced builds, all checked against test.expected.
12+
codeql.database.create(
13+
source_root="src",
14+
extractor_option = ["extract_tests=true"],
15+
_env={"CODEQL_EXTRACTOR_GO_BUILD_TRACING": "on"},
16+
)

rust/extractor/src/config.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,23 @@ impl Config {
109109
figment.extract().context("loading configuration")
110110
}
111111

112+
fn get_extra_env(&self) -> FxHashMap<String, Option<String>> {
113+
let mut extra_env = FxHashMap::default();
114+
// RUSTUP_AUTO_INSTALL is set to 0 by rust-analyzer (https://github.com/rust-lang/rust-analyzer/issues/20719),
115+
// but we do want to allow rustup to auto-install toolchains if needed, so we set it to 1 here.
116+
extra_env.insert("RUSTUP_AUTO_INSTALL".to_owned(), Some("1".to_owned()));
117+
extra_env.extend(self.cargo_extra_env.clone());
118+
extra_env
119+
}
120+
112121
fn sysroot(&self, dir: &AbsPath) -> Sysroot {
113122
let sysroot_input = self.sysroot.as_ref().map(|p| join_path_buf(dir, p));
114123
let sysroot_src_input = self.sysroot_src.as_ref().map(|p| join_path_buf(dir, p));
115124
match (sysroot_input, sysroot_src_input) {
116-
(None, None) => Sysroot::discover(dir, &self.cargo_extra_env),
125+
(None, None) => Sysroot::discover(dir, &self.get_extra_env()),
117126
(Some(sysroot), None) => Sysroot::discover_rust_lib_src_dir(sysroot),
118127
(None, Some(sysroot_src)) => {
119-
Sysroot::discover_with_src_override(dir, &self.cargo_extra_env, sysroot_src)
128+
Sysroot::discover_with_src_override(dir, &self.get_extra_env(), sysroot_src)
120129
}
121130
(Some(sysroot), Some(sysroot_src)) => Sysroot::new(Some(sysroot), Some(sysroot_src)),
122131
}
@@ -167,7 +176,7 @@ impl Config {
167176
.map(ToOwned::to_owned)
168177
.map(RustLibSource::Path),
169178

170-
extra_env: self.cargo_extra_env.clone(),
179+
extra_env: self.get_extra_env(),
171180
extra_args: self.cargo_extra_args.clone(),
172181
extra_includes: self
173182
.extra_includes

unified/BUILD.bazel

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ codeql_pkg_files(
4141

4242
codeql_pkg_files(
4343
name = "extractor-arch",
44-
exes = [
45-
"//unified/extractor",
46-
] + select_os(
44+
exes = select_os(
45+
posix = ["//unified/extractor"],
46+
windows = ["//unified/extractor-unsupported-os:extractor"],
47+
) + select_os(
4748
linux = ["//unified/swift-syntax-rs:swift_runtime_libs"],
4849
otherwise = [],
4950
),

0 commit comments

Comments
 (0)