• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     bool is_public;
25 };
26 
27 class InnerApiPublicInfoGenerator {
28 public:
29     bool GeneratedInnerapiPublicInfo(const std::vector<const Target*>& items, Err *err);
30 
getInstance()31     static InnerApiPublicInfoGenerator *getInstance()
32     {
33         return instance_;
34     }
35 
Init(const std::string & build_dir,int checkType)36     static void Init(const std::string &build_dir, int checkType)
37     {
38         if (instance_ != nullptr) {
39             return;
40         }
41         instance_ = new InnerApiPublicInfoGenerator(build_dir, checkType);
42     }
43 
44 private:
45     bool ignoreTest_ = true;
46     std::string build_dir_;
47     int checkType_ = OhosComponentChecker::CheckType::NONE;
48     static InnerApiPublicInfoGenerator *instance_;
49     void DoGeneratedInnerapiPublicInfo(const Target *target, const OhosComponentChecker *checker, Err *err);
InnerApiPublicInfoGenerator(const std::string & build_dir,int checkType)50     InnerApiPublicInfoGenerator(const std::string &build_dir, int checkType)
51     {
52         checkType_ = checkType;
53         build_dir_ = build_dir;
54         if (checkType == OhosComponentChecker::CheckType::SCAN_ALL ||
55             checkType == OhosComponentChecker::CheckType::INTERCEPT_ALL) {
56             ignoreTest_ = false;
57         }
58     }
InnerApiPublicInfoGenerator()59     InnerApiPublicInfoGenerator() {}
60     InnerApiPublicInfoGenerator &operator = (const InnerApiPublicInfoGenerator &) = delete;
61 };
62 
63 #endif // INNERAPIS_PUBLICINFO_GENERATOR_H_
64