1 /*
2  * Copyright (C) 2016 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 #ifndef MAKE_H
18 #define MAKE_H
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 using namespace std;
25 
26 struct Module
27 {
28     string name;
29     vector<string> classes;
30     vector<string> paths;
31     vector<string> installed;
32 
33     bool HasClass(const string& cl);
34 };
35 
36 /**
37  * Class to encapsulate getting build variables. Caches the
38  * results if possible.
39  */
40 class BuildVars
41 {
42 public:
43     BuildVars(const string& outDir, const string& buildProduct,
44             const string& buildVariant, const string& buildType);
45     ~BuildVars();
46 
47     string GetBuildVar(const string& name, bool quiet);
48 
49 private:
50     void save();
51 
52     string m_filename;
53 
54     map<string,string> m_cache;
55 };
56 
57 void read_modules(const string& buildOut, const string& buildDevice,
58         map<string,Module>* modules, bool quiet);
59 
60 int build_goals(const vector<string>& goals);
61 
62 #endif // MAKE_H
63