bazel_7: 7.4.0 -> 7.4.1 (#355723)

authored by philiptaron.tngl.sh and committed by GitHub 6c33d760 6342c114

+54 -62
+8 -7
pkgs/development/tools/build-managers/bazel/bazel_7/default.nix
··· 44 # Allow to independently override the jdks used to build and run respectively 45 buildJdk, 46 runJdk, 47 # Always assume all markers valid (this is needed because we remove markers; they are non-deterministic). 48 # Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers). 49 enableNixHacks ? false, 50 - version ? "7.4.0", 51 }: 52 53 let ··· 55 56 src = fetchurl { 57 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip"; 58 - hash = "sha256-GY1wu3O5O7K2MMJv6wjE+DLnUgwjkHdmcqhT1o9G9Cg="; 59 }; 60 61 defaultShellUtils = ··· 112 if stdenv.hostPlatform.system == "x86_64-linux" then 113 fetchurl { 114 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-x86_64"; 115 - hash = "sha256-0glQLNAU0aT7+3Hzv0+IzgvJlfs7y8wflEwFssIvnkk="; 116 } 117 else if stdenv.hostPlatform.system == "aarch64-linux" then 118 fetchurl { 119 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-arm64"; 120 - hash = "sha256-736PrTFckHyChRh0Uv8zNtCppQYhfZWECl9+44cs6Qo="; 121 } 122 else if stdenv.hostPlatform.system == "x86_64-darwin" then 123 fetchurl { 124 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-x86_64"; 125 - hash = "sha256-FX7ZKKG7uoteEvx0fBqpsoB3Gj0aJNaC2IXgJ2ffgz4="; 126 } 127 else 128 fetchurl { 129 # stdenv.hostPlatform.system == "aarch64-darwin" 130 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64"; 131 - hash = "sha256-+EP+HssT4aISUZwLKkSuuXjGQm9lheNJDr7WZw1v0pU="; 132 }; 133 134 nativeBuildInputs = defaultShellUtils; ··· 392 }) 393 ] 394 # See enableNixHacks argument above. 395 - ++ lib.optional enableNixHacks ./nix-hacks.patch; 396 397 postPatch = 398 let
··· 44 # Allow to independently override the jdks used to build and run respectively 45 buildJdk, 46 runJdk, 47 + # Toggle for hacks for running bazel under buildBazelPackage: 48 # Always assume all markers valid (this is needed because we remove markers; they are non-deterministic). 49 # Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers). 50 enableNixHacks ? false, 51 + version ? "7.4.1", 52 }: 53 54 let ··· 56 57 src = fetchurl { 58 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip"; 59 + hash = "sha256-gzhmGLxIn02jYmbvJiDsZKUmxobPBwQTMsr/fJU6+vU="; 60 }; 61 62 defaultShellUtils = ··· 113 if stdenv.hostPlatform.system == "x86_64-linux" then 114 fetchurl { 115 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-x86_64"; 116 + hash = "sha256-CYL1paAtzTbfl7TfsqwJry/dkoTO/yZdHrX0NSA1+Ig="; 117 } 118 else if stdenv.hostPlatform.system == "aarch64-linux" then 119 fetchurl { 120 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-arm64"; 121 + hash = "sha256-6DzTEx218/Qq38eMWvXOX/t9VJDyPczz6Edh4eHdOfg="; 122 } 123 else if stdenv.hostPlatform.system == "x86_64-darwin" then 124 fetchurl { 125 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-x86_64"; 126 + hash = "sha256-Ut00wXzJezqlvf49RcTjk4Im8j3Qv7R77t1iWpU/HwU="; 127 } 128 else 129 fetchurl { 130 # stdenv.hostPlatform.system == "aarch64-darwin" 131 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64"; 132 + hash = "sha256-ArEXuX0JIa5NT04R0n4sCTA4HfQW43NDXV0EGcaibyQ="; 133 }; 134 135 nativeBuildInputs = defaultShellUtils; ··· 393 }) 394 ] 395 # See enableNixHacks argument above. 396 + ++ lib.optional enableNixHacks ./nix-build-bazel-package-hacks.patch; 397 398 postPatch = 399 let
+46
pkgs/development/tools/build-managers/bazel/bazel_7/nix-build-bazel-package-hacks.patch
···
··· 1 + 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 2 + index 53e6494656..22261cd268 100644 3 + --- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java 4 + +++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java 5 + @@ -55,6 +55,7 @@ import com.google.devtools.build.skyframe.SkyFunctionException.Transience; 6 + import com.google.devtools.build.skyframe.SkyKey; 7 + import com.google.devtools.build.skyframe.SkyValue; 8 + import java.io.IOException; 9 + +import java.util.Collections; 10 + import java.util.Map; 11 + import java.util.Optional; 12 + import java.util.TreeMap; 13 + @@ -193,16 +194,11 @@ public final class RepositoryDelegatorFunction implements SkyFunction { 14 + } 15 + 16 + if (shouldUseCachedRepos(env, handler, repoRoot, rule)) { 17 + - // Make sure marker file is up-to-date; correctly describes the current repository state 18 + - byte[] markerHash = digestWriter.areRepositoryAndMarkerFileConsistent(handler, env); 19 + - if (env.valuesMissing()) { 20 + - return null; 21 + - } 22 + - if (markerHash != null) { // repo exist & up-to-date 23 + + { 24 + + // Nix hack: Always consider cached dirs as up-to-date 25 + return RepositoryDirectoryValue.builder() 26 + .setPath(repoRoot) 27 + - .setDigest(markerHash) 28 + - .setExcludeFromVendoring(excludeRepoFromVendoring) 29 + + .setDigest(digestWriter.writeMarkerFile(Collections.emptyMap())) 30 + .build(); 31 + } 32 + } 33 + 34 + 35 + 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 36 + index 649647c5f2..64d05b530c 100644 37 + --- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java 38 + +++ b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java 39 + @@ -165,7 +165,6 @@ public class JavaSubprocessFactory implements SubprocessFactory { 40 + } 41 + builder.command(argv); 42 + if (params.getEnv() != null) { 43 + - builder.environment().clear(); 44 + builder.environment().putAll(params.getEnv()); 45 + } 46 +
-55
pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch
··· 1 - 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 2 - index 4d8c46f8d5..ed311226f0 100644 3 - --- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java 4 - +++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java 5 - @@ -178,18 +178,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction { 6 - } 7 - } 8 - if (shouldUseCachedRepos(env, handler, repoRoot, rule)) { 9 - - // Make sure marker file is up-to-date; correctly describes the current repository state 10 - - byte[] markerHash = digestWriter.areRepositoryAndMarkerFileConsistent(handler, env); 11 - - if (env.valuesMissing()) { 12 - - return null; 13 - - } 14 - - if (markerHash != null) { // repo exist & up-to-date 15 - - return RepositoryDirectoryValue.builder() 16 - - .setPath(repoRoot) 17 - - .setDigest(markerHash) 18 - - .setExcludeFromVendoring(shouldExcludeRepoFromVendoring(handler, rule)) 19 - - .build(); 20 - - } 21 - + // Nix hack: Always consider cached dirs as up-to-date 22 - + return RepositoryDirectoryValue.builder().setPath(repoRoot).setDigest(digestWriter.writeMarkerFile()).build(); 23 - } 24 - 25 - /* At this point: This is a force fetch, a local repository, OR The repository cache is old or 26 - @@ -610,11 +600,12 @@ public final class RepositoryDelegatorFunction implements SkyFunction { 27 - builder.append(escape(key)).append(" ").append(escape(value)).append("\n"); 28 - } 29 - String content = builder.toString(); 30 - - try { 31 - - FileSystemUtils.writeContent(markerPath, UTF_8, content); 32 - - } catch (IOException e) { 33 - - throw new RepositoryFunctionException(e, Transience.TRANSIENT); 34 - - } 35 - + // Nix hack: Do not write these pesky marker files 36 - + //try { 37 - + // FileSystemUtils.writeContent(markerPath, UTF_8, content); 38 - + //} catch (IOException e) { 39 - + // throw new RepositoryFunctionException(e, Transience.TRANSIENT); 40 - + //} 41 - return new Fingerprint().addString(content).digestAndReset(); 42 - } 43 - 44 - 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 45 - index 649647c5f2..64d05b530c 100644 46 - --- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java 47 - +++ b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java 48 - @@ -165,7 +165,6 @@ public class JavaSubprocessFactory implements SubprocessFactory { 49 - } 50 - builder.command(argv); 51 - if (params.getEnv() != null) { 52 - - builder.environment().clear(); 53 - builder.environment().putAll(params.getEnv()); 54 - } 55 -
···