# Copyright 2013 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Defines the configuration of Goma.

import("//build/toolchain/siso.gni")

declare_args() {
  # Set to true to enable distributed compilation using Goma.
  use_goma = false

  # Absolute directory containing the gomacc binary.
  goma_dir = ""
}

if (use_goma && goma_dir == "") {
  goma_dir = exec_script("get_goma_dir.py", [], "string")
}

assert(!is_win || !use_goma || is_clang,
       "cl.exe does not work on goma, use clang")

if (use_goma && current_toolchain == default_toolchain) {
  if (host_os == "win") {
    print("The gn arg use_goma=true will be deprecated by EOY 2023. " +
          "Please use `use_remoteexec=true` instead. See " +
          "https://chromium.googlesource.com/chromium/src/+/main/docs/" +
          "windows_build_instructions.md#use-reclient " +
          "for setup instructions.")
  } else if (host_os == "mac") {
    print("The gn arg use_goma=true will be deprecated by EOY 2023. " +
          "Please use `use_remoteexec=true` instead. " +
          "If you are a googler see http://go/building-chrome-mac" +
          "#using-remote-execution for setup instructions.")
  } else {
    print("The gn arg use_goma=true will be deprecated by EOY 2023. " +
          "Please use `use_remoteexec=true` instead. See " +
          "https://chromium.googlesource.com/chromium/src/+/main/docs/" +
          "linux/build_instructions.md#use-reclient for setup instructions.")
  }
  assert(!use_siso,
         "Siso does not support Goma. Use use_remoteexec=true instead.")
}