tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
bazel_7: More refactors
Guillaume Maudoux
2 years ago
30cbfd47
9b820d98
+27
-67
6 changed files
expand all
collapse all
unified
split
pkgs
development
tools
build-managers
bazel
bazel_7
actions_path.patch
default.nix
java_toolchain.patch
no-arc.patch
strict_proto_deps.patch
trim-last-argument-to-gcc-if-empty.patch
-6
pkgs/development/tools/build-managers/bazel/bazel_7/actions_path.patch
···
1
1
-
commit 595756621dd858cf18033af2c4707d2fe8548350
2
2
-
Author: Guillaume Maudoux <guillaume.maudoux@tweag.io>
3
3
-
Date: Fri Oct 6 15:09:56 2023 +0200
4
4
-
5
5
-
actions_path.patch
6
6
-
7
1
diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
8
2
index 8284eff943..a820037968 100644
9
3
--- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
+27
-37
pkgs/development/tools/build-managers/bazel/bazel_7/default.nix
···
208
208
# incapable of preventing system sleep, which is a small price to pay to
209
209
# guarantee that it will always run in any nix context.
210
210
#
211
211
+
# See also ./bazel_darwin_sandbox.patch in bazel_5. That patch uses
212
212
+
# NIX_BUILD_TOP env var to conditionnally disable sleep features inside the
213
213
+
# sandbox. Oddly, bazel_6 does not need that patch :-/.
214
214
+
#
211
215
# If you want to investigate the sandbox profile path,
212
216
# IORegisterForSystemPower can be allowed with
213
217
#
···
224
228
../trim-last-argument-to-gcc-if-empty.patch
225
229
226
230
# XXX: This seems merged / not a real problem. See PR.
231
231
+
# TODO: Remove when protobuf tests confirm it is not needed.
227
232
# `java_proto_library` ignores `strict_proto_deps`
228
233
# https://github.com/bazelbuild/bazel/pull/16146
229
234
# ./strict_proto_deps.patch
···
261
266
src = ../bazel_rc.patch;
262
267
bazelSystemBazelRCPath = bazelRC;
263
268
})
264
264
-
] ++ lib.optional enableNixHacks ./nix-hacks.patch;
265
265
-
266
266
-
267
267
-
# Additional tests that check bazel’s functionality. Execute
268
268
-
#
269
269
-
# nix-build . -A bazel_7.tests
270
270
-
#
271
271
-
# in the nixpkgs checkout root to exercise them locally.
272
272
-
passthru.tests = callPackage ./tests.nix {
273
273
-
inherit Foundation bazel_self distDir repoCache runJdk;
274
274
-
};
269
269
+
]
270
270
+
# See enableNixHacks argument above.
271
271
+
++ lib.optional enableNixHacks ./nix-hacks.patch;
275
272
276
276
-
passthru.updater = throw "TODO";
277
273
278
274
# Bazel starts a local server and needs to bind a local address.
279
275
__darwinAllowLocalNetworking = true;
280
276
281
277
postPatch =
282
278
let
283
283
-
284
279
darwinPatches = ''
285
280
bazelLinkFlags () {
286
281
eval set -- "$NIX_LDFLAGS"
···
376
371
-e 's!/bin/bash!${bash}/bin/bash!g' \
377
372
-e 's!shasum -a 256!sha256sum!g'
378
373
379
379
-
${bazelNixFlagsScript} > .bazelrc.nix
380
380
-
# export BAZELRC=$PWD/.bazelrc.nix
381
381
-
# export BAZEL_BOOTSTRAP_STARTUP_OPTIONS=""
382
382
-
# export DIST_BAZEL_ARGS=
383
383
-
#export EXTRA_BAZEL_ARGS="--rc_source=$PWD/.bazelrc.nix --announce_rc"
384
384
-
385
374
# Add compile options to command line.
386
375
# XXX: It would suit a bazelrc file better, but I found no way to pass it.
387
376
# It seems it is always ignored.
388
377
# Passing EXTRA_BAZEL_ARGS is tricky due to quoting.
389
389
-
390
390
-
#which javac
391
391
-
#printenv JAVA_HOME
392
392
-
#exit 0
393
378
394
379
sedVerbose compile.sh \
395
380
-e "/bazel_build /a\ --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\" \\\\" \
···
409
394
-e "/bazel_build /a\ --extra_toolchains=@local_jdk//:all \\\\" \
410
395
-e "/bazel_build /a\ --toolchain_resolution_debug=@bazel_tools//tools/jdk:runtime_toolchain_type \\\\" \
411
396
-e "/bazel_build /a\ --sandbox_debug --verbose_failures \\\\" \
412
412
-
${lib.optionalString isDarwin ''
413
413
-
-e "/bazel_build /a\ --cpu=${({aarch64-darwin = "darwin_arm64"; x86_64-darwin = "darwin_x86_64";}.${stdenv.hostPlatform.system})} \\\\" \''
414
414
-
}
415
415
-
416
416
-
#-e "/bazel_build /a\ --spawn_strategy=standalone \\\\" \
417
417
-
418
397
419
398
# Also build parser_deploy.jar with bootstrap bazel
420
399
# TODO: Turn into a proper patch
···
448
427
patchShebangs . >/dev/null
449
428
'';
450
429
in
451
451
-
lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches
452
452
-
+ genericPatches;
430
430
+
lib.optionalString isDarwin darwinPatches + genericPatches;
453
431
454
432
buildInputs = [ buildJdk ] ++ defaultShellUtils;
455
433
···
528
506
529
507
mkdir -p $out/bin
530
508
531
531
-
# official wrapper scripts that searches for $WORKSPACE_ROOT/tools/bazel
532
532
-
# if it can’t find something in tools, it calls $out/bin/bazel-{version}-{os_arch}
533
533
-
# The binary _must_ exist with this naming if your project contains a .bazelversion
534
534
-
# file.
509
509
+
# official wrapper scripts that searches for $WORKSPACE_ROOT/tools/bazel if
510
510
+
# it can’t find something in tools, it calls
511
511
+
# $out/bin/bazel-{version}-{os_arch} The binary _must_ exist with this
512
512
+
# naming if your project contains a .bazelversion file.
535
513
cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel
536
514
wrapProgram $out/bin/bazel $wrapperfile --suffix PATH : ${defaultShellPath}
537
515
mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch}
···
616
594
dontStrip = true;
617
595
dontPatchELF = true;
618
596
619
619
-
passthru.repoCache = repoCache;
620
620
-
passthru.distDir = distDir;
597
597
+
passthru = {
598
598
+
# Additional tests that check bazel’s functionality. Execute
599
599
+
#
600
600
+
# nix-build . -A bazel_7.tests
601
601
+
#
602
602
+
# in the nixpkgs checkout root to exercise them locally.
603
603
+
tests = callPackage ./tests.nix {
604
604
+
inherit Foundation bazel_self distDir repoCache runJdk;
605
605
+
};
606
606
+
607
607
+
updater = throw "TODO";
608
608
+
609
609
+
inherit distDir repoCache;
610
610
+
};
621
611
}
-6
pkgs/development/tools/build-managers/bazel/bazel_7/java_toolchain.patch
···
1
1
-
commit ef1f5586d3c7fb426af1df6ba650bbad98a5a78a
2
2
-
Author: Guillaume Maudoux <guillaume.maudoux@tweag.io>
3
3
-
Date: Fri Oct 6 15:03:28 2023 +0200
4
4
-
5
5
-
java_toolchain.patch
6
6
-
7
1
diff --git a/tools/jdk/BUILD.tools b/tools/jdk/BUILD.tools
8
2
index a8af76e90c..af2540f838 100644
9
3
--- a/tools/jdk/BUILD.tools
-6
pkgs/development/tools/build-managers/bazel/bazel_7/no-arc.patch
···
1
1
-
commit bb831fbf02535a3372f5c74dc49e668a2507efeb
2
2
-
Author: Guillaume Maudoux <guillaume.maudoux@tweag.io>
3
3
-
Date: Fri Oct 6 15:06:35 2023 +0200
4
4
-
5
5
-
no-arc.patch
6
6
-
7
1
diff --git a/tools/osx/BUILD b/tools/osx/BUILD
8
2
index 0358fb0ffe..baae1bf65b 100644
9
3
--- a/tools/osx/BUILD
-6
pkgs/development/tools/build-managers/bazel/bazel_7/strict_proto_deps.patch
···
1
1
-
commit c5cbdf1fcfb96299aaef7fb9909c2cc30b126568
2
2
-
Author: Guillaume Maudoux <guillaume.maudoux@tweag.io>
3
3
-
Date: Fri Oct 6 15:06:00 2023 +0200
4
4
-
5
5
-
strict_proto_deps.patch
6
6
-
7
1
diff --git a/src/main/starlark/builtins_bzl/common/java/proto/java_proto_library.bzl b/src/main/starlark/builtins_bzl/common/java/proto/java_proto_library.bzl
8
2
index e2118aabea..6a33f03472 100644
9
3
--- a/src/main/starlark/builtins_bzl/common/java/proto/java_proto_library.bzl
-6
pkgs/development/tools/build-managers/bazel/bazel_7/trim-last-argument-to-gcc-if-empty.patch
···
1
1
-
commit d2b4b1d748ec4fa302036b514377da4c4618177a
2
2
-
Author: Guillaume Maudoux <guillaume.maudoux@tweag.io>
3
3
-
Date: Fri Oct 6 15:05:20 2023 +0200
4
4
-
5
5
-
trim-last-argument-to-gcc-if-empty.patch
6
6
-
7
1
diff --git a/tools/cpp/osx_cc_wrapper.sh.tpl b/tools/cpp/osx_cc_wrapper.sh.tpl
8
2
index 8264090c29..b7b9e8537a 100644
9
3
--- a/tools/cpp/osx_cc_wrapper.sh.tpl