Respect GOMA_DIR in autoninja instead of always assuming .cipd_bin.

Chromium + Fuchsia + Flutter Engine tools use GOMA_DIR to determine the
location of goma's scripts and binaries. Goma installs track some state
separately, and so when a different goma distribution's `compiler_proxy`
is launched and autoninja attempts to run `.cipd_bin/gomacc port`, the
check fails even though goma is running.

Additional context:
https://github.com/flutter/flutter/issues/81510#issuecomment-839489061
Change-Id: I93775628c6efba62bb226ac1995301c3ae7f5fa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2891250
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Brandon DeRosier <bdero@google.com>
diff --git a/autoninja.py b/autoninja.py
index 424cebb..58bb3af 100755
--- a/autoninja.py
+++ b/autoninja.py
@@ -121,7 +121,8 @@
 
 if use_goma:
   gomacc_file = 'gomacc.exe' if sys.platform.startswith('win') else 'gomacc'
-  gomacc_path = os.path.join(SCRIPT_DIR, '.cipd_bin', gomacc_file)
+  goma_dir = os.environ.get('GOMA_DIR', os.path.join(SCRIPT_DIR, '.cipd_bin'))
+  gomacc_path = os.path.join(goma_dir, gomacc_file)
   # Don't invoke gomacc if it doesn't exist.
   if os.path.exists(gomacc_path):
     # Check to make sure that goma is running. If not, don't start the build.