Optimize //src:bazel-dev / package-bazel.sh to reduce incremental build times by 60%

Cuts incremental build times of the package-bazel step in //src:bazel-dev by
over 60% (14s -> 6s on a local test).

RELNOTES: Reduced the packaging time (`package-bazel.sh`) for the `//src:bazel-dev` Bazel development build target from 14s to 6s. Use `//src:bazel-dev` if you're iterating rapidly on a local Bazel changes, and use `//src:bazel --compilation_mode=opt` for release builds.

Closes #10584.

PiperOrigin-RevId: 290113790
diff --git a/scripts/bazel-dev.sh b/scripts/bazel-dev.sh
index 76ae52b..d084890 100755
--- a/scripts/bazel-dev.sh
+++ b/scripts/bazel-dev.sh
@@ -37,7 +37,7 @@
 BAZEL_BINARY=${BAZEL_BINARY:-$(which bazel)}
 
 # The location of the resulting binary.
-BAZEL_DEV="$BAZEL_DIR/bazel-bin/src/bazel"
+BAZEL_DEV="$BAZEL_DIR/bazel-bin/src/bazel-dev"
 
 # First, check whether a rebuild is needed.
 REBUILD=0
@@ -56,7 +56,7 @@
   (
     cd "$BAZEL_DIR"
     result=0
-    ${BAZEL_BINARY} build //src:bazel || result=$?
+    ${BAZEL_BINARY} build //src:bazel-dev || result=$?
     if [[ $result != 0 ]]; then
       echo -e "\033[31mError building dev version of bazel.\033[0m"
       exit $result
diff --git a/site/docs/install-compile-source.md b/site/docs/install-compile-source.md
index 912f2ff..8359b20 100644
--- a/site/docs/install-compile-source.md
+++ b/site/docs/install-compile-source.md
@@ -16,7 +16,9 @@
 
 TL;DR:
 
-1.  [Get the latest Bazel release](https://github.com/bazelbuild/bazel/releases)
+1.  Get the latest Bazel release from the
+    [GitHub release page](https://github.com/bazelbuild/bazel/releases) or with
+    [Bazelisk](https://github.com/bazelbuild/bazelisk).
 
 2.  [Download Bazel's sources from GitHub](https://github.com/bazelbuild/bazel/archive/master.zip)
     and extract somewhere.
@@ -26,10 +28,11 @@
     [for Unix-like systems](#bootstrap-unix-prereq) or
     [for Windows](#bootstrap-windows-prereq))
 
-4.  Build Bazel using Bazel: `bazel build //src:bazel`
-    (or `bazel build //src:bazel-dev.exe` on Windows)
+4.  Build a development build of Bazel using Bazel:
+    `bazel build //src:bazel-dev` (or `bazel build //src:bazel-dev.exe` on
+    Windows)
 
-5.  The resulting binary is at `bazel-bin/src/bazel`
+5.  The resulting binary is at `bazel-bin/src/bazel-dev`
     (or `bazel-bin\src\bazel-dev.exe` on Windows). You can copy it wherever you
     like and use immediately without further installation.
 
@@ -88,7 +91,7 @@
 
 ([Scroll down](#build-bazel-on-windows) for instructions for Windows.)
 
-**Goal**: Run Bazel to build a custom Bazel binary (`bazel-bin/src/bazel`).
+**Goal**: Run Bazel to build a custom Bazel binary (`bazel-bin/src/bazel-dev`).
 
 **Instructions**:
 
@@ -102,9 +105,12 @@
 
 3.  Build Bazel from source:
 
-        bazel build //src:bazel
+        bazel build //src:bazel-dev
 
-4.  The output will be at `bazel-bin/src/bazel`
+    Alternatively you can run `bazel build //src:bazel --compilation_mode=opt`
+    to yield a smaller binary but it's slower to build.
+
+4.  The output will be at `bazel-bin/src/bazel-dev` (or `bazel-bin/src/bazel`).
 
 <h3 id="build-bazel-on-windows">4. Build Bazel on Windows</h3>
 
@@ -128,10 +134,11 @@
 
         bazel build //src:bazel-dev.exe
 
-    Alternatively you can build `//src:bazel.exe` -- that yields a smaller
-    binary but it's slower to build.
+    Alternatively you can run `bazel build //src:bazel.exe
+    --compilation_mode=opt` to yield a smaller binary but it's slower to build.
 
-4.  The output will be at `bazel-bin\src\bazel-dev.exe`
+4.  The output will be at `bazel-bin\src\bazel-dev.exe` (or
+    `bazel-bin\src\bazel.exe`).
 
 <h3 id="build-bazel-install">5. Install the built binary</h3>
 
diff --git a/src/package-bazel.sh b/src/package-bazel.sh
index e20ef74..7cc1d33 100755
--- a/src/package-bazel.sh
+++ b/src/package-bazel.sh
@@ -100,6 +100,13 @@
 # Zero timestamps.
 (cd $PACKAGE_DIR; xargs touch -t 198001010000.00) < files.list
 
-# Create output zip with compression.
-(cd $PACKAGE_DIR; zip -q9DX@ $WORKDIR/$OUT) < files.list
+if [[ "$DEV_BUILD" -eq 1 ]]; then
+  # Create output zip with lowest compression, but fast.
+  ZIP_ARGS="-q1DX@"
+else
+  # Create output zip with highest compression, but slow.
+  ZIP_ARGS="-q9DX@"
+fi
+(cd $PACKAGE_DIR; zip $ZIP_ARGS $WORKDIR/$OUT) < files.list
+