From efbd7221e318930e8b57622567b9b680b5d0aa09 Mon Sep 17 00:00:00 2001 From: LeonShu Date: Wed, 11 Jun 2025 11:12:15 +0800 Subject: [PATCH 1/2] for updater indep_compiler_enable Signed-off-by: LeonShu --- BUILD.gn | 8 +- bundle.json | 3 +- interfaces/kits/updaterkits/BUILD.gn | 10 + services/BUILD.gn | 29 +- services/flashd/BUILD.gn | 269 +++++++++--------- services/updater_binary/BUILD.gn | 13 + .../UpdaterFormatPartition_fuzzer/BUILD.gn | 10 +- .../UpdaterMountForPath_fuzzer/BUILD.gn | 10 +- .../UpdaterStartUpdaterProc_fuzzer/BUILD.gn | 10 +- test/fuzztest/applypatch_fuzzer/BUILD.gn | 10 +- test/fuzztest/binflow_fuzzer/BUILD.gn | 10 +- test/fuzztest/dopartitions_fuzzer/BUILD.gn | 10 +- .../extractandexecutescript_fuzzer/BUILD.gn | 10 +- .../getupdatepackageinfo_fuzzer/BUILD.gn | 11 +- test/fuzztest/package_fuzzer/BUILD.gn | 10 +- .../readfstabfromfile_fuzzer/BUILD.gn | 10 +- .../BUILD.gn | 10 +- test/fuzztest/scriptmanager_fuzzer/BUILD.gn | 10 +- .../updaterfactoryreset_fuzzer/BUILD.gn | 11 +- test/fuzztest/updatermain_fuzzer/BUILD.gn | 10 +- test/fuzztest/updaterutils_fuzzer/BUILD.gn | 10 +- test/fuzztest/writeupdatermsg_fuzzer/BUILD.gn | 10 +- test/unittest/BUILD.gn | 10 +- test/unittest/applypatch_test/BUILD.gn | 9 + test/unittest/common/ring_buffer/BUILD.gn | 9 + test/unittest/factory_reset_test/BUILD.gn | 9 + test/unittest/flow_update/update_bin/BUILD.gn | 9 + test/unittest/package/BUILD.gn | 9 + test/unittest/script/BUILD.gn | 9 + test/unittest/service_test/BUILD.gn | 9 + test/unittest/stream_update/BUILD.gn | 10 + test/unittest/updater_binary/BUILD.gn | 9 + test/unittest/updater_ui_test/BUILD.gn | 9 + test/unittest/utils/BUILD.gn | 9 + utils/BUILD.gn | 18 ++ 35 files changed, 461 insertions(+), 161 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index e563859b..ce77ae8e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -44,8 +44,6 @@ group("unittest") { "test/unittest/applypatch_test:applypatch_unittest", "test/unittest/common/ring_buffer:ring_buffer_test", "test/unittest/factory_reset_test:factory_reset_unittest", - "test/unittest/flashd_test:flashd_unittest", - "test/unittest/flashd_test:flashd_utils_unittest", "test/unittest/flow_update/update_bin:bin_flow_update_test", "test/unittest/package:package_unittest", "test/unittest/script:script_unittest", @@ -53,6 +51,12 @@ group("unittest") { "test/unittest/updater_binary:binary_unittest", "test/unittest/utils:utils_test", ] + if (!ohos_indep_compiler_enable) { + deps += [ + "test/unittest/flashd_test:flashd_unittest", + "test/unittest/flashd_test:flashd_utils_unittest", + ] + } if (updater_cfg_file == "") { deps += [ "test/unittest/script:user_instruction", diff --git a/bundle.json b/bundle.json index 68550561..9f75d7f8 100644 --- a/bundle.json +++ b/bundle.json @@ -64,7 +64,8 @@ "lz4", "openssl", "selinux", - "zlib" + "zlib", + "pcre2" ], "third_party": [] }, diff --git a/interfaces/kits/updaterkits/BUILD.gn b/interfaces/kits/updaterkits/BUILD.gn index d193d3ac..fac3c2e5 100755 --- a/interfaces/kits/updaterkits/BUILD.gn +++ b/interfaces/kits/updaterkits/BUILD.gn @@ -49,6 +49,16 @@ ohos_shared_library("libupdater_shared") { "openssl:libssl_static", "zlib:shared_libz", ] + + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "init:libudidcomm_static", + ] + } innerapi_tags = [ "platformsdk", diff --git a/services/BUILD.gn b/services/BUILD.gn index f1c260f5..98be2540 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -36,7 +36,6 @@ updater_common_deps = [ "${updater_path}/interfaces/kits/packages:libpackageExt", "${updater_path}/services/applypatch:libapplypatch", "${updater_path}/services/diffpatch/patch:libpatch", - "${updater_path}/services/flashd:libflashd", "${updater_path}/services/fs_manager:libfsmanager", "${updater_path}/services/log:libupdaterlog", "${updater_path}/services/package:libupdaterpackage", @@ -46,13 +45,29 @@ updater_common_deps = [ updater_gen("updater") { deps = [ "${updater_path}/services:libupdater_static" ] external_deps = [ "hilog:libhilog" ] - + + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:init_log", + "pcre2:libpcre2", + "updater:libupdaterlog_shared", + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } + # force link flashd library ldflags = [ "-Wl,--whole-archive", - rebase_path("${target_out_dir}/flashd/libflashd.a"), "-Wl,--no-whole-archive", ] + + if (!ohos_indep_compiler_enable) { + ldflags += [ rebase_path("${target_out_dir}/flashd/libflashd.a"), ] + } part_name = "updater" subsystem_name = "updater" @@ -82,6 +97,10 @@ ohos_static_library("libupdater_static") { "${updater_path}/services/sdcard_update:libsdupdate", "${updater_path}/interfaces/kits/slot_info:libslotinfo", ] + + if (!ohos_indep_compiler_enable) { + deps += [ "${updater_path}/services/flashd:libflashd", ] + } if (defined(use_ptable)) { include_dirs += [ "${updater_path}/services/ptable_parse" ] @@ -149,6 +168,10 @@ ohos_static_library("libupdater") { deps = updater_common_deps + if (!ohos_indep_compiler_enable) { + deps += [ "${updater_path}/services/flashd:libflashd", ] + } + public_configs = [ ":libupdater_exported_headers" ] if (defined(use_ptable)) { diff --git a/services/flashd/BUILD.gn b/services/flashd/BUILD.gn index 8e18c011..d8f02b30 100644 --- a/services/flashd/BUILD.gn +++ b/services/flashd/BUILD.gn @@ -14,145 +14,143 @@ import("//base/update/updater/updater_default_cfg.gni") import("//build/ohos.gni") +HDC_PATH = "//developtools/hdc/src" updater_path = rebase_path("${updater_absolutely_path}", ".") -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", +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", ] - - 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 - } + + 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" ] } - - 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" ] + + if (use_musl) { + external_deps += [ "init:libbegetutil_static" ] } - - 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", + + 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", ] - - 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", - ] - - 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_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" } + + if (build_variant == "user") { + defines += [ "UPDATER_BUILD_VARIANT_USER" ] + } + + subsystem_name = "updater" + part_name = "updater" } ohos_static_library("libflashd") { @@ -181,12 +179,14 @@ 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,13 +196,6 @@ 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", diff --git a/services/updater_binary/BUILD.gn b/services/updater_binary/BUILD.gn index e196cd23..585ce6b4 100644 --- a/services/updater_binary/BUILD.gn +++ b/services/updater_binary/BUILD.gn @@ -38,6 +38,15 @@ config("updater_binary_lc++") { updater_gen("updater_binary") { deps = [ "${updater_path}/services/updater_binary:libupdater_binary" ] + if (ohos_indep_compiler_enable) { + external_deps = [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } configs = [ ":updater_binary_lc++" ] part_name = "updater" subsystem_name = "updater" @@ -89,6 +98,10 @@ ohos_static_library("libupdater_binary") { "openssl:libssl_static", "zlib:libz", ] + + if (ohos_indep_compiler_enable) { + external_deps += [ "init:param_client", ] + } part_name = "updater" subsystem_name = "updater" diff --git a/test/fuzztest/UpdaterFormatPartition_fuzzer/BUILD.gn b/test/fuzztest/UpdaterFormatPartition_fuzzer/BUILD.gn index 28885034..1ade35d7 100644 --- a/test/fuzztest/UpdaterFormatPartition_fuzzer/BUILD.gn +++ b/test/fuzztest/UpdaterFormatPartition_fuzzer/BUILD.gn @@ -48,7 +48,15 @@ ohos_fuzztest("UpdaterFormatPartitionFuzzTest") { ] external_deps = [ "init:libbegetutil_static" ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/UpdaterMountForPath_fuzzer/BUILD.gn b/test/fuzztest/UpdaterMountForPath_fuzzer/BUILD.gn index 33e446a0..3f405946 100644 --- a/test/fuzztest/UpdaterMountForPath_fuzzer/BUILD.gn +++ b/test/fuzztest/UpdaterMountForPath_fuzzer/BUILD.gn @@ -45,7 +45,15 @@ ohos_fuzztest("UpdaterMountForPathFuzzTest") { ] external_deps = [ "init:libbegetutil_static" ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/UpdaterStartUpdaterProc_fuzzer/BUILD.gn b/test/fuzztest/UpdaterStartUpdaterProc_fuzzer/BUILD.gn index ec9c803d..931c46b0 100644 --- a/test/fuzztest/UpdaterStartUpdaterProc_fuzzer/BUILD.gn +++ b/test/fuzztest/UpdaterStartUpdaterProc_fuzzer/BUILD.gn @@ -74,7 +74,15 @@ ohos_fuzztest("UpdaterStartUpdaterProcFuzzTest") { "ui_lite:libupdater_layout", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/applypatch_fuzzer/BUILD.gn b/test/fuzztest/applypatch_fuzzer/BUILD.gn index 456de2b9..ee55ce0a 100644 --- a/test/fuzztest/applypatch_fuzzer/BUILD.gn +++ b/test/fuzztest/applypatch_fuzzer/BUILD.gn @@ -58,7 +58,15 @@ ohos_fuzztest("ApplyPatchFuzzTest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/binflow_fuzzer/BUILD.gn b/test/fuzztest/binflow_fuzzer/BUILD.gn index c3ccae38..46ef1ea6 100644 --- a/test/fuzztest/binflow_fuzzer/BUILD.gn +++ b/test/fuzztest/binflow_fuzzer/BUILD.gn @@ -77,7 +77,15 @@ ohos_fuzztest("BinFlowFuzzTest") { "init:libbegetutil_static", "openssl:libcrypto_shared", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/dopartitions_fuzzer/BUILD.gn b/test/fuzztest/dopartitions_fuzzer/BUILD.gn index e60388e4..616081f0 100644 --- a/test/fuzztest/dopartitions_fuzzer/BUILD.gn +++ b/test/fuzztest/dopartitions_fuzzer/BUILD.gn @@ -57,7 +57,15 @@ ohos_fuzztest("DoPartitionsFuzzTest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/extractandexecutescript_fuzzer/BUILD.gn b/test/fuzztest/extractandexecutescript_fuzzer/BUILD.gn index 1948de80..e3b0842a 100644 --- a/test/fuzztest/extractandexecutescript_fuzzer/BUILD.gn +++ b/test/fuzztest/extractandexecutescript_fuzzer/BUILD.gn @@ -66,7 +66,15 @@ ohos_fuzztest("ExtractAndExecuteScriptFuzzTest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/getupdatepackageinfo_fuzzer/BUILD.gn b/test/fuzztest/getupdatepackageinfo_fuzzer/BUILD.gn index b4103e14..79d35a24 100644 --- a/test/fuzztest/getupdatepackageinfo_fuzzer/BUILD.gn +++ b/test/fuzztest/getupdatepackageinfo_fuzzer/BUILD.gn @@ -52,7 +52,16 @@ ohos_fuzztest("GetUpdatePackageInfoFuzzTest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + deps += [ "${updater_path}/interfaces/kits/misc_info:libmiscinfo", ] + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/package_fuzzer/BUILD.gn b/test/fuzztest/package_fuzzer/BUILD.gn index 96e426d3..eb2a3615 100644 --- a/test/fuzztest/package_fuzzer/BUILD.gn +++ b/test/fuzztest/package_fuzzer/BUILD.gn @@ -57,7 +57,15 @@ ohos_fuzztest("PackageFuzzTest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/readfstabfromfile_fuzzer/BUILD.gn b/test/fuzztest/readfstabfromfile_fuzzer/BUILD.gn index 80807e39..132cd97f 100644 --- a/test/fuzztest/readfstabfromfile_fuzzer/BUILD.gn +++ b/test/fuzztest/readfstabfromfile_fuzzer/BUILD.gn @@ -42,7 +42,15 @@ ohos_fuzztest("ReadFstabFromFileFuzzTest") { ] external_deps = [ "init:libbegetutil_static" ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/rebootandinstallupgradepackage_fuzzer/BUILD.gn b/test/fuzztest/rebootandinstallupgradepackage_fuzzer/BUILD.gn index a9fb06f5..41b84d6b 100644 --- a/test/fuzztest/rebootandinstallupgradepackage_fuzzer/BUILD.gn +++ b/test/fuzztest/rebootandinstallupgradepackage_fuzzer/BUILD.gn @@ -52,7 +52,15 @@ ohos_fuzztest("RebootAndInstallUpgradePackageFuzzTest") { "c_utils:utils", "init:libbegetutil_static", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/scriptmanager_fuzzer/BUILD.gn b/test/fuzztest/scriptmanager_fuzzer/BUILD.gn index d418ebc0..0527b4a8 100644 --- a/test/fuzztest/scriptmanager_fuzzer/BUILD.gn +++ b/test/fuzztest/scriptmanager_fuzzer/BUILD.gn @@ -66,7 +66,15 @@ ohos_fuzztest("ScriptManagerFuzzTest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/updaterfactoryreset_fuzzer/BUILD.gn b/test/fuzztest/updaterfactoryreset_fuzzer/BUILD.gn index bdf3738a..2f6ab7b6 100644 --- a/test/fuzztest/updaterfactoryreset_fuzzer/BUILD.gn +++ b/test/fuzztest/updaterfactoryreset_fuzzer/BUILD.gn @@ -72,7 +72,16 @@ ohos_fuzztest("UpdaterFactoryResetFuzzTest") { "ui_lite:libupdater_layout", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + deps += [ "${updater_path}/interfaces/kits/slot_info:libslotinfo", ] + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/updatermain_fuzzer/BUILD.gn b/test/fuzztest/updatermain_fuzzer/BUILD.gn index d1ba9a26..ac489858 100644 --- a/test/fuzztest/updatermain_fuzzer/BUILD.gn +++ b/test/fuzztest/updatermain_fuzzer/BUILD.gn @@ -63,7 +63,15 @@ ohos_fuzztest("UpdaterMainFuzzTest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/updaterutils_fuzzer/BUILD.gn b/test/fuzztest/updaterutils_fuzzer/BUILD.gn index 5bf08281..20c475fa 100644 --- a/test/fuzztest/updaterutils_fuzzer/BUILD.gn +++ b/test/fuzztest/updaterutils_fuzzer/BUILD.gn @@ -54,7 +54,15 @@ ohos_fuzztest("UpdaterUtilsFuzzTest") { "${updater_path}/services/package:libupdaterpackage", "${updater_path}/utils:libutils", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/fuzztest/writeupdatermsg_fuzzer/BUILD.gn b/test/fuzztest/writeupdatermsg_fuzzer/BUILD.gn index dabc05cd..e70feeec 100644 --- a/test/fuzztest/writeupdatermsg_fuzzer/BUILD.gn +++ b/test/fuzztest/writeupdatermsg_fuzzer/BUILD.gn @@ -41,7 +41,15 @@ ohos_fuzztest("WriteUpdaterMsgFuzzTest") { "bounds_checking_function:libsec_static", "init:libbegetutil_static", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } cflags = [ "-g", "-O0", diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index e44e8019..7b8e7f6a 100755 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -176,7 +176,15 @@ ohos_unittest("updater_unittest") { "openssl:libssl_shared", "zlib:libz", ] - + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } public_configs = [ ":utest_config" ] install_enable = true part_name = "updater" diff --git a/test/unittest/applypatch_test/BUILD.gn b/test/unittest/applypatch_test/BUILD.gn index 244a7f18..139369d4 100644 --- a/test/unittest/applypatch_test/BUILD.gn +++ b/test/unittest/applypatch_test/BUILD.gn @@ -74,6 +74,15 @@ ohos_unittest("applypatch_unittest") { "openssl:libcrypto_shared", "openssl:libssl_shared", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } configs = [ "${updater_path}/test/unittest:utest_config" ] install_enable = true part_name = "updater" diff --git a/test/unittest/common/ring_buffer/BUILD.gn b/test/unittest/common/ring_buffer/BUILD.gn index 7ef27b11..f0522b9f 100644 --- a/test/unittest/common/ring_buffer/BUILD.gn +++ b/test/unittest/common/ring_buffer/BUILD.gn @@ -34,6 +34,15 @@ ohos_unittest("ring_buffer_test") { "googletest:gmock_main", "googletest:gtest_main", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } defines = [ "UPDATER_UT" ] configs = [ "${updater_path}/test/unittest:utest_config" ] install_enable = true diff --git a/test/unittest/factory_reset_test/BUILD.gn b/test/unittest/factory_reset_test/BUILD.gn index 74c20b2c..54ebf1b5 100644 --- a/test/unittest/factory_reset_test/BUILD.gn +++ b/test/unittest/factory_reset_test/BUILD.gn @@ -44,6 +44,15 @@ ohos_unittest("factory_reset_unittest") { ] external_deps = [ "init:libbegetutil_static" ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } configs = [ "${updater_path}/test/unittest:utest_config" ] install_enable = true part_name = "updater" diff --git a/test/unittest/flow_update/update_bin/BUILD.gn b/test/unittest/flow_update/update_bin/BUILD.gn index a7ea72d3..0598b7fe 100644 --- a/test/unittest/flow_update/update_bin/BUILD.gn +++ b/test/unittest/flow_update/update_bin/BUILD.gn @@ -76,6 +76,15 @@ ohos_unittest("bin_flow_update_test") { "init:libfsmanager_static_real", "openssl:libcrypto_shared", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } defines = [ "UPDATER_UT" ] configs = [ "${updater_path}/test/unittest:utest_config" ] install_enable = true diff --git a/test/unittest/package/BUILD.gn b/test/unittest/package/BUILD.gn index d9de02af..22c5d042 100644 --- a/test/unittest/package/BUILD.gn +++ b/test/unittest/package/BUILD.gn @@ -94,6 +94,15 @@ ohos_unittest("package_unittest") { "openssl:libcrypto_shared", "zlib:libz", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } install_enable = true part_name = "updater" } diff --git a/test/unittest/script/BUILD.gn b/test/unittest/script/BUILD.gn index 9aa58ee5..ef373c55 100644 --- a/test/unittest/script/BUILD.gn +++ b/test/unittest/script/BUILD.gn @@ -97,6 +97,15 @@ ohos_unittest("script_unittest") { "openssl:libssl_shared", "zlib:libz", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } install_enable = true part_name = "updater" } diff --git a/test/unittest/service_test/BUILD.gn b/test/unittest/service_test/BUILD.gn index cdbdf00f..d8863903 100644 --- a/test/unittest/service_test/BUILD.gn +++ b/test/unittest/service_test/BUILD.gn @@ -76,6 +76,15 @@ ohos_unittest("updater_service_unittest") { "ui_lite:libupdater_layout", "zlib:libz", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } configs = [ "${updater_path}/test/unittest:utest_config" ] install_enable = true part_name = "updater" diff --git a/test/unittest/stream_update/BUILD.gn b/test/unittest/stream_update/BUILD.gn index 55f5ec08..0763478f 100755 --- a/test/unittest/stream_update/BUILD.gn +++ b/test/unittest/stream_update/BUILD.gn @@ -64,6 +64,16 @@ ohos_unittest("bin_chunk_update_test") { "init:libfsmanager_static_real", "openssl:libcrypto_shared", ] + if (ohos_indep_compiler_enable) { + deps += [ "${updater_path}/interfaces/kits/misc_info:libmiscinfo", ] + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } defines = [ "UPDATER_UT" ] configs = [ "${updater_path}/test/unittest:utest_config" ] install_enable = true diff --git a/test/unittest/updater_binary/BUILD.gn b/test/unittest/updater_binary/BUILD.gn index ebfe9709..ef8dd6b4 100644 --- a/test/unittest/updater_binary/BUILD.gn +++ b/test/unittest/updater_binary/BUILD.gn @@ -84,6 +84,15 @@ ohos_unittest("binary_unittest") { "openssl:libssl_shared", "zlib:libz", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } install_enable = true part_name = "updater" defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] diff --git a/test/unittest/updater_ui_test/BUILD.gn b/test/unittest/updater_ui_test/BUILD.gn index 81c6f0f1..8800f09f 100644 --- a/test/unittest/updater_ui_test/BUILD.gn +++ b/test/unittest/updater_ui_test/BUILD.gn @@ -106,6 +106,15 @@ ohos_unittest("ui_unittest") { "libpng:libpng", "ui_lite:libupdater_layout", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } install_enable = true part_name = "updater" } diff --git a/test/unittest/utils/BUILD.gn b/test/unittest/utils/BUILD.gn index 59303eb3..52f960c8 100644 --- a/test/unittest/utils/BUILD.gn +++ b/test/unittest/utils/BUILD.gn @@ -52,6 +52,15 @@ ohos_unittest("utils_test") { "openssl:libssl_static", "zlib:libz", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } deps = [ "${updater_path}/interfaces/kits/misc_info:libmiscinfo", "${updater_path}/services/fs_manager:libfsmanager", diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 119c908f..09ccb8fe 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -122,6 +122,16 @@ ohos_executable("updater_reboot") { "${updater_path}/services/fs_manager:libfsmanager", "${updater_path}/utils:libutils", ] + + if (ohos_indep_compiler_enable) { + external_deps = [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + "pcre2:libpcre2", + ] + } install_images = [ "updater" ] install_enable = true part_name = "updater" @@ -145,6 +155,14 @@ ohos_executable("write_updater") { "bounds_checking_function:libsec_static", "init:libbegetutil_static", ] + if (ohos_indep_compiler_enable) { + external_deps += [ + "init:param_client", + "init:libinit_utils", + "init:parameterbase_ext", + "init:init_log", + ] + } install_enable = true part_name = "updater" -- Gitee From 89e920c9b1417594b1c11b535d872ae0676bed1e Mon Sep 17 00:00:00 2001 From: LeonShu Date: Wed, 11 Jun 2025 11:19:18 +0800 Subject: [PATCH 2/2] for updater indep_compiler_enable Signed-off-by: LeonShu --- interfaces/kits/updaterkits/BUILD.gn | 2 +- services/BUILD.gn | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/interfaces/kits/updaterkits/BUILD.gn b/interfaces/kits/updaterkits/BUILD.gn index fac3c2e5..27b4249c 100755 --- a/interfaces/kits/updaterkits/BUILD.gn +++ b/interfaces/kits/updaterkits/BUILD.gn @@ -49,7 +49,7 @@ ohos_shared_library("libupdater_shared") { "openssl:libssl_static", "zlib:shared_libz", ] - + if (ohos_indep_compiler_enable) { external_deps += [ "init:param_client", diff --git a/services/BUILD.gn b/services/BUILD.gn index 98be2540..92198603 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -45,7 +45,7 @@ updater_common_deps = [ updater_gen("updater") { deps = [ "${updater_path}/services:libupdater_static" ] external_deps = [ "hilog:libhilog" ] - + if (ohos_indep_compiler_enable) { external_deps += [ "init:init_log", @@ -58,13 +58,13 @@ updater_gen("updater") { "pcre2:libpcre2", ] } - + # force link flashd library ldflags = [ "-Wl,--whole-archive", "-Wl,--no-whole-archive", ] - + if (!ohos_indep_compiler_enable) { ldflags += [ rebase_path("${target_out_dir}/flashd/libflashd.a"), ] } @@ -97,7 +97,7 @@ ohos_static_library("libupdater_static") { "${updater_path}/services/sdcard_update:libsdupdate", "${updater_path}/interfaces/kits/slot_info:libslotinfo", ] - + if (!ohos_indep_compiler_enable) { deps += [ "${updater_path}/services/flashd:libflashd", ] } -- Gitee