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 70 @abstractmethod 71 def _execute_loader_args_display(self): 72 pass 73 74 @abstractmethod 75 def _check_parts_config_info(self): 76 pass 77 78 @abstractmethod 79 def _generate_subsystem_configs(self): 80 pass 81 82 @abstractmethod 83 def _generate_target_platform_parts(self): 84 pass 85 86 @abstractmethod 87 def _generate_system_capabilities(self): 88 pass 89 90 @abstractmethod 91 def _generate_stub_targets(self): 92 pass 93 94 @abstractmethod 95 def _generate_platforms_part_by_src(self): 96 pass 97 98 @abstractmethod 99 def _generate_target_gn(self): 100 pass 101 102 @abstractmethod 103 def _generate_phony_targets_build_file(self): 104 pass 105 106 @abstractmethod 107 def _generate_required_parts_targets(self): 108 pass 109 110 @abstractmethod 111 def _generate_required_parts_targets_list(self): 112 pass 113 114 @abstractmethod 115 def _generate_src_flag(self): 116 pass 117 118 @abstractmethod 119 def _generate_auto_install_part(self): 120 pass 121 122 @abstractmethod 123 def _generate_platforms_list(self): 124 pass 125 126 @abstractmethod 127 def _generate_part_different_info(self): 128 pass 129 130 @abstractmethod 131 def _generate_infos_for_testfwk(self): 132 pass 133 134 @abstractmethod 135 def _check_product_part_feature(self): 136 pass 137 138 @abstractmethod 139 def _generate_syscap_files(self): 140 pass 141