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 #pragma once
17 
18 #include <string>
19 #include <vector>
20 
21 #include <linker_config.pb.h>
22 
23 #include "linkerconfig/apex.h"
24 #include "linkerconfig/namespace.h"
25 
26 namespace android {
27 namespace linkerconfig {
28 namespace modules {
29 
30 class BaseContext {
31  public:
32   BaseContext();
33   virtual ~BaseContext() = default;
34 
35   void AddApexModule(ApexInfo apex_module);
36   const std::vector<ApexInfo>& GetApexModules() const;
37 
38   void SetStrictMode(bool strict);
39   bool IsStrictMode() const;
40 
41   virtual Namespace BuildApexNamespace(const ApexInfo& apex_info,
42                                        bool visible) const;
43 
44   void SetSystemConfig(const android::linkerconfig::proto::LinkerConfig& config);
45   const std::vector<std::string>& GetSystemProvideLibs() const;
46   const std::vector<std::string>& GetSystemRequireLibs() const;
47 
48  private:
49   bool strict_;
50 
51   // Available APEX Modules which contains binary and/or library
52   std::vector<ApexInfo> apex_modules_;
53 
54   std::vector<std::string> system_provide_libs_;
55   std::vector<std::string> system_require_libs_;
56 };
57 
58 }  // namespace modules
59 }  // namespace linkerconfig
60 }  // namespace android
61