Reland "build: remove references to use_goma"

This reverts commit bfa598b72f1daa3a468bb76390216e32607ca43a.

Reason for revert:
Removed chromeos related changes.

Original change's description:
> Revert "build: remove references to use_goma"
>
> This reverts commit 296be8434a7fe1af9cf8a55d6324217b3c7ef7e1.
>
> Reason for revert: http://b/331553993
>
> Original change's description:
> > build: remove references to use_goma
> >
> > Bug: 41489832
> > Change-Id: I19155fd7233930a15f9e9a573ae86c5c88d7d8a4
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5385591
> > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> > Reviewed-by: Philipp Wollermann <philwo@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1278096}
>
> Bug: 41489832, 331553993
> Change-Id: I0f1bbaecf282e111541b878d527680add19e8077
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5399667
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> Reviewed-by: Junji Watanabe <jwata@google.com>
> Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> Commit-Queue: Junji Watanabe <jwata@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#1278851}

Bug: 41489832, 331553993
Change-Id: I3ea16bbfb96b8614663dea84550c13601dac0154
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5403632
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Philipp Wollermann <philwo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1280086}
diff --git a/build/android/gyp/nocompile_test.py b/build/android/gyp/nocompile_test.py
index 0775c1c..152ae3d 100755
--- a/build/android/gyp/nocompile_test.py
+++ b/build/android/gyp/nocompile_test.py
@@ -155,8 +155,8 @@
   extra_gn_args = [
       'enable_android_nocompile_tests = true',
       'treat_warnings_as_errors = true',
-      # GOMA does not work with non-standard output directories.
-      'use_goma = false',
+      # RBE does not work with non-standard output directories.
+      'use_remoteexec = false',
   ]
   _copy_and_append_gn_args(options.gn_args_path, out_gn_args_path,
                            extra_gn_args)
diff --git a/build/android/test/incremental_javac_gn/incremental_javac_test_android_library.py b/build/android/test/incremental_javac_gn/incremental_javac_test_android_library.py
index 6407450..e8a4c55 100755
--- a/build/android/test/incremental_javac_gn/incremental_javac_test_android_library.py
+++ b/build/android/test/incremental_javac_gn/incremental_javac_test_android_library.py
@@ -113,8 +113,8 @@
   out_gn_args_path = options.out_dir / 'args.gn'
   extra_gn_args = [
       'treat_warnings_as_errors = true',
-      # GOMA does not work with non-standard output directories.
-      'use_goma = false',
+      # reclient does not work with non-standard output directories.
+      'use_remoteexec = false',
   ]
   _copy_and_append_gn_args(
       options.gn_args_path, out_gn_args_path,
diff --git a/build/args/chromeos/README.md b/build/args/chromeos/README.md
index 2842252..9be37b6 100644
--- a/build/args/chromeos/README.md
+++ b/build/args/chromeos/README.md
@@ -46,8 +46,7 @@
 import("//build/args/chromeos/eve.gni")
 
 is_debug = true
-use_goma = true
-goma_dir = "/path/to/goma/"
+use_remoteexec = true
 ```
 
 TODO(bpastene): Make 'cros_boards' a first class citizen in gclient and replace
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index f991e52..2ac2609 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -20,7 +20,6 @@
 import("//build/config/unwind.gni")
 import("//build/toolchain/cc_wrapper.gni")
 import("//build/toolchain/cros/cros_config.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/toolchain.gni")
 import("//build_overrides/build.gni")
@@ -248,8 +247,6 @@
        (clang_use_default_sample_profile || clang_sample_profile_path != ""))
 }
 
-assert(!(llvm_force_head_revision && use_goma),
-       "can't use goma with trunk clang")
 assert(!(llvm_force_head_revision && use_remoteexec),
        "can't use rbe with trunk clang")
 
@@ -881,8 +878,6 @@
 
   if (is_clang && !is_nacl && show_includes) {
     if (is_win) {
-      # TODO(crbug.com/1223741): Goma mixes the -H and /showIncludes output.
-      assert(!use_goma, "show_includes on Windows is not reliable with goma")
       cflags += [
         "/clang:-H",
         "/clang:-fshow-skipped-includes",
@@ -1565,7 +1560,7 @@
 
   # Tells the compiler not to use absolute paths when passing the default
   # paths to the tools it invokes. We don't want this because we don't
-  # really need it and it can mess up the goma cache entries.
+  # really need it and it can mess up the RBE cache entries.
   if (is_clang && (!is_nacl || is_nacl_saigo)) {
     cflags += [ "-no-canonical-prefixes" ]
 
@@ -1573,7 +1568,7 @@
     # with a relative path and pass relative paths to built-in
     # libraries. Not needed on Windows because we call the linker
     # directly there, not through the compiler driver.
-    # We don't link on goma, so this change is just for cleaner
+    # We don't link on RBE, so this change is just for cleaner
     # internal linker invocations, for people who work on the build.
     if (!is_win) {
       ldflags += [ "-no-canonical-prefixes" ]
@@ -1857,7 +1852,7 @@
     if (!is_nacl || is_nacl_saigo) {
       if (is_win) {
         # TODO(thakis): https://crbug.com/617318
-        # Currently goma can not handle case sensitiveness for windows well.
+        # Currently RBE can not handle case sensitiveness for windows well.
         cflags += [ "-Wno-nonportable-include-path" ]
       }
 
diff --git a/build/config/ios/BUILD.gn b/build/config/ios/BUILD.gn
index 4499283..07a841e 100644
--- a/build/config/ios/BUILD.gn
+++ b/build/config/ios/BUILD.gn
@@ -4,7 +4,6 @@
 
 import("//build/config/ios/ios_sdk.gni")
 import("//build/toolchain/apple/toolchain.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/siso.gni")
 import("//build/toolchain/toolchain.gni")
@@ -100,12 +99,12 @@
 # that is iOS-only. Please see that target for advice on what should go in
 # :runtime_library vs. :compiler.
 config("runtime_library") {
-  # The variable ios_sdk_path is relative to root_build_dir when using Goma RBE
-  # and system Xcode (since Goma RBE only supports paths relative to source).
+  # The variable ios_sdk_path is relative to root_build_dir when using RBE
+  # and system Xcode (since RBE only supports paths relative to source).
   # Rebase the value in that case since gn does not convert paths in compiler
   # flags (since it is not aware they are paths).
   _sdk_root = ios_sdk_path
-  if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+  if (use_system_xcode && (use_remoteexec || use_siso)) {
     _sdk_root = rebase_path(ios_sdk_path, root_build_dir)
   }
 
@@ -256,7 +255,7 @@
 _xctrunner_path =
     "$ios_sdk_platform_path/Developer/Library/Xcode/Agents/XCTRunner.app"
 
-# When building with Goma RBE, $ios_sdk_platform_path corresponds to a symlink
+# When building with RBE, $ios_sdk_platform_path corresponds to a symlink
 # below $root_build_dir that points to the real SDK to use. Because the files
 # are below $root_build_dir, it is not possible to list them as a target input
 # without gn complaining (as it can't find a target creating those files).
@@ -268,7 +267,7 @@
 #
 # To workaround this, add a target that pretends to create those files
 # (but does nothing). See https://crbug.com/1061487 for why this is needed.
-if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+if (use_system_xcode && (use_remoteexec || use_siso)) {
   action("copy_xctrunner_app") {
     testonly = true
     script = "//build/noop.py"
@@ -300,7 +299,7 @@
   # When running under ASan, the ASan runtime library must be packaged alongside
   # the test runner binary.
   deps = [ "//build/config/sanitizers:deps" ]
-  if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+  if (use_system_xcode && (use_remoteexec || use_siso)) {
     deps += [ ":copy_xctrunner_app" ]
   }
 }
diff --git a/build/config/ios/ios_sdk.gni b/build/config/ios/ios_sdk.gni
index f8bc903..fa14938 100644
--- a/build/config/ios/ios_sdk.gni
+++ b/build/config/ios/ios_sdk.gni
@@ -4,7 +4,6 @@
 
 import("//build/config/ios/config.gni")
 import("//build/config/ios/ios_sdk_overrides.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/siso.gni")
 import("//build/toolchain/toolchain.gni")
@@ -95,7 +94,7 @@
       ios_sdk_developer_dir,
     ]
   }
-  if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+  if (use_system_xcode && (use_remoteexec || use_siso)) {
     ios_sdk_info_args += [
       "--create_symlink_at",
       "sdk/xcode_links",
diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni
index 8d2b509..aa936ab 100644
--- a/build/config/ios/rules.gni
+++ b/build/config/ios/rules.gni
@@ -6,7 +6,6 @@
 import("//build/config/apple/symbols.gni")
 import("//build/config/compiler/compiler.gni")
 import("//build/config/ios/ios_sdk.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/siso.gni")
 import("//build/toolchain/toolchain.gni")
@@ -338,10 +337,10 @@
     if (defined(invoker.extra_system_frameworks)) {
       # All framework in extra_system_frameworks are expected to be system
       # framework and the path to be already system absolute so do not use
-      # rebase_path here unless using Goma RBE and system Xcode (as in that
+      # rebase_path here unless using RBE and system Xcode (as in that
       # case the system framework are found via a symlink in root_build_dir).
       foreach(_framework, invoker.extra_system_frameworks) {
-        if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+        if (use_system_xcode && (use_remoteexec || use_siso)) {
           _framework_path = rebase_path(_framework, root_build_dir)
         } else {
           _framework_path = _framework
@@ -1932,7 +1931,7 @@
              "-o=" + rebase_path(_output_name, root_build_dir),
            ] + rebase_path(sources, root_build_dir)
 
-    if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+    if (use_system_xcode && (use_remoteexec || use_siso)) {
       deps = [ "//build/config/ios:copy_xctrunner_app" ]
     }
   }
@@ -1965,7 +1964,7 @@
 
     outputs = [ "{{bundle_contents_dir}}/PkgInfo" ]
 
-    if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+    if (use_system_xcode && (use_remoteexec || use_siso)) {
       public_deps = [ "//build/config/ios:copy_xctrunner_app" ]
     }
   }
diff --git a/build/config/mac/BUILD.gn b/build/config/mac/BUILD.gn
index 73f50ea..c84841c 100644
--- a/build/config/mac/BUILD.gn
+++ b/build/config/mac/BUILD.gn
@@ -6,7 +6,6 @@
 import("//build/config/c++/c++.gni")
 import("//build/config/mac/mac_sdk.gni")
 import("//build/config/sysroot.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/siso.gni")
 
@@ -88,7 +87,7 @@
   }
 }
 
-# When building with Goma, all inputs must be relative to the build directory.
+# When building with RBE, all inputs must be relative to the build directory.
 # If using the system Xcode, which typically resides outside the build root, a
 # symlink to the SDK is created in the build directory, and the path to that
 # link is stored in $mac_sdk_path. If an action references a file in the SDK as
@@ -100,8 +99,8 @@
 #
 # The symbolic link for $mac_sdk_path is set up by
 # //build/config/apple/sdk_info.py in //build/config/mac/mac_sdk.gni.
-if (use_system_xcode && (use_goma || use_remoteexec || use_siso) &&
-    target_os == "mac" && current_toolchain == default_toolchain) {
+if (use_system_xcode && (use_remoteexec || use_siso) && target_os == "mac" &&
+    current_toolchain == default_toolchain) {
   action("sdk_inputs") {
     script = "//build/noop.py"
     outputs = [
diff --git a/build/config/mac/mac_sdk.gni b/build/config/mac/mac_sdk.gni
index 7025bdf..44a9c52 100644
--- a/build/config/mac/mac_sdk.gni
+++ b/build/config/mac/mac_sdk.gni
@@ -5,7 +5,6 @@
 import("//build/config/chrome_build.gni")
 import("//build/config/gclient_args.gni")
 import("//build/config/mac/mac_sdk_overrides.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/siso.gni")
 import("//build/toolchain/toolchain.gni")
@@ -90,9 +89,9 @@
   ]
 }
 
-# Goma RBE requires paths relative to source directory. When using system
+# RBE requires paths relative to source directory. When using system
 # Xcode, this is done by creating symbolic links in root_build_dir.
-if (use_system_xcode && (use_goma || use_remoteexec || use_siso)) {
+if (use_system_xcode && (use_remoteexec || use_siso)) {
   sdk_info_args += [
     "--get_sdk_info",
     "--create_symlink_at",
@@ -106,8 +105,7 @@
 _mac_sdk_result = exec_script(script_name, sdk_info_args, "scope")
 xcode_version = _mac_sdk_result.xcode_version
 xcode_build = _mac_sdk_result.xcode_build
-if (mac_sdk_path == "" && use_system_xcode &&
-    (use_goma || use_remoteexec || use_siso)) {
+if (mac_sdk_path == "" && use_system_xcode && (use_remoteexec || use_siso)) {
   mac_sdk_path = _mac_sdk_result.sdk_path
 }
 
diff --git a/build/config/pch.gni b/build/config/pch.gni
index fa33a28..d7546f9 100644
--- a/build/config/pch.gni
+++ b/build/config/pch.gni
@@ -2,16 +2,14 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/siso.gni")
 
 declare_args() {
   # Precompiled header file support is by default available,
-  # but for distributed build system uses (like goma, rbe, or siso) or when
+  # but for distributed build system uses (like rbe, or siso) or when
   # doing official builds it is off by default.
   # On Linux it slows down the build, so don't enable it by default.
   enable_precompiled_headers =
-      !is_official_build && !(use_goma || use_remoteexec || use_siso) &&
-      !is_linux
+      !is_official_build && !(use_remoteexec || use_siso) && !is_linux
 }
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index 39da6404..0d6871e 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -11,7 +11,6 @@
 import("//build/config/win/control_flow_guard.gni")
 import("//build/config/win/visual_studio_version.gni")
 import("//build/timestamp.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/toolchain.gni")
 
@@ -132,8 +131,8 @@
 
     # Enable ANSI escape codes if something emulating them is around (cmd.exe
     # doesn't understand ANSI escape codes by default). Make sure to not enable
-    # this if goma/remoteexec is in use, because this will lower cache hits.
-    if (!use_goma && !use_remoteexec &&
+    # this if remoteexec is in use, because this will lower cache hits.
+    if (!use_remoteexec &&
         exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
         "True") {
       cflags += [ "-fansi-escape-codes" ]
@@ -145,7 +144,7 @@
   }
 
   # Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
-  if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
+  if (use_lld && !use_thin_lto && cc_wrapper == "") {
     # /Brepro lets the compiler not write the mtime field in the .obj output.
     # link.exe /incremental relies on this field to work correctly, but lld
     # never looks at this timestamp, so it's safe to pass this flag with
diff --git a/build/sample_arg_file.gn b/build/sample_arg_file.gn
index 91e9045..2f8da8c 100644
--- a/build/sample_arg_file.gn
+++ b/build/sample_arg_file.gn
@@ -3,4 +3,4 @@
 #   is_component_build = true
 #   is_debug = true
 #   symbol_level = 2
-#   use_goma = false
+#   use_remoteexec = false
diff --git a/build/toolchain/apple/toolchain.gni b/build/toolchain/apple/toolchain.gni
index c22bc67..aeb9cbb 100644
--- a/build/toolchain/apple/toolchain.gni
+++ b/build/toolchain/apple/toolchain.gni
@@ -12,7 +12,6 @@
 import("//build/config/coverage/coverage.gni")
 import("//build/config/rust.gni")
 import("//build/toolchain/cc_wrapper.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/toolchain.gni")
 import("//build_overrides/build.gni")
@@ -115,7 +114,7 @@
       host_toolchain = host_toolchain
     }
 
-    # When the invoker has explicitly overridden use_goma or cc_wrapper in the
+    # When the invoker has explicitly overridden cc_wrapper in the
     # toolchain args, use those values, otherwise default to the global one.
     # This works because the only reasonable override that toolchains might
     # supply for these values are to force-disable them.
@@ -124,22 +123,13 @@
     } else {
       toolchain_uses_remoteexec = use_remoteexec
     }
-    if (defined(toolchain_args.use_goma)) {
-      toolchain_uses_goma = toolchain_args.use_goma
-    } else {
-      toolchain_uses_goma = use_goma
-    }
     if (defined(toolchain_args.cc_wrapper)) {
       toolchain_cc_wrapper = toolchain_args.cc_wrapper
     } else {
       toolchain_cc_wrapper = cc_wrapper
     }
-    assert(!(toolchain_uses_remoteexec && toolchain_uses_goma),
-           "Goma and re-client can't be used together.")
     assert(!(toolchain_cc_wrapper != "" && toolchain_uses_remoteexec),
            "re-client and cc_wrapper can't be used together.")
-    assert(!(toolchain_cc_wrapper != "" && toolchain_uses_goma),
-           "Goma and cc_wrapper can't be used together.")
 
     if (defined(toolchain_args.use_lld)) {
       toolchain_uses_lld = toolchain_args.use_lld
@@ -178,13 +168,6 @@
 
       # C/C++ (clang) rewrapper prefix to use when use_remoteexec is true.
       compiler_prefix = "${rbe_bin_dir}/rewrapper -cfg=${toolchain_rbe_cc_cfg_file}${rbe_bug_326584510_missing_inputs} -exec_root=${rbe_exec_root} "
-    } else if (toolchain_uses_goma) {
-      assert(toolchain_cc_wrapper == "",
-             "Goma and cc_wrapper can't be used together.")
-      compiler_prefix = "$goma_dir/gomacc "
-      if (use_goma_rust) {
-        rust_compiler_prefix = compiler_prefix
-      }
     } else if (toolchain_cc_wrapper != "") {
       compiler_prefix = toolchain_cc_wrapper + " "
     } else {
diff --git a/build/toolchain/cc_wrapper.gni b/build/toolchain/cc_wrapper.gni
index d70fa7f2..7e3a805 100644
--- a/build/toolchain/cc_wrapper.gni
+++ b/build/toolchain/cc_wrapper.gni
@@ -2,7 +2,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 
 # Defines the configuration of cc wrapper
@@ -37,7 +36,5 @@
   cc_wrapper = ""
 }
 
-assert(!use_goma || cc_wrapper == "",
-       "use_goma and cc_wrapper can not be used together.")
 assert(!use_remoteexec || cc_wrapper == "",
        "use_remoteexec and cc_wrapper can not be used together.")
diff --git a/build/toolchain/win/toolchain.gni b/build/toolchain/win/toolchain.gni
index de45c13e..9041eb7b 100644
--- a/build/toolchain/win/toolchain.gni
+++ b/build/toolchain/win/toolchain.gni
@@ -8,7 +8,6 @@
 import("//build/config/sanitizers/sanitizers.gni")
 import("//build/config/win/visual_studio_version.gni")
 import("//build/toolchain/cc_wrapper.gni")
-import("//build/toolchain/goma.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/toolchain.gni")
 import("//build/toolchain/win/win_toolchain_data.gni")
@@ -53,8 +52,8 @@
       toolchain_is_clang = is_clang
     }
 
-    # When the invoker has explicitly overridden use_goma or cc_wrapper in the
-    # toolchain args, use those values, otherwise default to the global one.
+    # When the invoker has explicitly overridden use_remoteexec or cc_wrapper in
+    # the toolchain args, use those values, otherwise default to the global one.
     # This works because the only reasonable override that toolchains might
     # supply for these values are to force-disable them.
     if (defined(toolchain_args.use_remoteexec)) {
@@ -62,22 +61,13 @@
     } else {
       toolchain_uses_remoteexec = use_remoteexec
     }
-    if (defined(toolchain_args.use_goma)) {
-      toolchain_uses_goma = toolchain_args.use_goma
-    } else {
-      toolchain_uses_goma = use_goma
-    }
     if (defined(toolchain_args.cc_wrapper)) {
       toolchain_cc_wrapper = toolchain_args.cc_wrapper
     } else {
       toolchain_cc_wrapper = cc_wrapper
     }
-    assert(!(toolchain_uses_remoteexec && toolchain_uses_goma),
-           "Goma and re-client can't be used together.")
     assert(!(toolchain_cc_wrapper != "" && toolchain_uses_remoteexec),
            "re-client and cc_wrapper can't be used together.")
-    assert(!(toolchain_cc_wrapper != "" && toolchain_uses_goma),
-           "Goma and cc_wrapper can't be used together.")
 
     if (toolchain_uses_remoteexec) {
       if (toolchain_is_clang) {
@@ -85,8 +75,6 @@
       } else {
         cl_prefix = ""
       }
-    } else if (toolchain_uses_goma) {
-      cl_prefix = "${goma_dir}/gomacc${_exe} "
     } else if (toolchain_cc_wrapper != "" && toolchain_is_clang) {
       cl_prefix = toolchain_cc_wrapper + " "
     } else {