• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4#
5# Copyright (c) 2023 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18from abc import abstractmethod
19from services.interface.service_interface import ServiceInterface
20from resources.config import Config
21from util.log_util import LogUtil
22
23class LoadInterface(ServiceInterface):
24
25    def __init__(self):
26        super().__init__()
27        self._config = Config()
28
29    @property
30    def config(self):
31        return self._config
32
33    @property
34    def outputs(self):
35        return self._outputs
36
37    def regist_arg(self, arg_name: str, arg_value: str):
38        if arg_name in self._args_dict.keys() and self._args_dict[arg_name] != arg_value:
39            LogUtil.hb_warning('duplicated regist arg {}, the original value "{}" will be replace to "{}"'.format(
40                arg_name, self._args_dict[arg_name], arg_value))
41
42        self._args_dict[arg_name] = arg_value
43
44    def run(self):
45        self.__post_init__()
46        self._execute_loader_args_display()
47        self._check_parts_config_info()
48        self._generate_subsystem_configs()
49        self._generate_target_platform_parts()
50        self._generate_system_capabilities()
51        self._generate_stub_targets()
52        self._generate_platforms_part_by_src()
53        self._generate_target_gn()
54        self._generate_phony_targets_build_file()
55        self._generate_required_parts_targets()
56        self._generate_required_parts_targets_list()
57        self._generate_src_flag()
58        self._generate_auto_install_part()
59        self._generate_platforms_list()
60        self._generate_part_different_info()
61        self._generate_infos_for_testfwk()
62        self._check_product_part_feature()
63        self._generate_syscap_files()
64
65    @abstractmethod
66    def __post_init__(self):
67        pass
68
69    @abstractmethod
70    def _execute_loader_args_display(self):
71        pass
72
73    @abstractmethod
74    def _check_parts_config_info(self):
75        pass
76
77    @abstractmethod
78    def _generate_subsystem_configs(self):
79        pass
80
81    @abstractmethod
82    def _generate_target_platform_parts(self):
83        pass
84
85    @abstractmethod
86    def _generate_system_capabilities(self):
87        pass
88
89    @abstractmethod
90    def _generate_stub_targets(self):
91        pass
92
93    @abstractmethod
94    def _generate_platforms_part_by_src(self):
95        pass
96
97    @abstractmethod
98    def _generate_target_gn(self):
99        pass
100
101    @abstractmethod
102    def _generate_phony_targets_build_file(self):
103        pass
104
105    @abstractmethod
106    def _generate_required_parts_targets(self):
107        pass
108
109    @abstractmethod
110    def _generate_required_parts_targets_list(self):
111        pass
112
113    @abstractmethod
114    def _generate_src_flag(self):
115        pass
116
117    @abstractmethod
118    def _generate_auto_install_part(self):
119        pass
120
121    @abstractmethod
122    def _generate_platforms_list(self):
123        pass
124
125    @abstractmethod
126    def _generate_part_different_info(self):
127        pass
128
129    @abstractmethod
130    def _generate_infos_for_testfwk(self):
131        pass
132
133    @abstractmethod
134    def _check_product_part_feature(self):
135        pass
136
137    @abstractmethod
138    def _generate_syscap_files(self):
139        pass
140