bazel_4: add default PATH for local actions if it is not set (darwin)
Co-Authored-By: Uri Baghin <33242106+uri-canva@users.noreply.github.com>
This commit is contained in:
parent
2aea3ebc9c
commit
b147f2111d
@ -1,5 +1,5 @@
|
||||
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
|
||||
index 6fff2af..7e2877e 100755
|
||||
index 6fff2af..7e2877e 100644
|
||||
--- 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
|
||||
@@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider {
|
||||
@ -19,3 +19,23 @@ index 6fff2af..7e2877e 100755
|
||||
String p = clientEnv.get("TMPDIR");
|
||||
if (Strings.isNullOrEmpty(p)) {
|
||||
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
|
||||
index 95642767c6..39d3c62461 100644
|
||||
--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
|
||||
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
|
||||
@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider {
|
||||
|
||||
ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder();
|
||||
newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
|
||||
+
|
||||
+ // In case we are running on NixOS.
|
||||
+ // If bash is called with an unset PATH on this platform,
|
||||
+ // it will set it to /no-such-path and default tools will be missings.
|
||||
+ // See, https://github.com/NixOS/nixpkgs/issues/94222
|
||||
+ // So we ensure that minimal dependencies are present.
|
||||
+ if (!env.containsKey("PATH")){
|
||||
+ newEnvBuilder.put("PATH", "@actionsPathPatch@");
|
||||
+ }
|
||||
+
|
||||
String p = clientEnv.get("TMPDIR");
|
||||
if (Strings.isNullOrEmpty(p)) {
|
||||
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
|
||||
|
@ -103,7 +103,22 @@ let
|
||||
# ],
|
||||
# )
|
||||
#
|
||||
[ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip file zip python27 python3 ];
|
||||
[
|
||||
bash
|
||||
coreutils
|
||||
file
|
||||
findutils
|
||||
gawk
|
||||
gnugrep
|
||||
gnused
|
||||
gnutar
|
||||
gzip
|
||||
python27
|
||||
python3
|
||||
unzip
|
||||
which
|
||||
zip
|
||||
];
|
||||
|
||||
# Java toolchain used for the build and tests
|
||||
javaToolchain = "@bazel_tools//tools/jdk:toolchain_${buildJdkName}";
|
||||
@ -516,12 +531,13 @@ stdenv.mkDerivation rec {
|
||||
# when a command can’t be found in a bazel build, you might also
|
||||
# need to add it to `defaultShellPath`.
|
||||
nativeBuildInputs = [
|
||||
coreutils
|
||||
installShellFiles
|
||||
zip
|
||||
makeWrapper
|
||||
python3
|
||||
unzip
|
||||
makeWrapper
|
||||
which
|
||||
zip
|
||||
] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];
|
||||
|
||||
# Bazel makes extensive use of symlinks in the WORKSPACE.
|
||||
|
Loading…
Reference in New Issue
Block a user