From b0d8c293e50f3b72056a5cd1371963c13c1d67ee Mon Sep 17 00:00:00 2001 From: lwx1153805 Date: Wed, 18 Jan 2023 10:31:53 +0800 Subject: [PATCH] Descriptor: modify the path of the closed-source subsystem issue:https://gitee.com/openharmony/build/issues/I6AYUI?from=project-issue Signed-off-by: lwx1153805 --- hb_internal/build/part_rom_statistics.py | 4 +++- hb_internal/common/config.py | 2 +- hb_internal/common/misc.py | 7 ++++--- hb_internal/common/product.py | 3 +-- hb_internal/preloader/preloader.py | 5 ++--- hb_internal/set/set.py | 5 ++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hb_internal/build/part_rom_statistics.py b/hb_internal/build/part_rom_statistics.py index e3f60a6..9b1b130 100644 --- a/hb_internal/build/part_rom_statistics.py +++ b/hb_internal/build/part_rom_statistics.py @@ -21,6 +21,7 @@ import re import json from hb_internal.common.utils import hb_info +from hb_internal.common.config import Config budle_json_files = [] standard_part_roms = [] @@ -192,7 +193,8 @@ def read_subsystem_config(root_path): for path_k, path_v in part_info_valule.items(): if path_k == "path": part_json_paths.append(path_v) - part_json_overlay_path = os.path.join(root_path, 'build/subsystem_config_overlay.json') + conf = Config() + part_json_overlay_path = conf.product_path if os.path.isfile(part_json_overlay_path): with open(part_json_overlay_path, 'r') as file: file_json = json.load(file) diff --git a/hb_internal/common/config.py b/hb_internal/common/config.py index 1901e91..199265a 100644 --- a/hb_internal/common/config.py +++ b/hb_internal/common/config.py @@ -58,7 +58,7 @@ class Config(metaclass=Singleton): None) self._subsystem_config_json = config_content.get( 'subsystem_config_json', None) - self._subsystem_config_overlay_json = 'build/subsystem_config_overlay.json' + self._subsystem_config_overlay_json = self._product_path + '/subsystem_config_overlay.json' self.fs_attr = set() self.platform = platform.system() diff --git a/hb_internal/common/misc.py b/hb_internal/common/misc.py index e868cc3..edc20fb 100644 --- a/hb_internal/common/misc.py +++ b/hb_internal/common/misc.py @@ -22,6 +22,7 @@ from datetime import datetime from distutils.spawn import find_executable from hb_internal.common.utils import exec_command from hb_internal.common.utils import hb_warning +from hb_internal.common.config import Config class PreBuild: @@ -202,8 +203,8 @@ class PostBuild: exec_command(cmd, log_path=self._log_path) def compute_overlap_rate(self): - subsystem_config_overlay_path = os.path.join(self._root_path, - 'build/subsystem_config_overlay.json') + conf = Config() + subsystem_config_overlay_path = conf.product_path + '/subsystem_config_overlay.json' if os.path.isfile(subsystem_config_overlay_path): cmd = [ 'python3', @@ -212,7 +213,7 @@ class PostBuild: "--subsystem-config-file", "{}/build/subsystem_config.json".format(self._root_path), "--subsystem-config-overlay-file", - "{}/build/subsystem_config_overlay.json".format(self._root_path), + "{}/subsystem_config_overlay.json".format(conf.product_path), "--root-source-dir", self._root_path ] else: diff --git a/hb_internal/common/product.py b/hb_internal/common/product.py index 9c3df67..3e37257 100755 --- a/hb_internal/common/product.py +++ b/hb_internal/common/product.py @@ -51,8 +51,7 @@ class Product(): else: product_path = p_config_path if product_name is not None: - subsystem_config_overlay_path = os.path.join(config.root_path, - 'build/subsystem_config_overlay.json') + subsystem_config_overlay_path = config.product_path + '/subsystem_config_overlay.json' if os.path.isfile(subsystem_config_overlay_path): yield { 'company': company, diff --git a/hb_internal/preloader/preloader.py b/hb_internal/preloader/preloader.py index 6a4ff0d..632f6c2 100755 --- a/hb_internal/preloader/preloader.py +++ b/hb_internal/preloader/preloader.py @@ -500,8 +500,7 @@ class Dirs: self.subsystem_config_json = os.path.join(config.root_path, config.subsystem_config_json) - self.subsystem_config_overlay_json = os.path.join(config.root_path, - config.subsystem_config_overlay_json) + self.subsystem_config_overlay_json = config.product_path + '/subsystem_config_overlay.json' self.lite_components_dir = os.path.join(config.root_path, 'build/lite/components') @@ -658,7 +657,7 @@ def main(argv): required=True) parser.add_argument('--subsystem-config-overlay-file', dest='subsystem_config_overlay_json', - required=True) + required=False) args = parser.parse_args(argv) preloader = Preloader(args) diff --git a/hb_internal/set/set.py b/hb_internal/set/set.py index 778c0e0..589feda 100644 --- a/hb_internal/set/set.py +++ b/hb_internal/set/set.py @@ -103,14 +103,13 @@ def set_product(product_name=None, company=None): else: config.subsystem_config_json = 'build/subsystem_config.json' - subsystem_config_overlay_path = os.path.join(config.root_path, - 'build/subsystem_config_overlay.json') + subsystem_config_overlay_path = config.product_path + '/subsystem_config_overlay.json' if os.path.isfile(subsystem_config_overlay_path): if product_info.get('subsystem_config_overlay_json'): config.subsystem_config_overlay_json = product_info.get( 'subsystem_config_overlay_json') else: - config.subsystem_config_overlay_json = 'build/subsystem_config_overlay.json' + config.subsystem_config_overlay_json = subsystem_config_overlay_path if config.version == '2.0': config.device_path = board_path -- GitLab