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 <bas@anti.computer>
This commit is contained in:
Arnout Engelen 2023-06-21 12:05:31 +02:00
parent 7c67f006ea
commit f468c07e5f
No known key found for this signature in database
GPG Key ID: 061107B0F74A6DAA

View File

@ -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/
'';