// Copyright 2015 The Bazel Authors. All rights reserved.
//
// 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 = "proto2";

package devtools.xcode;
option java_outer_classname = "PlMergeProtos";
option java_package = "com.google.devtools.build.xcode.plmerge.proto";

// Contains necessary arguments for PlMerge, which is responsible for merging
// plist files.
// Next Id: 9
message Control {
  // Formats that plmerge can output to.
  enum OutputFormat {
    BINARY = 1;
    XML = 2;
  }

  // Paths to the plist files to merge relative to execution root.
  repeated string source_file = 1;

  // Paths to plist files to merge relative to execution root.  Unlike
  // source_file, these keys cannot be overwritten by other plists.
  // Plmerge will throw an error if any of these keys occur more than once.
  repeated string immutable_source_file = 6;

  // Path to the output file to merge relative to execution root.
  required string out_file = 2;

  // Output format of the resulting plist file.
  optional OutputFormat output_format = 8 [default = BINARY];

  // Key-value substitutions to support templating for plists.  A substitution
  // is made if the substitution key appears as a value for any key-value pair
  // in any source_file.
  // For example, a plist with the entry:
  //    <key>CFBundleExecutable</key>
  //    <string>EXECUTABLE_NAME</string>
  // could be templated by passing a variable substitution like
  //    {"EXECUTABLE_NAME", "PrenotCalculator"}
  map<string, string> variable_substitution_map = 3;

  // A reverse-DNS string identifier for this bundle associated with output
  // binary plist.  Overrides the bundle id specified in the CFBundleIdentifier
  // plist field.
  optional string primary_bundle_id = 4;

  // A fallback reverse-DNS string identifier for this bundle when bundle
  // identifier is not specified in primary_bundle_id or an associated plist
  // file.
  optional string fallback_bundle_id = 5;

  // Name of executable for the bundle this merged plist is intended for, or
  // unset if no such executable exists.  If a value for CFBundleExecutable is
  // given in a source_file or immutable_source_file, that value mut not
  // conflict with this key.
  optional string executable_name = 7;
}
