Merge "Move VarType out of its respective outer classes."
diff --git a/tools/product_config/src/com/android/build/config/ConfigBase.java b/tools/product_config/src/com/android/build/config/ConfigBase.java
index eb21219..9a81011 100644
--- a/tools/product_config/src/com/android/build/config/ConfigBase.java
+++ b/tools/product_config/src/com/android/build/config/ConfigBase.java
@@ -46,15 +46,6 @@
*/
protected final TreeMap<String, VarType> mProductVars = new TreeMap();
- /**
- * Whether a product config variable is a list or single-value variable.
- */
- public enum VarType {
- LIST,
- SINGLE,
- UNKNOWN // For non-product vars
- }
-
public void setPhase(String phase) {
mPhase = phase;
}
@@ -112,7 +103,7 @@
public void copyFrom(ConfigBase that) {
setPhase(that.getPhase());
setRootNodes(that.getRootNodes());
- for (Map.Entry<String, ConfigBase.VarType> entry: that.getProductVars().entrySet()) {
+ for (Map.Entry<String, VarType> entry: that.getProductVars().entrySet()) {
addProductVar(entry.getKey(), entry.getValue());
}
mInitialVariables = new HashMap(that.getInitialVariables());
diff --git a/tools/product_config/src/com/android/build/config/ConvertMakeToGenericConfig.java b/tools/product_config/src/com/android/build/config/ConvertMakeToGenericConfig.java
index 369d4d6..ca31cd5 100644
--- a/tools/product_config/src/com/android/build/config/ConvertMakeToGenericConfig.java
+++ b/tools/product_config/src/com/android/build/config/ConvertMakeToGenericConfig.java
@@ -107,7 +107,7 @@
* Converts one variable from a MakeConfig Block into a GenericConfig Assignment.
*/
GenericConfig.Assign convertAssignment(MakeConfig.BlockType blockType, Str inheritedFile,
- ConfigBase.VarType varType, String varName, Str varVal, Str prevVal) {
+ VarType varType, String varName, Str varVal, Str prevVal) {
if (prevVal == null) {
// New variable.
return new GenericConfig.Assign(varName, varVal);
@@ -120,7 +120,7 @@
// Product vars have the @inherit processing. Other vars we
// will just ignore and put in one section at the end, based
// on the difference between the BEFORE and AFTER blocks.
- if (varType == ConfigBase.VarType.UNKNOWN) {
+ if (varType == VarType.UNKNOWN) {
if (blockType == MakeConfig.BlockType.AFTER) {
// For UNKNOWN variables, we don't worry about the
// intermediate steps, just take the final value.
diff --git a/tools/product_config/src/com/android/build/config/DumpConfigParser.java b/tools/product_config/src/com/android/build/config/DumpConfigParser.java
index 06663ca..6da96c1 100644
--- a/tools/product_config/src/com/android/build/config/DumpConfigParser.java
+++ b/tools/product_config/src/com/android/build/config/DumpConfigParser.java
@@ -140,8 +140,7 @@
System.out.println(" " + makeConfig.getRootNodes());
}
} else if (matchLineType(line, "var", 2)) {
- final MakeConfig.VarType type = "list".equals(fields.get(1))
- ? MakeConfig.VarType.LIST : MakeConfig.VarType.SINGLE;
+ final VarType type = "list".equals(fields.get(1)) ? VarType.LIST : VarType.SINGLE;
makeConfig.addProductVar(fields.get(2), type);
if (DEBUG) {
diff --git a/tools/product_config/src/com/android/build/config/VarType.java b/tools/product_config/src/com/android/build/config/VarType.java
new file mode 100644
index 0000000..43e9366
--- /dev/null
+++ b/tools/product_config/src/com/android/build/config/VarType.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.build.config;
+
+/**
+ * Whether a product config variable is a list or single-value variable.
+ */
+public enum VarType {
+ /**
+ * A product config variable that is a list of space separated strings.
+ * These are defined by _product_single_value_vars in product.mk.
+ */
+ LIST,
+
+ /**
+ * A product config varaible that is a single string.
+ * These are defined by _product_list_vars in product.mk.
+ */
+ SINGLE,
+
+ /**
+ * A variable that is given the special product config handling but is
+ * nonetheless defined by product config makefiles.
+ */
+ UNKNOWN
+}
+