• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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/link.h"
18 
19 namespace android {
20 namespace linkerconfig {
21 namespace modules {
WriteConfig(ConfigWriter & writer)22 void Link::WriteConfig(ConfigWriter& writer) {
23   writer.SetPrefix("namespace." + origin_namespace_ + ".link." +
24                    target_namespace_);
25   if (allow_all_shared_libs_) {
26     writer.WriteLine(".allow_all_shared_libs = true");
27   } else {
28     bool is_first = true;
29 
30     for (auto& lib_name : shared_libs_) {
31       writer.WriteLine(".shared_libs %s %s",
32                        is_first ? "=" : "+=", lib_name.c_str());
33       is_first = false;
34     }
35   }
36   writer.ResetPrefix();
37 }
38 }  // namespace modules
39 }  // namespace linkerconfig
40 }  // namespace android