// Copyright 2020 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
syntax = "proto3";

package recipe_modules.pigweed.checkout;

message EquivalentRemotes {
  // List of remotes that should be considered equivalent to each other.
  repeated string remotes = 1;
}

message Rewrite {
  // Configure git to rewrite all URLs with a prefix of original to final.
  string original = 1;
  string final = 2;
}

message Options {
  // Path to remote repository. (Default:
  // "https://pigweed.googlesource.com/pigweed/pigweed")
  string remote = 1;

  // Branch of remote repository. (Default: "main")
  string branch = 2;

  // Is this repository an Android Repo Tool manifest? (Default: False)
  bool use_repo = 3;

  // Name of Android Repo Tool manifest file. (Default: "default.xml")
  string manifest_file = 4;

  // Automatically initialize submodules. Ignored if included_submodules or
  // excluded_submodules is set.
  bool initialize_submodules = 5;

  // Timeouts for repo (which sometimes hangs). If 0 uses default of 20 for
  // init and 120 for sync. Cannot be disabled, but int32 supports some really
  // large values. If number of attempts is 0 it's set to 3.
  int32 repo_init_timeout_sec = 6;
  int32 repo_sync_timeout_sec = 7;
  int32 number_of_attempts = 8;

  // In try builds CLs are rebased by default. In ci builds they are not. This
  // option prevents rebasing on try builds.
  bool force_no_rebase = 9;

  // If a tryjob is triggered by a CL on branch 'foo', try to use branch 'foo'
  // of any superprojects or manifests containing the CL's repo as a submodule
  // or project. (Note: branch matching is not yet implemented for submodules.)
  bool match_branch = 10;

  // Timeout for 'git submodule update --init --recursive'. Default is
  // 10 minutes.
  int32 submodule_timeout_sec = 11;

  // Use buildbucket trigger data.
  bool use_trigger = 12;

  // Lists of remotes that should be considered equivalent to each other.
  // This is intended to be used with branches that are automatically kept in
  // sync across Gerrit hosts, so a CL in one will be understood to apply to a
  // submodule or Android Repo Tool project with the other as the remote.
  //
  // Example:
  // [
  //     [
  //         "https://a.googlesource.com/foo",
  //         "https://b.googlesource.com/foo",
  //         "https://c.googlesource.com/foo",
  //     ],
  //     [
  //         "https://d.googlesource.com/bar",
  //         "https://e.googlesource.com/bar",
  //     ],
  // ]
  //
  // In this case a/foo, b/foo, and c/foo are all mirrors of each other, as
  // well as d/bar and e/bar, but a/foo and d/bar are unrelated.
  //
  // See also http://go/gob-ctl#copying-git-repository.
  repeated EquivalentRemotes equivalent_remotes = 13;

  // Subdirectory of checkout in which commands should be executed. Uncommon.
  string root_subdirectory = 14;

  // Do not use a cache of the checkout.
  bool do_not_cache = 15;

  // Instead of including all submodules (initialize_submodules == false) or
  // including no submodules (initialize_submodules == true), initialize a
  // subset of the submodules present in the source tree. Setting both of these
  // is not permitted.
  repeated string included_submodules = 16;
  repeated string excluded_submodules = 17;

  // Disable downloading precomputed packfiles from a CDN.
  bool do_not_use_packfiles = 18;

  // Limit the Android Repo Tool checkout to these groups from the manifest
  // file.
  repeated string manifest_groups = 19;

  // Rewrites of Git remotes.
  repeated Rewrite rewrites = 20;

  // Attempt to patch Bazel projects in the given files.
  repeated string eligible_workspace_paths = 21;
}
