Skip to content

Commit f80e31e

Browse files
committed
Address issue with JDK on Linux
This uses the same approach as the CodeQL derivative part of Nix packages https://github.com/NixOS/nixpkgs/blob/4299aee00ffcb68ecdc5c9a2befc244a61bec5be/pkgs/development/tools/analysis/codeql/default.nix
1 parent 67baed8 commit f80e31e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tooling/codeql/codeql-cli/2.16.0.nix

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, stdenv, fetchzip, withExtractors ? [], withPacks ? [] }:
1+
{ lib, stdenv, fetchzip, jdk17, withExtractors ? [], withPacks ? [] }:
22

33
stdenv.mkDerivation rec {
44
pname = "codeql-cli";
@@ -17,12 +17,27 @@ stdenv.mkDerivation rec {
1717
buildInputs = if (lib.length withExtractors) == 0 then [ ] else withExtractors;
1818
inherit withExtractors withPacks;
1919

20+
nativeBuildInputs = [ jdk17 ];
21+
2022
installPhase = ''
2123
# codeql directory should not be top-level, otherwise,
2224
# it'll include /nix/store to resolve extractors.
2325
mkdir -p $out/{codeql/qlpacks,bin}
2426
cp -R * $out/codeql/
2527
28+
29+
if [ "$platform" == "linux64" ]; then
30+
ln -sf $out/codeql/tools/linux64/lib64trace.so $out/codeql/tools/linux64/libtrace.so
31+
fi
32+
33+
# many of the codeql extractors use CODEQL_DIST + CODEQL_PLATFORM to
34+
# resolve java home, so to be able to create databases, we want to make
35+
# sure that they point somewhere sane/usable since we can not autopatch
36+
# the codeql packaged java dist, but we DO want to patch the extractors
37+
# as well as the builders which are ELF binaries for the most part
38+
rm -rf $out/codeql/tools/$platform/java
39+
ln -s ${jdk17} $out/codeql/tools/$platform/java
40+
2641
ln -s $out/codeql/codeql $out/bin/
2742
2843
for extractor in $withExtractors; do

0 commit comments

Comments
 (0)