diff --git a/BUILD.gn b/BUILD.gn index ce77ae8e2da3d65cce025c08be53a4321b3d400e..8d5e3050001b505596b74348ec03daa406f8b2ff 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -57,12 +57,7 @@ group("unittest") { "test/unittest/flashd_test:flashd_utils_unittest", ] } - if (updater_cfg_file == "") { - deps += [ - "test/unittest/script:user_instruction", - "test/unittest/script:user_instruction_invalid", - ] - } + if (updater_ui_support) { deps += [ "test/unittest/service_test:updater_service_unittest", diff --git a/bundle.json b/bundle.json index 375512add4131b115082bd84dc873c3864122751..1e9e2f9dde8c4e572007a939f94d625fdaac5eca 100644 --- a/bundle.json +++ b/bundle.json @@ -40,7 +40,10 @@ "syscap": [], "features": [ "updater_ui_support", - "updater_cfg_file" + "updater_cfg_file", + "updater_feature_use_ptable", + "updater_feature_updater_gen_executable", + "updater_feature_sign_on_server" ], "adapted_system_type": [ "standard" ], "rom": "", diff --git a/services/BUILD.gn b/services/BUILD.gn index 1d82202892e7f7cb9c0b73b5bf00f1a5c10d1513..0ef2354763273afcad60c0f93093a55e122dde4d 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -89,10 +89,13 @@ ohos_static_library("libupdater_static") { deps += [ "${updater_path}/services/flashd:libflashd", ] } + print("GNI_TEST_ libupdater_static") if (defined(use_ptable)) { + print("GNI_TEST_ libupdater_static defined use_ptable") include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libupdater_static defines append UPDATER_USE_PTABLE") } external_deps = [ @@ -164,11 +167,13 @@ ohos_static_library("libupdater") { } public_configs = [ ":libupdater_exported_headers" ] - + print("GNI_TEST_ libupdater") if (defined(use_ptable)) { + print("GNI_TEST_ libupdater defined use_ptable") include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libupdater defines append UPDATER_USE_PTABLE") } ldflags = [] diff --git a/services/flashd/BUILD.gn b/services/flashd/BUILD.gn index d8f02b30993989fd82dc2dd23951b6a8cec08103..21eb1b261e25e957429e55b272095792afd17c25 100644 --- a/services/flashd/BUILD.gn +++ b/services/flashd/BUILD.gn @@ -214,10 +214,13 @@ ohos_static_library("libflashd") { "${updater_path}/utils/json", ] + print("GNI_TEST_ libflashd") if (defined(use_ptable)) { + print("GNI_TEST_ libflashd defined use_ptable") include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libflashd defines append UPDATER_USE_PTABLE") } external_deps = [ diff --git a/services/flow_update/update_bin/BUILD.gn b/services/flow_update/update_bin/BUILD.gn index 83e3d6df06c77ba6f63f54c1d2ef0b610ecc16f4..3210dfb5adb266b99a2f1244d5645b98a5fe9e0c 100644 --- a/services/flow_update/update_bin/BUILD.gn +++ b/services/flow_update/update_bin/BUILD.gn @@ -52,10 +52,13 @@ ohos_static_library("libBinFlowUpdate") { "init:libfsmanager_static_real", "openssl:libcrypto_static", ] + print("GNI_TEST_ libBinFlowUpdate") if (defined(use_ptable)) { + print("GNI_TEST_ libBinFlowUpdate defined use_ptable") deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] external_deps += [ "cJSON:cjson_static" ] defines = [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libBinFlowUpdate defines append UPDATER_USE_PTABLE") } subsystem_name = "updater" part_name = "updater" diff --git a/services/updater_binary/BUILD.gn b/services/updater_binary/BUILD.gn index afbb7c39d87c31fe2523e297dd7dce28fc190cac..d15dbb3a92fd92fb8ba99337d79de12a552655d5 100644 --- a/services/updater_binary/BUILD.gn +++ b/services/updater_binary/BUILD.gn @@ -71,10 +71,13 @@ ohos_static_library("libupdater_binary") { defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] + print("GNI_TEST_ libupdater_binary") if (defined(use_ptable)) { + print("GNI_TEST_ libupdater_binary defined use_ptable") include_dirs = [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libupdater_binary defines append UPDATER_USE_PTABLE") } external_deps = [ diff --git a/services/updater_binary/update_processor.cpp b/services/updater_binary/update_processor.cpp index b204ba9cae0950f25bb18b0ae33283f2a0bbd316..2e15f0231d08dcea5ff74c072a8edbc8c9b654ef 100644 --- a/services/updater_binary/update_processor.cpp +++ b/services/updater_binary/update_processor.cpp @@ -443,6 +443,7 @@ int UScriptInstructionRawImageWrite::GetWritePathAndOffset(const std::string &pa uint64_t &offset, uint64_t &partitionSize) { #ifdef UPDATER_USE_PTABLE +// #error("GNI_TEST_ UPDATER_USE_PTABLE is defined") DevicePtable& devicePtb = DevicePtable::GetInstance(); Ptable::PtnInfo ptnInfo; if (!devicePtb.GetPartionInfoByName(partitionName, ptnInfo)) { diff --git a/services/updater_binary/update_processor_stream.cpp b/services/updater_binary/update_processor_stream.cpp index 624836af04b6cceb0fec17fbf4e0d79327206bb1..65f0ec0e362e2ea4b374d156af533be2e8e46fbd 100755 --- a/services/updater_binary/update_processor_stream.cpp +++ b/services/updater_binary/update_processor_stream.cpp @@ -28,6 +28,7 @@ #include "pkg_manager.h" #ifdef UPDATER_USE_PTABLE #include "ptable_manager.h" +// #error("GNI_TEST_ UPDATER_USE_PTABLE is defined") #endif #include "script_instruction.h" #include "script_manager.h" @@ -182,6 +183,7 @@ int ProcessUpdaterStream(bool retry, int pipeFd, const std::string &packagePath, } #ifdef UPDATER_USE_PTABLE +// #error("GNI_TEST_ UPDATER_USE_PTABLE is defined") // 分区表操作 if (!PackagePtable::GetInstance().WritePtableWithFile()) { LOG(ERROR) << "write ptable with file fail"; diff --git a/test/unittest/script/BUILD.gn b/test/unittest/script/BUILD.gn index 9aa58ee5bd9dea1249baf0d5e5b69d4d88cd5499..7ccb04c78eec4db5966b18641d9eedcc778608d4 100644 --- a/test/unittest/script/BUILD.gn +++ b/test/unittest/script/BUILD.gn @@ -75,13 +75,10 @@ ohos_unittest("script_unittest") { "${updater_path}/services/package:libupdaterpackage", "${updater_path}/services/script:gen_yacc", "${updater_path}/utils:libutils", + "${updater_path}/test/unittest/script:user_instruction", + "${updater_path}/test/unittest/script:user_instruction_invalid", ] - if (updater_cfg_file != "") { - deps += [ - "${updater_path}/test/unittest/script:user_instruction", - "${updater_path}/test/unittest/script:user_instruction_invalid", - ] - } + configs = [ "${updater_path}/test/unittest:utest_config" ] external_deps = [ "bounds_checking_function:libsec_static", diff --git a/updater_default_cfg.gni b/updater_default_cfg.gni index 130b14a9e20ef570ca0943defc87b9f53e6b3d13..cf0e873b8ff3ad59f8780f72ae5d402cc10ddb6b 100644 --- a/updater_default_cfg.gni +++ b/updater_default_cfg.gni @@ -16,6 +16,9 @@ import("//build/ohos.gni") init_feature_ab_partition = true declare_args() { updater_cfg_file = "" + updater_feature_use_ptable = true + updater_feature_updater_gen_executable = false + updater_feature_sign_on_server = true updater_ui_support = true if (!defined(global_parts_info.arkui_ui_lite)) { updater_ui_support = false @@ -23,22 +26,36 @@ declare_args() { updater_hdc_depend = true updater_absolutely_path = "//base/update/updater" hdc_base = "//developtools/hdc" - updater_sign_on_server = false + updater_sign_on_server = true updater_zlib_enable = true + # print("GNI_TEST_ declare_args updater_cfg_file:", updater_cfg_file) + print("GNI_TEST_ declare_args updater_feature_use_ptable:") + print("GNI_TEST_ declare_args updater_feature_sign_on_server:") + print("GNI_TEST_ declare_args updater_ui_support:") + print("GNI_TEST_ declare_args updater_sign_on_server:") + print("GNI_TEST_ declare_args updater_zlib_enable:") + if (defined(global_parts_info) && !defined(global_parts_info.third_party_zlib)) { updater_zlib_enable = false } } -if (updater_cfg_file != "") { +if (updater_feature_sign_on_server) { + print("GNI_TEST_ global 000 updater_feature_sign_on_server: true") updater_sign_on_server = true - import("${updater_cfg_file}") + print("GNI_TEST_ global updater_sign_on_server: true") +} + +if (updater_feature_use_ptable) { + print("GNI_TEST_ global 000 updater_feature_use_ptable: true") + use_ptable = "enable" + print("GNI_TEST_ global use_ptable: 'enable'") } template("updater_gen") { - if (updater_cfg_file != "") { + if (!updater_feature_updater_gen_executable) { ohos_source_set(target_name) { forward_variables_from(invoker, "*") }