1 // Copyright 2024 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef INNERAPIS_PUBLICINFO_GENERATOR_H_ 6 #define INNERAPIS_PUBLICINFO_GENERATOR_H_ 7 8 #include <iostream> 9 10 #include "gn/build_settings.h" 11 #include "gn/config.h" 12 #include "gn/functions.h" 13 #include "gn/ohos_components_checker.h" 14 #include "gn/parse_tree.h" 15 #include "gn/settings.h" 16 #include "gn/substitution_writer.h" 17 #include "gn/target.h" 18 #include "gn/value.h" 19 20 struct PublicConfigInfoParams { 21 const Target *target; 22 std::string label; 23 Err *err; 24 }; 25 26 class InnerApiPublicInfoGenerator { 27 public: 28 void GeneratedInnerapiPublicInfo(Target *target, Label label, Scope *scope, const std::string type, Err *err); 29 getInstance()30 static InnerApiPublicInfoGenerator *getInstance() 31 { 32 return instance_; 33 } 34 Init(const std::string & build_dir,int checkType)35 static void Init(const std::string &build_dir, int checkType) 36 { 37 if (instance_ != nullptr) { 38 return; 39 } 40 instance_ = new InnerApiPublicInfoGenerator(build_dir, checkType); 41 } 42 43 private: 44 bool ignoreTest_ = true; 45 std::string build_dir_; 46 int checkType_ = OhosComponentChecker::CheckType::NONE; 47 static InnerApiPublicInfoGenerator *instance_; InnerApiPublicInfoGenerator(const std::string & build_dir,int checkType)48 InnerApiPublicInfoGenerator(const std::string &build_dir, int checkType) 49 { 50 checkType_ = checkType; 51 build_dir_ = build_dir; 52 if (checkType == OhosComponentChecker::CheckType::SCAN_ALL || 53 checkType == OhosComponentChecker::CheckType::INTERCEPT_ALL) { 54 ignoreTest_ = false; 55 } 56 } InnerApiPublicInfoGenerator()57 InnerApiPublicInfoGenerator() {} 58 InnerApiPublicInfoGenerator &operator = (const InnerApiPublicInfoGenerator &) = delete; 59 }; 60 61 #endif // INNERAPIS_PUBLICINFO_GENERATOR_H_ 62