diff --git a/hb/util/component_util.py b/hb/util/component_util.py index 2008a3cd33ab661b3a6ea2ada641fc45bd6af189..e0bbf5d5b11126d6e01151ad34f5e66cdca34113 100644 --- a/hb/util/component_util.py +++ b/hb/util/component_util.py @@ -152,14 +152,17 @@ def gen_default_deps_json(variant, root_path, has_test=False): default_deps_file = os.path.join(root_path, "build", "indep_configs", "variants", "common", 'default_deps.json') default_deps_json = IoUtil.read_json_file(default_deps_file) default_deps_json.append("variants_" + variant) - - part_white_list_path = os.path.join(root_path, "build", "indep_configs", "config", - "rust_download_part_whitelist.json") - part_white_list = IoUtil.read_json_file(part_white_list_path) - rust_deps = ['rust', 'rust_cxx', 'rust_libc', 'rust_syn', 'rust_proc_macro2', 'rust_quote', 'rust_unicode_ident', 'rust_bindgen'] + # Dynamic download whitelist path + download_part_whitelist_path = os.path.join(root_path, 'build', 'indep_configs', 'config', + "download_part_whitelist.json") + download_part_whitelist = IoUtil.read_json_file(download_part_whitelist_path) for part_name in part_name_list: - if part_name in part_white_list: - for dep in rust_deps: + # Default Dependency List + common_deps = [] + if part_name in download_part_whitelist["components"]: + for dependencie in download_part_whitelist["components"][part_name]["dependencies"]: + common_deps += download_part_whitelist["dependencies"][dependencie] + for dep in common_deps: default_deps_json.append(dep) if has_test: default_deps_json.append('developer_test') diff --git a/indep_configs/config/download_part_whitelist.json b/indep_configs/config/download_part_whitelist.json new file mode 100644 index 0000000000000000000000000000000000000000..631314ab7c3c165b3b8d652c4a8f5f6bf58dc0b7 --- /dev/null +++ b/indep_configs/config/download_part_whitelist.json @@ -0,0 +1,55 @@ +{ + "dependencies": { + "rust_common": [ + "rust", + "rust_cxx", + "rust_libc", + "rust_syn", + "rust_proc_macro2", + "rust_quote", + "rust_unicode_ident", + "rust_bindgen" + ], + "typescript_common": [ + "typescript" + ] + }, + "components": { + "ets_utils": { + "dependencies": ["typescript_common"] + }, + "ylong_runtime": { + "dependencies": ["rust_common"] + }, + "ylong_json": { + "dependencies": ["rust_common"] + }, + "c_utils": { + "dependencies": ["rust_common"] + }, + "samgr": { + "dependencies": ["rust_common"] + }, + "safwk": { + "dependencies": ["rust_common"] + }, + "ipc": { + "dependencies": ["rust_common"] + }, + "faultloggerd": { + "dependencies": ["rust_common"] + }, + "graphic_2d": { + "dependencies": ["rust_common"] + }, + "hitrace": { + "dependencies": ["rust_common"] + }, + "code_signature": { + "dependencies": ["rust_common"] + }, + "input": { + "dependencies": ["rust_common"] + } + } + } \ No newline at end of file diff --git a/indep_configs/config/rust_download_part_whitelist.json b/indep_configs/config/rust_download_part_whitelist.json deleted file mode 100644 index 0197e92e3f2786c35152b8ae96976f5e431dd387..0000000000000000000000000000000000000000 --- a/indep_configs/config/rust_download_part_whitelist.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - "ylong_runtime", - "ylong_json", - "c_utils", - "samgr", - "safwk", - "ipc", - "faultloggerd", - "graphic_2d", - "hitrace", - "code_signature", - "input" -] \ No newline at end of file