Enable Bzlmod for Bazel

This PR enables Bzlmod as the default external dependencies system for Bazel.

Changes included:

- Enable bzlmod by default in `.bazelrc`.
- Renamed `io_bazel` to `_main` at necessary locations.
- Added lockfile `MODULE.bazel.lock`. We should enable `--lockfile_mode=error` on CI and `--lockfile_mode=update` for local builds after fixing some issues in the lock file feature, probably with 6.4.0.
- Replaced distdir with repository cache (http artifact cache) in the offline bootstrap build. This will eventually be replaced by vendoring and packaging dependencies.
- Replaced `--override_repository` hack with repository cache (http artifact cache) for running integration tests without network access. This will eventually be replaced by a true shared repository cache.
- Only keep `--experimental_repository_cache_hardlinks` for macOS inside integration tests. On Linux, it'll trigger `invalid cross-device link` error because the file system of the sandbox dir is different from the repo cache dir inside docker container.
- Moved common CI flags to .bazelrc for better maintenance.
- Added all Maven coords in MODULE.bazel, patched rules_jvm_external to fix some Bzlmod issues.

Next step:
- Remove WORKSPACE and clean up distdir_deps, distdir.bzl.
- Enable `--lockfile_mode=error` on CI and `--lockfile_mode=update` for local builds

Closes https://github.com/bazelbuild/bazel/pull/19087

Fixes https://github.com/bazelbuild/bazel/issues/18957

PiperOrigin-RevId: 563825184
Change-Id: Ibf06418688bd568b38fd4aa73ad8328acfbaa13c
diff --git a/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java b/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java
index f89e204..6e5cbc5 100644
--- a/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java
+++ b/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java
@@ -47,7 +47,7 @@
    * Location in the bazel repo where embedded binaries come from.
    */
   public static final ImmutableList<String> EMBEDDED_SCRIPTS_PATHS = ImmutableList.of(
-      "io_bazel/src/main/tools");
+      "_main/src/main/tools");
 
   /**
    * Default workspace name.
@@ -63,31 +63,31 @@
   /**
    * Directory where we can find bazel's Java tests, relative to a test's runfiles directory.
    */
-  public static final String JAVATESTS_ROOT = "io_bazel/src/test/java/";
+  public static final String JAVATESTS_ROOT = "_main/src/test/java/";
 
   /** Location of the bazel repo relative to the workspace root */
   public static final String BAZEL_REPO_PATH = "";
 
   /** The file path in which to create files so that they end up under Bazel main repository. */
-  public static final String BAZEL_REPO_SCRATCH = "../io_bazel/";
+  public static final String BAZEL_REPO_SCRATCH = "../_main/";
 
   /** Relative path to the {@code process-wrapper} tool. */
   public static final String PROCESS_WRAPPER_PATH =
-      "io_bazel/src/main/tools/process-wrapper";
+      "_main/src/main/tools/process-wrapper";
 
   /** Relative path to the {@code linux-sandbox} tool. */
   public static final String LINUX_SANDBOX_PATH =
-      "io_bazel/src/main/tools/linux-sandbox";
+      "_main/src/main/tools/linux-sandbox";
 
   /** Relative path to the {@code spend_cpu_time} testing tool. */
   public static final String CPU_TIME_SPENDER_PATH =
-      "io_bazel/src/test/shell/integration/spend_cpu_time";
+      "_main/src/test/shell/integration/spend_cpu_time";
 
   /**
    * Directory where we can find Bazel's own bootstrapping rules relative to a test's runfiles
    * directory, i.e. when //tools/build_rules:srcs is in a test's data.
    */
-  public static final String BUILD_RULES_DATA_PATH = "io_bazel/tools/build_rules/";
+  public static final String BUILD_RULES_DATA_PATH = "_main/tools/build_rules/";
 
   public static final String TEST_RULE_CLASS_PROVIDER =
       "com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider";
@@ -114,7 +114,7 @@
 
   public static final String RULES_CC_REPOSITORY_SCRATCH = "rules_cc_workspace/";
   /** The directory in which rules_cc repo resides in execroot. */
-  public static final String RULES_CC_REPOSITORY_EXECROOT = "external/rules_cc/";
+  public static final String RULES_CC_REPOSITORY_EXECROOT = "external/" + RulesCcRepoName.CANONICAL_REPO_NAME + "/";
 
   public static final ImmutableList<String> DOCS_RULES_PATHS = ImmutableList.of(
       "src/main/java/com/google/devtools/build/lib/rules");