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 <algorithm> 19 #include <map> 20 #include <string> 21 #include <vector> 22 23 namespace android { 24 namespace linkerconfig { 25 namespace modules { 26 struct ApexInfo { 27 std::string name; 28 std::string namespace_name; 29 std::string path; 30 std::vector<std::string> provide_libs; 31 std::vector<std::string> require_libs; 32 bool has_bin; 33 bool has_lib; 34 35 ApexInfo() = default; // for std::map::operator[] ApexInfoApexInfo36 ApexInfo(std::string name, std::string path, 37 std::vector<std::string> provide_libs, 38 std::vector<std::string> require_libs, bool has_bin, bool has_lib) 39 : name(std::move(name)), 40 path(std::move(path)), 41 provide_libs(std::move(provide_libs)), 42 require_libs(std::move(require_libs)), 43 has_bin(has_bin), 44 has_lib(has_lib) { 45 this->namespace_name = this->name; 46 std::replace( 47 this->namespace_name.begin(), this->namespace_name.end(), '.', '_'); 48 } 49 }; 50 51 std::map<std::string, ApexInfo> ScanActiveApexes(const std::string& root); 52 } // namespace modules 53 } // namespace linkerconfig 54 } // namespace android