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 PreloadInterface(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 outputs(self): 36 return self._preloader_outputs 37 38 @property 39 def config(self): 40 return self._config 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._generate_build_prop() 52 self._generate_build_config_json() 53 self._generate_parts_json() 54 self._generate_parts_config_json() 55 self._generate_build_gnargs_prop() 56 self._generate_features_json() 57 self._generate_syscap_json() 58 self._generate_exclusion_modules_json() 59 self._generate_platforms_build() 60 self._generate_subsystem_config_json() 61 self._generate_systemcapability_json() 62 self._generate_compile_standard_whitelist_json() 63 self._generate_compile_env_allowlist_json() 64 self._generate_hvigor_compile_whitelist_json() 65 66 @abstractmethod 67 def _generate_build_prop(self): 68 pass 69 70 @abstractmethod 71 def _generate_build_config_json(self): 72 pass 73 74 @abstractmethod 75 def _generate_parts_json(self): 76 pass 77 78 @abstractmethod 79 def _generate_parts_config_json(self): 80 pass 81 82 @abstractmethod 83 def _generate_build_gnargs_prop(self): 84 pass 85 86 @abstractmethod 87 def _generate_features_json(self): 88 pass 89 90 @abstractmethod 91 def _generate_syscap_json(self): 92 pass 93 94 @abstractmethod 95 def _generate_exclusion_modules_json(self): 96 pass 97 98 @abstractmethod 99 def _generate_platforms_build(self): 100 pass 101 102 @abstractmethod 103 def _generate_subsystem_config_json(self): 104 pass 105 106 @abstractmethod 107 def _generate_systemcapability_json(self): 108 pass 109 110 @abstractmethod 111 def _generate_compile_standard_whitelist_json(self): 112 pass 113 114 @abstractmethod 115 def _generate_compile_env_allowlist_json(self): 116 pass 117 118 @abstractmethod 119 def _generate_hvigor_compile_whitelist_json(self): 120 pass 121