From 49f814f4eda7ad0cb3a4e22e89180a4b6b2d1423 Mon Sep 17 00:00:00 2001 From: yueyan Date: Sun, 23 Apr 2023 17:07:05 +0800 Subject: [PATCH] fix:modify compliation mode of hcs file Signed-off-by: yueyan --- adapter/BUILD.gn | 10 --- adapter/uhdf2/hcs/{BUILD.gn => hcs.gni} | 85 ++++++++++++------------- bundle.json | 2 +- 3 files changed, 40 insertions(+), 57 deletions(-) rename adapter/uhdf2/hcs/{BUILD.gn => hcs.gni} (32%) diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn index fd1b18840..19b03f0c6 100644 --- a/adapter/BUILD.gn +++ b/adapter/BUILD.gn @@ -30,13 +30,8 @@ if (defined(ohos_lite)) { ] } } else { - declare_args() { - hdf_core_feature_config = true - } - group("uhdf_entry") { hdf_framework_path = "./../framework" - hdf_peripheral_path = "./../../peripheral" deps = [ "$hdf_adapter_path/uhdf2/hdi:libhdi", "$hdf_adapter_path/uhdf2/host:hdf_devhost", @@ -51,12 +46,7 @@ if (defined(ohos_lite)) { "$hdf_adapter_path/uhdf2/pub_utils:libpub_utils", "$hdf_adapter_path/uhdf2/utils:libhdf_utils", "$hdf_framework_path/tools/hdf_dbg:hdf_dbg", - "$hdf_peripheral_path/base:hdf_peripheral.cfg", ] - - if (hdf_core_feature_config) { - deps += [ "$hdf_adapter_path/uhdf2/hcs:hcs_entry" ] - } } group("uhdf_test_entry") { testonly = true diff --git a/adapter/uhdf2/hcs/BUILD.gn b/adapter/uhdf2/hcs/hcs.gni similarity index 32% rename from adapter/uhdf2/hcs/BUILD.gn rename to adapter/uhdf2/hcs/hcs.gni index 875e5398f..03799fd74 100644 --- a/adapter/uhdf2/hcs/BUILD.gn +++ b/adapter/uhdf2/hcs/hcs.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -9,60 +9,53 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//build/ohos.gni") import("./../../../framework/tools/hc-gen/hc_gen.gni") -import("./../uhdf.gni") -hcs_source = "hdf.hcs" -if (product_company == "openharmony") { - hcs_file = "default/$hcs_source" -} else { - hcs_file = - "//vendor/$product_company/$product_name/hdf_config/uhdf/$hcs_source" -} +template("hdf_hcb") { + assert(defined(invoker.source), "the source must to be set") + assert(defined(invoker.part_name), "the part_name must to be set") -hc_gen("build_hcs") { - sources = [ rebase_path(hcs_file) ] - outputs = [ "$target_gen_dir/hdf_default.hcb" ] -} + hc_gen("build_hcs") { + sources = [ rebase_path(invoker.source) ] + outputs = [ "$target_gen_dir/hdf_default.hcb" ] + } -ohos_prebuilt_etc("hdf_default.hcb") { - deps = [ ":build_hcs" ] - hcs_outputs = get_target_outputs(":build_hcs") - source = hcs_outputs[0] - relative_install_dir = "hdfconfig" - install_images = [ chipset_base_dir ] - subsystem_name = "hdf" - part_name = "hdf_core" -} + ohos_prebuilt_etc("$target_name") { + deps = [ ":build_hcs" ] + hcs_outputs = get_target_outputs(":build_hcs") + source = hcs_outputs[0] -hc_gen_start_cfg("gen_start_cfg") { - sources = [ rebase_path(hcs_file) ] - outputs = [ "$target_gen_dir/hdf_devhost.cfg" ] -} + relative_install_dir = "hdfconfig" + install_images = [ chipset_base_dir ] -ohos_prebuilt_etc("hdf_devhost.cfg") { - deps = [ ":gen_start_cfg" ] - outputs = get_target_outputs(":gen_start_cfg") - source = outputs[0] - relative_install_dir = "init" - install_images = [ chipset_base_dir ] - subsystem_name = "hdf" - part_name = "hdf_core" + if (defined(invoker.subsystem_name)) { + subsystem_name = invoker.subsystem_name + } + part_name = invoker.part_name + } } -group("hcs_entry") { - deps = [] - hcs_file_path = rebase_path("$hcs_file") - if (exec_script( - "//build/lite/run_shell_cmd.py", - [ "if [ -f ${hcs_file_path} ]; then echo true; else echo false; fi" ], - "value")) { - deps += [ - ":hdf_default.hcb", - ":hdf_devhost.cfg", - ] +template("hdf_cfg") { + assert(defined(invoker.source), "the source must to be set") + assert(defined(invoker.part_name), "the part_name must to be set") + + hc_gen_start_cfg("gen_start_cfg") { + sources = [ rebase_path(invoker.source) ] + outputs = [ "$target_gen_dir/hdf_devhost.cfg" ] + } + + ohos_prebuilt_etc("$target_name") { + deps = [ ":gen_start_cfg" ] + outputs = get_target_outputs(":gen_start_cfg") + source = outputs[0] + relative_install_dir = "init" + install_images = [ chipset_base_dir ] + if (defined(invoker.subsystem_name)) { + subsystem_name = invoker.subsystem_name + } + part_name = invoker.part_name } } diff --git a/bundle.json b/bundle.json index 2f8213d92..d2ad1ab81 100644 --- a/bundle.json +++ b/bundle.json @@ -12,7 +12,7 @@ "component": { "name": "hdf_core", "subsystem": "hdf", - "features": [ "hdf_core_khdf_test_support", "hdf_core_platform_test_support", "hdf_core_feature_config" ], + "features": [ "hdf_core_khdf_test_support", "hdf_core_platform_test_support" ], "adapted_system_type": ["standard", "small"], "rom": "735KB", "ram": "8000KB", -- Gitee