• 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 #include "linkerconfig/basecontext.h"
18 
19 namespace android {
20 namespace linkerconfig {
21 namespace modules {
BaseContext()22 BaseContext::BaseContext() : strict_(false) {
23 }
24 
AddApexModule(ApexInfo apex_module)25 void BaseContext::AddApexModule(ApexInfo apex_module) {
26   apex_modules_.push_back(std::move(apex_module));
27 }
28 
GetApexModules() const29 const std::vector<ApexInfo>& BaseContext::GetApexModules() const {
30   return apex_modules_;
31 }
32 
SetStrictMode(bool strict)33 void BaseContext::SetStrictMode(bool strict) {
34   strict_ = strict;
35 }
36 
IsStrictMode() const37 bool BaseContext::IsStrictMode() const {
38   return strict_;
39 }
40 
BuildApexNamespace(const ApexInfo & apex_info,bool visible) const41 Namespace BaseContext::BuildApexNamespace(const ApexInfo& apex_info,
42                                           bool visible) const {
43   Namespace ns(apex_info.namespace_name,
44                /*is_isolated=*/true,
45                visible);
46   InitializeWithApex(ns, apex_info);
47   return ns;
48 }
49 
SetSystemConfig(const android::linkerconfig::proto::LinkerConfig & config)50 void BaseContext::SetSystemConfig(
51     const android::linkerconfig::proto::LinkerConfig& config) {
52   system_provide_libs_ = {config.providelibs().begin(),
53                           config.providelibs().end()};
54   system_require_libs_ = {config.requirelibs().begin(),
55                           config.requirelibs().end()};
56 }
GetSystemProvideLibs() const57 const std::vector<std::string>& BaseContext::GetSystemProvideLibs() const {
58   return system_provide_libs_;
59 }
GetSystemRequireLibs() const60 const std::vector<std::string>& BaseContext::GetSystemRequireLibs() const {
61   return system_require_libs_;
62 }
63 
64 }  // namespace modules
65 }  // namespace linkerconfig
66 }  // namespace android
67