Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c76c3d1 authored by Joe Onorato's avatar Joe Onorato Committed by Gerrit Code Review
Browse files

Merge "Move VarType out of its respective outer classes."

parents d81abe74 25902060
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -46,15 +46,6 @@ public class ConfigBase {
     */
    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 class ConfigBase {
    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());
+2 −2
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ public class ConvertMakeToGenericConfig {
     * 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 @@ public class ConvertMakeToGenericConfig {
                // 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.
+1 −2
Original line number Diff line number Diff line
@@ -140,8 +140,7 @@ public class DumpConfigParser {
                    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) {
+41 −0
Original line number Diff line number Diff line
/*
 * 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
}