Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel: 3.3.1 -> 3.7.2 #105439

Merged
merged 7 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/applications/virtualization/gvisor/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ in buildBazelPackage rec {
rm -f "$bazelOut"/java.log "$bazelOut"/java.log.*
'';

sha256 = "0myffqywbvqhax995z55jymwnwyxmp13r27kpbc7wb5fk9s4skvr";
sha256 = "0fhmlq0d2317gwhma2mz1anb69j4chybk90j71j88wpgw1hxbk34";
};

buildAttrs = {
Expand Down
10 changes: 4 additions & 6 deletions pkgs/development/python-modules/dm-sonnet/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib
, fetchFromGitHub
, bazel_0_26
, buildBazelPackage
, buildPythonPackage
, git
Expand All @@ -19,6 +20,8 @@ let

# first build all binaries and generate setup.py using bazel
bazel-build = buildBazelPackage {
bazel = bazel_0_26;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you making these changes? They appear unrelated / unnecessary to the upgrade of Bazel?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think I see your justification above in the description.


name = "dm-sonnet-bazel-${version}";

src = fetchFromGitHub {
Expand All @@ -36,14 +39,9 @@ let
bazelTarget = ":install";

fetchAttrs = {
sha256 = "1dka5nap3d28n18pn3wp5xsi4x3z02h1j8rcjdvi3y6dbqjwdw0v";
sha256 = "09dzxs2v5wpiaxrz7qj257q1fbx0gxwbk0jyx58n81m5kys7yj9k";
};

bazelFlags = [
# https://github.com/deepmind/sonnet/issues/134
"--incompatible_disable_deprecated_attr_params=false"
];

buildAttrs = {
preBuild = ''
patchShebangs .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, fetchFromGitHub
, fetchpatch
, bazel_0_26
, buildBazelPackage
, buildPythonPackage
, python
Expand All @@ -26,6 +27,8 @@ let

# first build all binaries and generate setup.py using bazel
bazel-wheel = buildBazelPackage {
bazel = bazel_0_26;

name = "${pname}-${version}-py2.py3-none-any.whl";

src = fetchFromGitHub {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/tensorflow/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ let
fetchAttrs = {
# cudaSupport causes fetch of ncclArchive, resulting in different hashes
sha256 = if cudaSupport then
"0vyy1hv0jy5pqwvnc8pxb9isgnbw07c4a4d4wn61db00np114crz"
"1i7z2a7bc2q1vn1h9nx1xc6g1r1cby2xvbcs20fj9h6c2fgaw9j4"
else
"0vczv5f9s4dxgwdkmf1y9b9ybh5d3y1nllqhb5q8aj9kq73izyn9";
"0s8q5rxq8abr50c5jpwv96ncfc0k8jw7w70ri8viqy031g9v9v45";
};

buildAttrs = {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/tools/bazel-watcher/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ buildBazelPackage rec {
sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker
'';

sha256 = "0yl5rs6y1xifxjfsa9zv8bjcwiky7rxk9y3rmi01pqpsm7ik12a9";
sha256 = "0rwwjjj6zaj4hdcbsbp0di53xn6203r2vgpddhdrp8iph9ab60cg";
};

buildAttrs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, git
, go
, lib
, stdenv
}:

buildBazelPackage rec {
Expand Down Expand Up @@ -64,7 +65,7 @@ buildBazelPackage rec {
sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker
'';

sha256 = "1m7fmb03lirffxx04ck73bn5zwaji7zdwhlqq8s1c6pgp755d3vi";
sha256 = "1vijh3nl30n8k6xlx6in92pzs70x15akbqiqalk8apgvphvdz8vy";
};

buildAttrs = {
Expand All @@ -86,5 +87,6 @@ buildBazelPackage rec {
license = licenses.asl20;
maintainers = [ maintainers.uri-canva ];
platforms = platforms.darwin ++ platforms.linux;
broken = stdenv.isDarwin;
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved
};
}
32 changes: 21 additions & 11 deletions pkgs/development/tools/build-managers/bazel/bazel_3/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
}:

let
version = "3.3.1";
version = "3.7.2";

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

# Update with `eval $(nix-build -A bazel.updater)`,
Expand All @@ -49,13 +49,15 @@ let
srcs.io_bazel_rules_sass
srcs.platforms
# `bazel query` wants all of these to be available regardless of platform.
srcs."java_tools_javac11_darwin-v8.0.zip"
srcs."java_tools_javac11_linux-v8.0.zip"
srcs."java_tools_javac11_windows-v8.0.zip"
srcs."coverage_output_generator-v2.1.zip"
srcs."java_tools_javac11_darwin-v10.0.zip"
srcs."java_tools_javac11_linux-v10.0.zip"
srcs."java_tools_javac11_windows-v10.0.zip"
srcs."coverage_output_generator-v2.5.zip"
srcs.build_bazel_rules_nodejs
srcs."android_tools_pkg-0.19.0rc1.tar.gz"
srcs."android_tools_pkg-0.19.0rc3.tar.gz"
srcs."bazel-toolchains-3.1.0.tar.gz"
srcs."com_github_grpc_grpc"
srcs.upb
srcs.rules_pkg
srcs.rules_cc
srcs.rules_java
Expand Down Expand Up @@ -98,7 +100,7 @@ let
[ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip file zip ];

# Java toolchain used for the build and tests
javaToolchain = "@bazel_tools//tools/jdk:toolchain_host${buildJdkName}";
javaToolchain = "@bazel_tools//tools/jdk:toolchain_${buildJdkName}";

platforms = lib.platforms.linux ++ lib.platforms.darwin;

Expand All @@ -112,7 +114,7 @@ let
remote_java_tools = stdenv.mkDerivation {
name = "remote_java_tools_${system}";

src = srcDepsSet."java_tools_javac11_${system}-v8.0.zip";
src = srcDepsSet."java_tools_javac11_${system}-v10.0.zip";

nativeBuildInputs = [ autoPatchelfHook unzip ];
buildInputs = [ gcc-unwrapped ];
Expand Down Expand Up @@ -169,13 +171,19 @@ stdenv.mkDerivation rec {
sourceRoot = ".";

patches = [
./python-shebang.patch
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved

# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
../trim-last-argument-to-gcc-if-empty.patch

# On Darwin, using clang 6 to build fails because of a linker error (see #105573),
# but using clang 7 fails because libarclite_macosx.a cannot be found when linking
# the xcode_locator tool.
# This patch removes using the -fobjc-arc compiler option and makes the code
# compile without automatic reference counting. Caveat: this leaks memory, but
# we accept this fact because xcode_locator is only a short-lived process used during the build.
./no-arc.patch

# --experimental_strict_action_env (which may one day become the default
# see bazelbuild/bazel#2574) hardcodes the default
# action environment to a non hermetic value (e.g. "/usr/local/bin").
Expand Down Expand Up @@ -371,6 +379,8 @@ stdenv.mkDerivation rec {
src/tools/xcode/stdredirect/BUILD \
tools/osx/BUILD

substituteInPlace scripts/bootstrap/compile.sh --replace ' -mmacosx-version-min=10.9' ""

# nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead
sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc

Expand Down
34 changes: 34 additions & 0 deletions pkgs/development/tools/build-managers/bazel/bazel_3/no-arc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--- a/tools/osx/xcode_locator.m 2020-12-10 13:27:29.000000000 +0100
+++ b/tools/osx/xcode_locator.m 2021-02-01 09:09:32.159557051 +0100
@@ -21,10 +21,6 @@
// 6,6.4,6.4.1 = 6.4.1
// 6.3,6.3.0 = 6.3

-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
#import <CoreServices/CoreServices.h>
#import <Foundation/Foundation.h>

--- a/tools/osx/xcode_configure.bzl 1980-01-01 01:00:00.000000000 +0100
+++ b/tools/osx/xcode_configure.bzl 2021-02-01 09:36:57.773418444 +0100
@@ -123,7 +123,6 @@
"macosx",
"clang",
"-mmacosx-version-min=10.9",
- "-fobjc-arc",
"-framework",
"CoreServices",
"-framework",
--- a/tools/osx/BUILD 2021-02-01 11:01:02.191659553 +0100
+++ b/tools/osx/BUILD 2021-02-01 11:04:29.735071019 +0100
@@ -27,7 +27,7 @@
])

DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """
- /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \
+ /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -framework CoreServices \
-framework Foundation -o $@ $<
"""

This file was deleted.

Loading