From f468c07e5f3656a5e545c84a3908f17533404d85 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Wed, 21 Jun 2023 12:05:31 +0200 Subject: [PATCH] codeql: fix passing in nix JDK The old approach only set CODEQL_JAVA_HOME in codeql, but apparently that didn't propagate to other tools such as the various `autobuild.sh` scripts. Setting it in a wrapper did seem to work for `codeql database create testdb --language javascript` but not for `codeql database analyze ...`. This approach based on the earlier PR by Bas fixed both commands for me. Co-Authored-By: Bas Alberts --- pkgs/development/tools/analysis/codeql/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/analysis/codeql/default.nix b/pkgs/development/tools/analysis/codeql/default.nix index 9cd79c13288c..3e7e399256e4 100644 --- a/pkgs/development/tools/analysis/codeql/default.nix +++ b/pkgs/development/tools/analysis/codeql/default.nix @@ -34,8 +34,13 @@ stdenv.mkDerivation rec { ln -sf $out/codeql/tools/linux64/lib64trace.so $out/codeql/tools/linux64/libtrace.so - sed -i 's%\$CODEQL_DIST/tools/\$CODEQL_PLATFORM/java-aarch64%\${jdk17}%g' $out/codeql/codeql - sed -i 's%\$CODEQL_DIST/tools/\$CODEQL_PLATFORM/java%\${jdk17}%g' $out/codeql/codeql + # many of the codeql extractors use CODEQL_DIST + CODEQL_PLATFORM to + # resolve java home, so to be able to create databases, we want to make + # sure that they point somewhere sane/usable since we can not autopatch + # the codeql packaged java dist, but we DO want to patch the extractors + # as well as the builders which are ELF binaries for the most part + rm -rf $out/codeql/tools/linux64/java + ln -s ${jdk17} $out/codeql/tools/linux64/java ln -s $out/codeql/codeql $out/bin/ '';