diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix index 1a77dea97574..aa29308798c3 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix @@ -44,10 +44,11 @@ # Allow to independently override the jdks used to build and run respectively buildJdk, runJdk, + # Toggle for hacks for running bazel under buildBazelPackage: # Always assume all markers valid (this is needed because we remove markers; they are non-deterministic). # Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers). enableNixHacks ? false, - version ? "7.4.0", + version ? "7.4.1", }: let @@ -55,7 +56,7 @@ let src = fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip"; - hash = "sha256-GY1wu3O5O7K2MMJv6wjE+DLnUgwjkHdmcqhT1o9G9Cg="; + hash = "sha256-gzhmGLxIn02jYmbvJiDsZKUmxobPBwQTMsr/fJU6+vU="; }; defaultShellUtils = @@ -112,23 +113,23 @@ let if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-x86_64"; - hash = "sha256-0glQLNAU0aT7+3Hzv0+IzgvJlfs7y8wflEwFssIvnkk="; + hash = "sha256-CYL1paAtzTbfl7TfsqwJry/dkoTO/yZdHrX0NSA1+Ig="; } else if stdenv.hostPlatform.system == "aarch64-linux" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-arm64"; - hash = "sha256-736PrTFckHyChRh0Uv8zNtCppQYhfZWECl9+44cs6Qo="; + hash = "sha256-6DzTEx218/Qq38eMWvXOX/t9VJDyPczz6Edh4eHdOfg="; } else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-x86_64"; - hash = "sha256-FX7ZKKG7uoteEvx0fBqpsoB3Gj0aJNaC2IXgJ2ffgz4="; + hash = "sha256-Ut00wXzJezqlvf49RcTjk4Im8j3Qv7R77t1iWpU/HwU="; } else fetchurl { # stdenv.hostPlatform.system == "aarch64-darwin" url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64"; - hash = "sha256-+EP+HssT4aISUZwLKkSuuXjGQm9lheNJDr7WZw1v0pU="; + hash = "sha256-ArEXuX0JIa5NT04R0n4sCTA4HfQW43NDXV0EGcaibyQ="; }; nativeBuildInputs = defaultShellUtils; @@ -392,7 +393,7 @@ stdenv.mkDerivation rec { }) ] # See enableNixHacks argument above. - ++ lib.optional enableNixHacks ./nix-hacks.patch; + ++ lib.optional enableNixHacks ./nix-build-bazel-package-hacks.patch; postPatch = let diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch b/pkgs/development/tools/build-managers/bazel/bazel_7/nix-build-bazel-package-hacks.patch similarity index 52% rename from pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch rename to pkgs/development/tools/build-managers/bazel/bazel_7/nix-build-bazel-package-hacks.patch index 07fd098b8043..28fe172f3e5c 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch +++ b/pkgs/development/tools/build-managers/bazel/bazel_7/nix-build-bazel-package-hacks.patch @@ -1,10 +1,18 @@ diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java -index 4d8c46f8d5..ed311226f0 100644 +index 53e6494656..22261cd268 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java -@@ -178,18 +178,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction { - } +@@ -55,6 +55,7 @@ import com.google.devtools.build.skyframe.SkyFunctionException.Transience; + import com.google.devtools.build.skyframe.SkyKey; + import com.google.devtools.build.skyframe.SkyValue; + import java.io.IOException; ++import java.util.Collections; + import java.util.Map; + import java.util.Optional; + import java.util.TreeMap; +@@ -193,16 +194,11 @@ public final class RepositoryDelegatorFunction implements SkyFunction { } + if (shouldUseCachedRepos(env, handler, repoRoot, rule)) { - // Make sure marker file is up-to-date; correctly describes the current repository state - byte[] markerHash = digestWriter.areRepositoryAndMarkerFileConsistent(handler, env); @@ -12,35 +20,18 @@ index 4d8c46f8d5..ed311226f0 100644 - return null; - } - if (markerHash != null) { // repo exist & up-to-date -- return RepositoryDirectoryValue.builder() -- .setPath(repoRoot) ++ { ++ // Nix hack: Always consider cached dirs as up-to-date + return RepositoryDirectoryValue.builder() + .setPath(repoRoot) - .setDigest(markerHash) -- .setExcludeFromVendoring(shouldExcludeRepoFromVendoring(handler, rule)) -- .build(); -- } -+ // Nix hack: Always consider cached dirs as up-to-date -+ return RepositoryDirectoryValue.builder().setPath(repoRoot).setDigest(digestWriter.writeMarkerFile()).build(); +- .setExcludeFromVendoring(excludeRepoFromVendoring) ++ .setDigest(digestWriter.writeMarkerFile(Collections.emptyMap())) + .build(); + } } - - /* At this point: This is a force fetch, a local repository, OR The repository cache is old or -@@ -610,11 +600,12 @@ public final class RepositoryDelegatorFunction implements SkyFunction { - builder.append(escape(key)).append(" ").append(escape(value)).append("\n"); - } - String content = builder.toString(); -- try { -- FileSystemUtils.writeContent(markerPath, UTF_8, content); -- } catch (IOException e) { -- throw new RepositoryFunctionException(e, Transience.TRANSIENT); -- } -+ // Nix hack: Do not write these pesky marker files -+ //try { -+ // FileSystemUtils.writeContent(markerPath, UTF_8, content); -+ //} catch (IOException e) { -+ // throw new RepositoryFunctionException(e, Transience.TRANSIENT); -+ //} - return new Fingerprint().addString(content).digestAndReset(); - } - + + diff --git a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java index 649647c5f2..64d05b530c 100644 --- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java