-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bazel_7: init at 7.0.0-pre.20230917.3
- Loading branch information
Showing
19 changed files
with
1,138 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
commit 595756621dd858cf18033af2c4707d2fe8548350 | ||
Author: Guillaume Maudoux <[email protected]> | ||
Date: Fri Oct 6 15:09:56 2023 +0200 | ||
|
||
actions_path.patch | ||
|
||
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 100644 | ||
index 8284eff943..a820037968 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,11 +25,12 @@ index 6fff2af..7e2877e 100644 | |
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 | ||
diff --git 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 | ||
index 8f230b1b1d..2e4c7d26b7 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 { | ||
|
||
@@ -75,6 +75,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider { | ||
ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder(); | ||
newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR"))); | ||
+ | ||
|
114 changes: 114 additions & 0 deletions
114
pkgs/development/tools/build-managers/bazel/bazel_7/bazel-repository-cache.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{ lib | ||
, nix | ||
, runCommand | ||
, fetchurl | ||
# The path to the right MODULE.bazel.lock | ||
, lockfile | ||
# The path to a json file containing the list of hashes we should prefetch | ||
, requiredDeps ? null | ||
, extraInputs ? [ ] | ||
}: | ||
let | ||
modules = builtins.fromJSON (builtins.readFile lockfile); | ||
|
||
# a foldl' for json values | ||
foldlJSON = op: acc: value: | ||
let | ||
# preorder, visit the current node first | ||
acc' = op acc value; | ||
|
||
# then visit child values, ignoring attribute names | ||
children = | ||
if builtins.isList value then | ||
lib.foldl' (foldlJSON op) acc' value | ||
else if builtins.isAttrs value then | ||
lib.foldlAttrs (_acc: _name: foldlJSON op _acc) acc' value | ||
else | ||
acc'; | ||
in | ||
# like foldl', force evaluation of intermediate results | ||
builtins.seq acc' children; | ||
|
||
extract_source = acc: value: | ||
# We take any "attributes" object that has a "sha256" field. Every value | ||
# under "attributes" is assumed to be an object, and all the "attributes" | ||
# with a "sha256" field are assumed to have either a "urls" or "url" field. | ||
# | ||
# We add them to the `acc`umulator: | ||
# | ||
# acc // { | ||
# "ffad2b06ef2e09d040...fc8e33706bb01634" = fetchurl { | ||
# name = "source"; | ||
# sha256 = "ffad2b06ef2e09d040...fc8e33706bb01634"; | ||
# urls = [ | ||
# "https://mirror.bazel.build/github.com/golang/library.zip", | ||
# "https://github.com/golang/library.zip" | ||
# ]; | ||
# }; | ||
# } | ||
let | ||
# remove the "--" prefix, abusing undocumented negative substring length | ||
sanitize = builtins.substring 2 (-1); | ||
attrs = value.attributes; | ||
entry = hash: urls: { | ||
${hash} = fetchurl { | ||
name = "source"; # just like fetch*, to get some deduplication | ||
inherit urls; | ||
sha256 = hash; | ||
passthru.sha256 = hash; | ||
}; | ||
}; | ||
insert = acc: hash: urls: acc // entry (sanitize hash) (map sanitize urls); | ||
in | ||
if builtins.isAttrs value && value ? attributes | ||
&& (attrs ? sha256 || attrs ? integrity) | ||
then | ||
#builtins.trace attrs | ||
( | ||
insert | ||
acc | ||
(attrs.integrity or attrs.sha256) | ||
(attrs.urls or [ attrs.url ]) | ||
) | ||
else if builtins.isAttrs value && value ? remote_patches | ||
&& builtins.isAttrs value.remote_patches | ||
then | ||
#builtins.trace value.remote_patches | ||
( | ||
lib.foldlAttrs | ||
(acc: url: hash: insert acc hash [ url ]) | ||
acc | ||
value.remote_patches | ||
) | ||
else acc; | ||
|
||
inputs = foldlJSON extract_source { } modules; | ||
|
||
requiredHashes = builtins.fromJSON (builtins.readFile requiredDeps); | ||
requiredAttrs = lib.genAttrs requiredHashes throw; | ||
|
||
requiredInputs = | ||
if requiredDeps == null | ||
then inputs | ||
else builtins.intersectAttrs requiredAttrs (builtins.trace inputs inputs); | ||
|
||
command = '' | ||
mkdir -p $out/content_addressable/sha256 | ||
cd $out/content_addressable/sha256 | ||
'' + lib.concatMapStrings | ||
# TODO: Do not re-hash. Use nix-hash to convert hashes | ||
(drv: '' | ||
filename=$(basename "${lib.head drv.urls}") | ||
echo Caching $filename | ||
hash=$(${nix}/bin/nix-hash --type sha256 --to-base16 ${drv.sha256}) | ||
mkdir -p $hash | ||
ln -sfn ${drv} $hash/file | ||
ln -sfn ${drv} $filename | ||
'') | ||
(builtins.attrValues requiredInputs ++ extraInputs) | ||
; | ||
|
||
repository_cache = runCommand "bazel-repository-cache" { } command; | ||
|
||
in | ||
repository_cache |
56 changes: 56 additions & 0 deletions
56
pkgs/development/tools/build-managers/bazel/bazel_7/darwin_sleep.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
diff --git a/src/main/native/darwin/sleep_prevention_jni.cc b/src/main/native/darwin/sleep_prevention_jni.cc | ||
index 67c35b201e..e50a58320e 100644 | ||
--- a/src/main/native/darwin/sleep_prevention_jni.cc | ||
+++ b/src/main/native/darwin/sleep_prevention_jni.cc | ||
@@ -33,31 +33,13 @@ static int g_sleep_state_stack = 0; | ||
static IOPMAssertionID g_sleep_state_assertion = kIOPMNullAssertionID; | ||
|
||
int portable_push_disable_sleep() { | ||
- std::lock_guard<std::mutex> lock(g_sleep_state_mutex); | ||
- BAZEL_CHECK_GE(g_sleep_state_stack, 0); | ||
- if (g_sleep_state_stack == 0) { | ||
- BAZEL_CHECK_EQ(g_sleep_state_assertion, kIOPMNullAssertionID); | ||
- CFStringRef reasonForActivity = CFSTR("build.bazel"); | ||
- IOReturn success = IOPMAssertionCreateWithName( | ||
- kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity, | ||
- &g_sleep_state_assertion); | ||
- BAZEL_CHECK_EQ(success, kIOReturnSuccess); | ||
- } | ||
- g_sleep_state_stack += 1; | ||
- return 0; | ||
+ // Unreliable, disable for now | ||
+ return -1; | ||
} | ||
|
||
int portable_pop_disable_sleep() { | ||
- std::lock_guard<std::mutex> lock(g_sleep_state_mutex); | ||
- BAZEL_CHECK_GT(g_sleep_state_stack, 0); | ||
- g_sleep_state_stack -= 1; | ||
- if (g_sleep_state_stack == 0) { | ||
- BAZEL_CHECK_NE(g_sleep_state_assertion, kIOPMNullAssertionID); | ||
- IOReturn success = IOPMAssertionRelease(g_sleep_state_assertion); | ||
- BAZEL_CHECK_EQ(success, kIOReturnSuccess); | ||
- g_sleep_state_assertion = kIOPMNullAssertionID; | ||
- } | ||
- return 0; | ||
+ // Unreliable, disable for now | ||
+ return -1; | ||
} | ||
|
||
} // namespace blaze_jni | ||
diff --git a/src/main/native/darwin/system_suspension_monitor_jni.cc b/src/main/native/darwin/system_suspension_monitor_jni.cc | ||
index 3483aa7935..51782986ec 100644 | ||
--- a/src/main/native/darwin/system_suspension_monitor_jni.cc | ||
+++ b/src/main/native/darwin/system_suspension_monitor_jni.cc | ||
@@ -83,10 +83,7 @@ void portable_start_suspend_monitoring() { | ||
// Register to receive system sleep notifications. | ||
// Testing needs to be done manually. Use the logging to verify | ||
// that sleeps are being caught here. | ||
- suspend_state.connect_port = IORegisterForSystemPower( | ||
- &suspend_state, ¬ifyPortRef, SleepCallBack, ¬ifierObject); | ||
- BAZEL_CHECK_NE(suspend_state.connect_port, MACH_PORT_NULL); | ||
- IONotificationPortSetDispatchQueue(notifyPortRef, queue); | ||
+ // XXX: Unreliable, disable for now | ||
|
||
// Register to deal with SIGCONT. | ||
// We register for SIGCONT because we can't catch SIGSTOP. |
Oops, something went wrong.