Skip to content

Commit

Permalink
Support for LLVM 17 (#961)
Browse files Browse the repository at this point in the history
Nixpkgs is finally up-to-date enough for us to support LLVM 17 properly
in CI; this PR makes some updates to the Nix infrastructure to allow
that update (thanks @goodlyrottenapple!), and adds LLVM 17 to our set of
integration tests.

Fixes #855

---------

Co-authored-by: Sam Balco <[email protected]>
  • Loading branch information
Baltoli and goodlyrottenapple authored Feb 6, 2024
1 parent 29b03b4 commit c96dbb1
Show file tree
Hide file tree
Showing 5 changed files with 851 additions and 313 deletions.
10 changes: 10 additions & 0 deletions flake-compat-k-unwrapped.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
39 changes: 28 additions & 11 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 35 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@
pybind11-src.url =
"github:pybind/pybind11/0ba639d6177659c5dc2955ac06ad7b5b0d22e05c";
pybind11-src.flake = false;
mavenix.url = "github:nix-community/mavenix";
mavenix.url = "github:goodlyrottenapple/mavenix";
# needed by nix/flake-compat-k-unwrapped.nix
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = { self, nixpkgs, utils, fmt-src, immer-src, rapidjson-src, pybind11-src, mavenix }:
outputs = { self, nixpkgs, utils, fmt-src, immer-src, rapidjson-src, pybind11-src, mavenix, ... }:
let
inherit (nixpkgs) lib;

Expand Down Expand Up @@ -77,9 +82,10 @@
pkgsForSystem = system: llvm-version: llvm-backend-build-type:
import nixpkgs {
overlays = [
(_: _: {
(final: prev: {
inherit llvm-version;
inherit llvm-backend-build-type;
maven = prev.maven // { inherit (prev) jdk; };
})
mavenix.overlay
llvm-backend-overlay
Expand All @@ -97,7 +103,7 @@
builtins.listToAttrs (lib.imap0 (i: v: { name = "check_${toString i}"; value = v; }) checks);

matrix = builtins.listToAttrs (lib.forEach (lib.cartesianProductOfSets {
llvm-version = [15 16];
llvm-version = [15 16 17];
build-type = ["Debug" "Release" "RelWithDebInfo" "FastBuild" "GcStats"];
}) (
args:
Expand All @@ -111,20 +117,37 @@
));
in with matrix; {
packages = utils.lib.flattenTree {
inherit (llvm-backend-16-FastBuild) llvm-backend llvm-backend-matching llvm-kompile-testing;
default = llvm-backend-16-FastBuild.llvm-backend;
llvm-backend-release = llvm-backend-16-Release.llvm-backend;
inherit (llvm-backend-17-FastBuild) llvm-backend llvm-backend-matching llvm-kompile-testing;
default = llvm-backend-17-FastBuild.llvm-backend;
llvm-backend-release = llvm-backend-17-Release.llvm-backend;
} // {
update-maven = let pkgs = import nixpkgs {
overlays = [
(final: prev: {
maven = prev.maven // { inherit (prev) jdk; };
})
mavenix.overlay
];
inherit system; };
in pkgs.writeShellScriptBin "update-maven" ''
#!/bin/sh
${pkgs.nix}/bin/nix-build --no-out-link -E '(import ./flake-compat-k-unwrapped.nix).packages.${system}.llvm-backend-matching' \
|| echo "^~~~ expected error"
export PATH="${pkgs.gnused}/bin:$PATH"
${pkgs.mavenix-cli}/bin/mvnix-update -l ./nix/llvm-backend-matching.mavenix.lock -E '(import ./flake-compat-k-unwrapped.nix).packages.${system}.llvm-backend-matching'
'';
};
checks = listToChecks [
llvm-backend-16-Debug.llvm-backend
llvm-backend-16-Release.llvm-backend
llvm-backend-16-RelWithDebInfo.llvm-backend
llvm-backend-16-GcStats.llvm-backend
llvm-backend-17-Debug.llvm-backend
llvm-backend-17-Release.llvm-backend
llvm-backend-17-RelWithDebInfo.llvm-backend
llvm-backend-17-GcStats.llvm-backend

llvm-backend-15-FastBuild.integration-tests
llvm-backend-16-FastBuild.integration-tests
llvm-backend-17-FastBuild.integration-tests
];
devShells.default = llvm-backend-16-FastBuild.devShell;
devShells.default = llvm-backend-17-FastBuild.devShell;
}) // {
# non-system suffixed items should go here
overlays.default = llvm-backend-overlay;
Expand Down
Loading

0 comments on commit c96dbb1

Please sign in to comment.