• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Bazel Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 package com.google.devtools.common.options;
15 
16 /**
17  * The priority of option values, in order of increasing priority.
18  *
19  * <p>In general, new values for options can only override values with a lower or
20  * equal priority. Option values provided in annotations in an options class are
21  * implicitly at the priority {@code DEFAULT}.
22  *
23  * <p>The ordering of the priorities is the source-code order. This is consistent
24  * with the automatically generated {@code compareTo} method as specified by the
25  * Java Language Specification. DO NOT change the source-code order of these
26  * values, or you will break code that relies on the ordering.
27  */
28 public enum OptionPriority {
29 
30   /**
31    * The priority of values specified in the {@link Option} annotation. This
32    * should never be specified in calls to {@link OptionsParser#parse}.
33    */
34   DEFAULT,
35 
36   /**
37    * Overrides default options at runtime, while still allowing the values to be
38    * overridden manually.
39    */
40   COMPUTED_DEFAULT,
41 
42   /**
43    * For options coming from a configuration file or rc file.
44    */
45   RC_FILE,
46 
47   /**
48    * For options coming from the command line.
49    */
50   COMMAND_LINE,
51 
52   /**
53    * For options coming from invocation policy.
54    */
55   INVOCATION_POLICY,
56 
57   /**
58    * This priority can be used to unconditionally override any user-provided options.
59    * This should be used rarely and with caution!
60    */
61   SOFTWARE_REQUIREMENT;
62 }
63