• 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
23
24class LoadInterface(ServiceInterface):
25
26    def __init__(self):
27        super().__init__()
28        self._config = Config()
29
30    @abstractmethod
31    def __post_init__(self):
32        pass
33
34    @property
35    def config(self):
36        return self._config
37
38    @property
39    def outputs(self):
40        return self._outputs
41
42    def regist_arg(self, arg_name: str, arg_value: str):
43        if arg_name in self._args_dict.keys() and self._args_dict[arg_name] != arg_value:
44            LogUtil.hb_warning('duplicated regist arg {}, the original value "{}" will be replace to "{}"'.format(
45                arg_name, self._args_dict[arg_name], arg_value))
46
47        self._args_dict[arg_name] = arg_value
48
49    def run(self):
50        self.__post_init__()
51        self._execute_loader_args_display()
52        self._check_parts_config_info()
53        self._generate_subsystem_configs()
54        self._generate_target_platform_parts()
55        self._generate_system_capabilities()
56        self._generate_stub_targets()
57        self._generate_platforms_part_by_src()
58        self._generate_target_gn()
59        self._generate_phony_targets_build_file()
60        self._generate_required_parts_targets()
61        self._generate_required_parts_targets_list()
62        self._generate_src_flag()
63        self._generate_auto_install_part()
64        self._generate_platforms_list()
65        self._generate_part_different_info()
66        self._generate_infos_for_testfwk()
67        self._check_product_part_feature()
68        self._generate_syscap_files()
69        self._cropping_components()
70
71    @abstractmethod
72    def _execute_loader_args_display(self):
73        pass
74
75    @abstractmethod
76    def _check_parts_config_info(self):
77        pass
78
79    @abstractmethod
80    def _generate_subsystem_configs(self):
81        pass
82
83    @abstractmethod
84    def _generate_target_platform_parts(self):
85        pass
86
87    @abstractmethod
88    def _generate_system_capabilities(self):
89        pass
90
91    @abstractmethod
92    def _generate_stub_targets(self):
93        pass
94
95    @abstractmethod
96    def _generate_platforms_part_by_src(self):
97        pass
98
99    @abstractmethod
100    def _generate_target_gn(self):
101        pass
102
103    @abstractmethod
104    def _cropping_components(self):
105        pass
106
107    @abstractmethod
108    def _generate_phony_targets_build_file(self):
109        pass
110
111    @abstractmethod
112    def _generate_required_parts_targets(self):
113        pass
114
115    @abstractmethod
116    def _generate_required_parts_targets_list(self):
117        pass
118
119    @abstractmethod
120    def _generate_src_flag(self):
121        pass
122
123    @abstractmethod
124    def _generate_auto_install_part(self):
125        pass
126
127    @abstractmethod
128    def _generate_platforms_list(self):
129        pass
130
131    @abstractmethod
132    def _generate_part_different_info(self):
133        pass
134
135    @abstractmethod
136    def _generate_infos_for_testfwk(self):
137        pass
138
139    @abstractmethod
140    def _check_product_part_feature(self):
141        pass
142
143    @abstractmethod
144    def _generate_syscap_files(self):
145        pass
146