diff --git a/build/bazel-wrapper/bazel b/build/bazel-wrapper/bazel index cd8430a146cd..85b73c3fa5de 100755 --- a/build/bazel-wrapper/bazel +++ b/build/bazel-wrapper/bazel @@ -2,10 +2,4 @@ set -e -u -o pipefail -script_root="$(cd "$(dirname "$0")"; pwd)" - -. "$script_root/common.sh" - -# shellcheck disable=SC2154 -# $output_user_root_opt is defined in common.sh -exec "$BAZEL_REAL" "$output_user_root_opt" "$@" +exec "$BAZEL_REAL" "$@" diff --git a/build/bazel-wrapper/bazel.bat b/build/bazel-wrapper/bazel.bat index 12ea62787ee9..0b07120e1a94 100644 --- a/build/bazel-wrapper/bazel.bat +++ b/build/bazel-wrapper/bazel.bat @@ -2,8 +2,5 @@ setlocal -call "%~dp0common.bat" -if errorlevel 1 exit /b %ERRORLEVEL% - -"%BAZEL_REAL%" %OUTPUT_USER_ROOT_OPT% %* +"%BAZEL_REAL%" %* exit /b %ERRORLEVEL% diff --git a/build/bazel-wrapper/common.bat b/build/bazel-wrapper/common.bat deleted file mode 100644 index a1452b066bab..000000000000 --- a/build/bazel-wrapper/common.bat +++ /dev/null @@ -1,3 +0,0 @@ -REM Common code for all Bazel wrappers -REM IJI-2767 Bazel: move bazel output root to a standard location -set OUTPUT_USER_ROOT_OPT=--output_user_root=%LOCALAPPDATA%\JetBrains\MonorepoBazel diff --git a/build/bazel-wrapper/common.sh b/build/bazel-wrapper/common.sh deleted file mode 100644 index 8dfab736575c..000000000000 --- a/build/bazel-wrapper/common.sh +++ /dev/null @@ -1,10 +0,0 @@ -# Common code for all Bazel wrappers - -# output_user_root_opt will be used upon running Bazel -# IJI-2767 Bazel: move bazel output root to a standard location -# shellcheck disable=SC2034 -case "$(uname -s)" in - Darwin) output_user_root_opt=--output_user_root=~/Library/Caches/JetBrains/MonorepoBazel ;; - Linux) output_user_root_opt=--output_user_root=~/.cache/JetBrains/MonorepoBazel ;; - *) echo "unrecognized operating system $(uname -s)"; exit 1 ;; -esac diff --git a/common.bazelrc b/common.bazelrc index 419223fd9f33..4003a57e57d2 100644 --- a/common.bazelrc +++ b/common.bazelrc @@ -9,20 +9,25 @@ # Limit the server memory usage as per https://youtrack.jetbrains.com/issue/IJI-3103#focus=Comments-27-12862178.0-0 startup --host_jvm_args=-Xmx12g +# IJI-2767 Bazel: move bazel output root to a standard location +startup:macos --output_user_root=~/Library/Caches/JetBrains/MonorepoBazel +startup:linux --output_user_root=~/.cache/JetBrains/MonorepoBazel +startup:windows --output_user_root=~/AppData/Local/JetBrains/MonorepoBazel + # Use low-latency ZGC to prevent overflow when watching local filesystem for changes on Windows # # G1GC pauses the sun.nio.fs.WindowsWatchService.Poller's thread, delaying asynchronous callback processing long enough # that ReadDirectoryChangesW returns zero bytes transferred (aka StandardWatchEventKinds.OVERFLOW): # https://github.com/openjdk/jdk/blob/6705a9255d28f351950e7fbca9d05e73942a4e27/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java#L630 -startup --host_jvm_args=-XX:+UseZGC +startup:windows --host_jvm_args=-XX:+UseZGC # Increase file watch service queue maximum size to prevent overflow when watching local filesystem for changes on Windows # https://github.com/openjdk/jdk/blob/6705a9255d28f351950e7fbca9d05e73942a4e27/src/java.base/share/classes/sun/nio/fs/AbstractWatchKey.java#L39 -startup --host_jvm_args=-Djdk.nio.file.WatchService.maxEventsPerPoll=1000000 # 1M +startup:windows --host_jvm_args=-Djdk.nio.file.WatchService.maxEventsPerPoll=1000000 # 1M # Increase size of per-directory buffer for events to prevent overflow when watching local filesystem for changes on Windows # https://github.com/JetBrains/JetBrainsRuntime/blob/d7e087876fa0326af082e705483a079b919242bc/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java#L290 -startup --host_jvm_args=-Djdk.nio.file.WatchService.bufferSizeToRetrieveEventsPerDirectory=524288 # 512K +startup:windows --host_jvm_args=-Djdk.nio.file.WatchService.bufferSizeToRetrieveEventsPerDirectory=524288 # 512K # Disk cache common --experimental_disk_cache_gc_max_size=32G --experimental_disk_cache_gc_max_age=28d diff --git a/platform/build-scripts/bazel/.bazelrc b/platform/build-scripts/bazel/.bazelrc index eb5af0bf692d..b683e4dbd8ee 100644 --- a/platform/build-scripts/bazel/.bazelrc +++ b/platform/build-scripts/bazel/.bazelrc @@ -1,3 +1,8 @@ +# IJI-2767 Bazel: move bazel output root to a standard location +startup:macos --output_user_root=~/Library/Caches/JetBrains/MonorepoBazel +startup:linux --output_user_root=~/.cache/JetBrains/MonorepoBazel +startup:windows --output_user_root=~/AppData/Local/JetBrains/MonorepoBazel + build --nobuild_runfile_links # rules_kotlin Compiling Kotlin on Windows appears to require --legacy_external_runfiles https://github.com/bazelbuild/rules_kotlin/issues/1309 diff --git a/platform/build-scripts/bazel/build/bazel-wrapper/bazel b/platform/build-scripts/bazel/build/bazel-wrapper/bazel index 15469638cdce..776090423882 100755 --- a/platform/build-scripts/bazel/build/bazel-wrapper/bazel +++ b/platform/build-scripts/bazel/build/bazel-wrapper/bazel @@ -3,7 +3,6 @@ set -e -u -o pipefail ultimate_root="$(cd "$(dirname "$0")/../../../../../.."; pwd)" -community_root="$(cd "$(dirname "$0")/../../../../.."; pwd)" # Provide packages.jetbrains.team credentials for Bazel in .netrc # The script will be missing if run from community repository @@ -12,8 +11,4 @@ if [ -f "$authorizer" ]; then "$authorizer" fi -. "$community_root/build/bazel-wrapper/common.sh" - -# shellcheck disable=SC2154 -# $output_user_root_opt is defined in common.sh -exec "$BAZEL_REAL" "$output_user_root_opt" "$@" +exec "$BAZEL_REAL" "$@" diff --git a/platform/build-scripts/bazel/build/bazel-wrapper/bazel.bat b/platform/build-scripts/bazel/build/bazel-wrapper/bazel.bat index 10628156a79e..7c41efd4fd98 100644 --- a/platform/build-scripts/bazel/build/bazel-wrapper/bazel.bat +++ b/platform/build-scripts/bazel/build/bazel-wrapper/bazel.bat @@ -9,8 +9,5 @@ REM The script will be missing if run from community repository if exist "%AUTHORIZER%" call "%AUTHORIZER%" if errorlevel 1 exit /b %ERRORLEVEL% -call "%~dp0../../../../../build/bazel-wrapper/common.bat" -if errorlevel 1 exit /b %ERRORLEVEL% - -"%BAZEL_REAL%" %OUTPUT_USER_ROOT_OPT% %* +"%BAZEL_REAL%" %* exit /b %ERRORLEVEL%