From 3506ebd3284cd1832fd2fef3d4e78f1af7fa3ddb Mon Sep 17 00:00:00 2001 From: LeonShu Date: Sat, 7 Jun 2025 21:17:05 +0800 Subject: [PATCH] for updater build Signed-off-by: LeonShu --- services/flashd/BUILD.gn | 269 ++++++++++++++++++++------------------- 1 file changed, 138 insertions(+), 131 deletions(-) diff --git a/services/flashd/BUILD.gn b/services/flashd/BUILD.gn index d8f02b30..8e18c011 100644 --- a/services/flashd/BUILD.gn +++ b/services/flashd/BUILD.gn @@ -14,143 +14,145 @@ import("//base/update/updater/updater_default_cfg.gni") import("//build/ohos.gni") -HDC_PATH = "//developtools/hdc/src" updater_path = rebase_path("${updater_absolutely_path}", ".") -hash_sources = [ - "${hdc_base}/scripts/hdc_hash_gen.py", - "${hdc_base}/src/common/base.cpp", - "${hdc_base}/src/common/channel.h", - "${hdc_base}/src/common/session.h", - "${hdc_base}/src/common/transfer.h", -] - -py_out_dir = "$root_build_dir/gen/" + rebase_path(".", "//") - -config("hdc_config") { - include_dirs = [ "${py_out_dir}" ] - cflags_cc = [ "-std=c++17" ] - if (is_mingw) { - cflags_cc += [ "-Wno-inconsistent-dllimport" ] # in mingw some sec api will - # overwrite by utilsecurec - } -} - -action("hdc_hash_gen") { - script = "${hdc_base}/scripts/hdc_hash_gen.py" - sources = hash_sources - outputs = [ "$py_out_dir" ] - args = [ - "-f", - "hdc_hash_gen.h", - "-i", - rebase_path("${hdc_base}", root_build_dir), - "-o", - rebase_path("$py_out_dir" + "/", root_build_dir), - ] - public_configs = [ ":hdc_config" ] -} - -common_sources = [ - "${HDC_PATH}/common/async_cmd.cpp", - "${HDC_PATH}/common/auth.cpp", - "${HDC_PATH}/common/base.cpp", - "${HDC_PATH}/common/channel.cpp", - "${HDC_PATH}/common/circle_buffer.cpp", - "${HDC_PATH}/common/compress.cpp", - "${HDC_PATH}/common/debug.cpp", - "${HDC_PATH}/common/decompress.cpp", - "${HDC_PATH}/common/entry.cpp", - "${HDC_PATH}/common/file.cpp", - "${HDC_PATH}/common/file_descriptor.cpp", - "${HDC_PATH}/common/forward.cpp", - "${HDC_PATH}/common/header.cpp", - "${HDC_PATH}/common/heartbeat.cpp", - "${HDC_PATH}/common/server_cmd_log.cpp", - "${HDC_PATH}/common/session.cpp", - "${HDC_PATH}/common/task.cpp", - "${HDC_PATH}/common/tcp.cpp", - "${HDC_PATH}/common/tlv.cpp", - "${HDC_PATH}/common/transfer.cpp", - "${HDC_PATH}/common/usb.cpp", - "${HDC_PATH}/common/uv_status.cpp", -] - -config("flashd_hdc_config") { - include_dirs = [ "./common" ] - cflags_cc = [ "-std=c++17" ] -} - -ohos_static_library("flashd_deamon") { - sources = [ - "${HDC_PATH}/daemon/daemon_app.cpp", - "${HDC_PATH}/daemon/daemon_forward.cpp", - "${HDC_PATH}/daemon/daemon_tcp.cpp", - "${HDC_PATH}/daemon/daemon_unity.cpp", - "${HDC_PATH}/daemon/daemon_usb.cpp", - "${HDC_PATH}/daemon/jdwp.cpp", - "${HDC_PATH}/daemon/shell.cpp", - "daemon/daemon.cpp", - "daemon/system_depend.cpp", - ] - - sources += common_sources - - defines = [ - "HARMONY_PROJECT", - "OPENSSL_SUPPRESS_DEPRECATED", +if (!ohos_indep_compiler_enable) { + HDC_PATH = "//developtools/hdc/src" + hash_sources = [ + "${hdc_base}/scripts/hdc_hash_gen.py", + "${hdc_base}/src/common/base.cpp", + "${hdc_base}/src/common/channel.h", + "${hdc_base}/src/common/session.h", + "${hdc_base}/src/common/transfer.h", ] - - configs = [ ":flashd_hdc_config" ] - - external_deps = [ - "bounds_checking_function:libsec_static", - "c_utils:utils", - "libuv:uv", - "lz4:liblz4_static", - "openssl:libcrypto_shared", - ] - - deps = [ "${updater_path}/services/flashd:hdc_hash_gen" ] - - if (updater_hdc_depend) { - external_deps += [ "hdc:hdc_updater" ] + + py_out_dir = "$root_build_dir/gen/" + rebase_path(".", "//") + + config("hdc_config") { + include_dirs = [ "${py_out_dir}" ] + cflags_cc = [ "-std=c++17" ] + if (is_mingw) { + cflags_cc += [ "-Wno-inconsistent-dllimport" ] # in mingw some sec api will + # overwrite by utilsecurec + } } - - if (use_musl) { - external_deps += [ "init:libbegetutil_static" ] + + action("hdc_hash_gen") { + script = "${hdc_base}/scripts/hdc_hash_gen.py" + sources = hash_sources + outputs = [ "$py_out_dir" ] + args = [ + "-f", + "hdc_hash_gen.h", + "-i", + rebase_path("${hdc_base}", root_build_dir), + "-o", + rebase_path("$py_out_dir" + "/", root_build_dir), + ] + public_configs = [ ":hdc_config" ] } - - include_dirs = [ - "${updater_path}/services/common", - "${updater_path}/services/flashd", - "${updater_path}/services/flashd/daemon", - "${updater_path}/services/flashd/common", - "${updater_path}/services/flashd/host", - "${updater_path}/services/include", - "${updater_path}/services/include/fs_manager", - "${updater_path}/services/include/package", - "${updater_path}/services/include/applypatch", - "${updater_path}/services/include/script", - "${updater_path}/services/include/log", - "${updater_path}/interfaces/kits/include", - "${updater_path}/utils/include", + + common_sources = [ + "${HDC_PATH}/common/async_cmd.cpp", + "${HDC_PATH}/common/auth.cpp", + "${HDC_PATH}/common/base.cpp", + "${HDC_PATH}/common/channel.cpp", + "${HDC_PATH}/common/circle_buffer.cpp", + "${HDC_PATH}/common/compress.cpp", + "${HDC_PATH}/common/debug.cpp", + "${HDC_PATH}/common/decompress.cpp", + "${HDC_PATH}/common/entry.cpp", + "${HDC_PATH}/common/file.cpp", + "${HDC_PATH}/common/file_descriptor.cpp", + "${HDC_PATH}/common/forward.cpp", + "${HDC_PATH}/common/header.cpp", + "${HDC_PATH}/common/heartbeat.cpp", + "${HDC_PATH}/common/server_cmd_log.cpp", + "${HDC_PATH}/common/session.cpp", + "${HDC_PATH}/common/task.cpp", + "${HDC_PATH}/common/tcp.cpp", + "${HDC_PATH}/common/tlv.cpp", + "${HDC_PATH}/common/transfer.cpp", + "${HDC_PATH}/common/usb.cpp", + "${HDC_PATH}/common/uv_status.cpp", ] - - if (build_selinux) { - external_deps += [ "selinux:libselinux_static" ] - defines += [ - "SURPPORT_SELINUX", - "UPDATER_MODE", - ] + + config("flashd_hdc_config") { + include_dirs = [ "./common" ] + cflags_cc = [ "-std=c++17" ] } - - if (build_variant == "user") { - defines += [ "UPDATER_BUILD_VARIANT_USER" ] + + ohos_static_library("flashd_deamon") { + sources = [ + "${HDC_PATH}/daemon/daemon_app.cpp", + "${HDC_PATH}/daemon/daemon_forward.cpp", + "${HDC_PATH}/daemon/daemon_tcp.cpp", + "${HDC_PATH}/daemon/daemon_unity.cpp", + "${HDC_PATH}/daemon/daemon_usb.cpp", + "${HDC_PATH}/daemon/jdwp.cpp", + "${HDC_PATH}/daemon/shell.cpp", + "daemon/daemon.cpp", + "daemon/system_depend.cpp", + ] + + sources += common_sources + + defines = [ + "HARMONY_PROJECT", + "OPENSSL_SUPPRESS_DEPRECATED", + ] + + configs = [ ":flashd_hdc_config" ] + + external_deps = [ + "bounds_checking_function:libsec_static", + "c_utils:utils", + "libuv:uv", + "lz4:liblz4_static", + "openssl:libcrypto_shared", + ] + + deps = [ "${updater_path}/services/flashd:hdc_hash_gen" ] + + if (updater_hdc_depend) { + external_deps += [ "hdc:hdc_updater" ] + } + + if (use_musl) { + external_deps += [ "init:libbegetutil_static" ] + } + + include_dirs = [ + "${updater_path}/services/common", + "${updater_path}/services/flashd", + "${updater_path}/services/flashd/daemon", + "${updater_path}/services/flashd/common", + "${updater_path}/services/flashd/host", + "${updater_path}/services/include", + "${updater_path}/services/include/fs_manager", + "${updater_path}/services/include/package", + "${updater_path}/services/include/applypatch", + "${updater_path}/services/include/script", + "${updater_path}/services/include/log", + "${updater_path}/interfaces/kits/include", + "${updater_path}/utils/include", + ] + + if (build_selinux) { + external_deps += [ "selinux:libselinux_static" ] + defines += [ + "SURPPORT_SELINUX", + "UPDATER_MODE", + ] + } + + if (build_variant == "user") { + defines += [ "UPDATER_BUILD_VARIANT_USER" ] + } + + subsystem_name = "updater" + part_name = "updater" } - - subsystem_name = "updater" - part_name = "updater" } ohos_static_library("libflashd") { @@ -179,14 +181,12 @@ ohos_static_library("libflashd") { ] deps = [ - ":flashd_deamon", "${updater_path}/interfaces/kits/misc_info:libmiscinfo", "${updater_path}/interfaces/kits/slot_info:libslotinfo", "${updater_path}/interfaces/kits/updaterkits:libupdaterkits", "${updater_path}/services/applypatch:libapplypatch", "${updater_path}/services/common/ring_buffer:libringbuffer", "${updater_path}/services/diffpatch/patch:libpatch", - "${updater_path}/services/flashd:hdc_hash_gen", "${updater_path}/services/flow_update/update_bin:libBinFlowUpdate", "${updater_path}/services/fs_manager:libfsmanager", "${updater_path}/services/hdi/server:libupdate_hdi_impl", @@ -196,6 +196,13 @@ ohos_static_library("libflashd") { "${updater_path}/utils:libutils", ] + if (!ohos_indep_compiler_enable) { + deps += [ + ":flashd_deamon", + "${updater_path}/services/flashd:hdc_hash_gen", + ] + } + include_dirs = [ "${updater_path}/services", "${updater_path}/services/common", -- Gitee