// Copyright 2023 Google LLC
//
// 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
//
//     http://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 proxy;

option go_package = "github.com/bazelbuild/reclient/api/proxy";

// A collection of rules. If any of the rule decides to ignore a mismatch, the
// mismatch will be marked as ignored.
message MismatchIgnoreConfig {
  repeated Rule rules = 1;
}

// A rule defines the logic of how to check whether a mismatch can be ignored or
// not.
message Rule {
  oneof rule_spec {
    OutputFilePathRuleSpec output_file_path_rule_spec = 1;
  }
}

// Output file path rule will be matched if an action with diffs contains any
// output file of which the path matches the pattern.
message OutputFilePathRuleSpec {
  RegexPattern path_pattern = 1;
}

// Represents a regex pattern.
message RegexPattern {
  // The regular expression
  string expression = 1;

  // Denotes if the pattern is inverted, i.e if the regular expression
  // will match everything except the above expression.
  bool inverted = 2;
}
