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 65 @abstractmethod 66 def _generate_build_prop(self): 67 pass 68 69 @abstractmethod 70 def _generate_build_config_json(self): 71 pass 72 73 @abstractmethod 74 def _generate_parts_json(self): 75 pass 76 77 @abstractmethod 78 def _generate_parts_config_json(self): 79 pass 80 81 @abstractmethod 82 def _generate_build_gnargs_prop(self): 83 pass 84 85 @abstractmethod 86 def _generate_features_json(self): 87 pass 88 89 @abstractmethod 90 def _generate_syscap_json(self): 91 pass 92 93 @abstractmethod 94 def _generate_exclusion_modules_json(self): 95 pass 96 97 @abstractmethod 98 def _generate_platforms_build(self): 99 pass 100 101 @abstractmethod 102 def _generate_subsystem_config_json(self): 103 pass 104 105 @abstractmethod 106 def _generate_systemcapability_json(self): 107 pass 108 109 @abstractmethod 110 def _generate_compile_standard_whitelist_json(self): 111 pass 112 113 @abstractmethod 114 def _generate_compile_env_allowlist_json(self): 115 pass 116