Skip to content

Commit

Permalink
Bazel 0.27 initial work
Browse files Browse the repository at this point in the history
- bazel override from nixpkgs
- a few hacks for bazel / nixos
  - a new /bin/bash override (this can be backported directly to the
    nixpkgs receipt
  - patchelf for ijar because bazel
- All the compatibility flags for bazel 0.27 are set in .bazelrc. This
  WIP PR will remove them progressively.
  • Loading branch information
guibou committed Jun 18, 2019
1 parent 903fe03 commit d6fa751
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
apt-get install -y wget gnupg golang make libgmp3-dev libtinfo-dev pkg-config zip g++ zlib1g-dev unzip python python3 bash-completion locales
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
wget "https://github.com/bazelbuild/bazel/releases/download/0.24.0/bazel_0.24.0-linux-x86_64.deb"
dpkg -i bazel_0.24.0-linux-x86_64.deb
wget "https://github.com/bazelbuild/bazel/releases/download/0.27.0/bazel_0.27.0-linux-x86_64.deb"
dpkg -i bazel_0.27.0-linux-x86_64.deb
echo "common:ci --build_tag_filters -requires_hackage,-requires_zlib,-requires_doctest,-requires_c2hs,-requires_threaded_rts,-dont_test_with_bindist" > .bazelrc.local
- run:
name: Build tests
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
architecture: 'x64'
- bash: |
set -e
curl -LO https://github.com/bazelbuild/bazel/releases/download/0.24.0/bazel-0.24.0-windows-x86_64.exe
curl -LO https://github.com/bazelbuild/bazel/releases/download/0.27.0/bazel-0.27.0-windows-x86_64.exe
mv bazel-*.exe bazel.exe
mkdir /c/bazel
mv bazel.exe /c/bazel
Expand Down
35 changes: 34 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
{ pkgs ? import ./nixpkgs {}, docTools ? true }:

with pkgs;
let
# WIP: bazel 0.27 upstreamable to nixpkgs
bazel_027 = bazel.overrideAttrs(oldAttrs: rec {
version = "0.27.0";
name = "bazel-${version}";

# WIP: needs python3 during build
buildInputs = oldAttrs.buildInputs ++ [pkgs.python3];

src = pkgs.fetchurl {
url = "https://github.com/bazelbuild/bazel/releases/download/${version}/${name}-dist.zip";
sha256 = "0yn662dzgfr8ls4avfl12k5sr4f210bab12wml18bh4sjlxhs263";
};

# Override a few /bin/bash
postPatch = oldAttrs.postPatch + ''
cat tools/build_rules/test_rules.bzl
substituteInPlace tools/build_rules/test_rules.bzl \
--replace '#!/bin/bash' '/nix/store/ya42d72dxpby7nplsya8fj7bzj3l7529-bash/bin/bash'
'';

# WIP: install check were broken on nixpkgs, I don't know what is
# the current status
doInstallCheck = false;
});
in
mkShell {
# XXX: hack for macosX, this flags disable bazel usage of xcode
# Note: this is set even for linux so any regression introduced by this flag
Expand All @@ -15,7 +41,7 @@ mkShell {
which
perl
python3
bazel
bazel_027
# For stack_install. TODO Remove ghc when move to Stack 2.
stack
ghc
Expand Down Expand Up @@ -49,5 +75,12 @@ mkShell {
# source bazel bash completion
source ${pkgs.bazel}/share/bash-completion/completions/bazel
# hack for ijar
bazel build --incompatible_disable_deprecated_attr_params=false --incompatible_new_actions_api=false --incompatible_no_support_tools_in_action_inputs=false --incompatible_require_ctx_in_configure_features=false --incompatible_depset_is_not_iterable=false --incompatible_depset_union=false --incompatible_use_python_toolchains=false @remote_java_tools_linux//:java_tools/ijar/ijar
chmod u+w ./bazel-rules_haskell/external/remote_java_tools_linux/java_tools/ijar/ijar
patchelf --set-rpath ${gcc-unwrapped.lib}/lib/ ./bazel-rules_haskell/external/remote_java_tools_linux/java_tools/ijar/ijar
patchelf --set-interpreter ${glibc}/lib/ld-linux-x86-64.so.2 ./bazel-rules_haskell/external/remote_java_tools_linux/java_tools/ijar/ijar
'';
}

0 comments on commit d6fa751

Please sign in to comment.