• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.build.config;
18 
19 import java.lang.reflect.Field;
20 import java.io.PrintStream;
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.List;
25 import java.util.Map;
26 
27 /**
28  * Error constants and error reporting.
29  * <p>
30  * <b>Naming Convention:</b>
31  * <ul>
32  *  <li>ERROR_ for Categories with isLevelSettable false and Level.ERROR
33  *  <li>WARNING_ for Categories with isLevelSettable true and default WARNING or HIDDEN
34  *  <li>Don't have isLevelSettable true and not ERROR. (The constructor asserts this).
35  * </ul>
36  */
37 public class Errors extends ErrorReporter {
38 
39     public final Category ERROR_COMMAND_LINE = new Category(1, false, Level.ERROR,
40             "Error on the command line.");
41 
42     public final Category WARNING_UNKNOWN_COMMAND_LINE_ERROR = new Category(2, true, Level.HIDDEN,
43             "Passing unknown errors on the command line.  Hidden by default for\n"
44             + "forward compatibility.");
45 
46     public final Category ERROR_KATI = new Category(3, false, Level.ERROR,
47             "Error executing or reading from Kati.");
48 
49     public final Category WARNING_DUMPCONFIG = new Category(4, true, Level.WARNING,
50             "Anomaly parsing the output of kati and dumpconfig.mk.");
51 
52     public final Category ERROR_DUMPCONFIG = new Category(5, false, Level.ERROR,
53             "Error parsing the output of kati and dumpconfig.mk.");
54 
55     public final Category WARNING_VARIABLE_RECURSION = new Category(6, true, Level.WARNING,
56             "Possible unsupported variable recursion.");
57 
58     // This could be a warning, but it's very likely that the data is corrupted somehow
59     // if we're seeing this.
60     public final Category ERROR_IMPROPER_PRODUCT_VAR_MARKER = new Category(7, true, Level.ERROR,
61             "Bad input from dumpvars causing corrupted product variables.");
62 
63     public final Category ERROR_MISSING_CONFIG_FILE = new Category(8, true, Level.ERROR,
64             "Unable to find config file.");
65 
66     public final Category ERROR_INFINITE_RECURSION = new Category(9, true, Level.ERROR,
67             "A file tries to inherit-product from itself or its own inherited products.");
68 
69     // TODO: This will become obsolete when it is possible to have starlark-based product
70     // config files.
71     public final Category WARNING_DIFFERENT_FROM_KATI = new Category(1000, true, Level.WARNING,
72             "The cross-check with the original kati implementation failed.");
73 
74 }
75