From f4a4dc5d6caa540200a95a986e54d94651f62fff Mon Sep 17 00:00:00 2001 From: xiekaiming Date: Wed, 6 Mar 2024 11:27:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiekaiming --- bundle.json | 17 +++++++--- frameworks/config_policy/BUILD.gn | 31 +++++++++---------- .../config_policy/src/config_policy_utils.c | 2 ++ interfaces/kits/js/BUILD.gn | 1 - test/unittest/BUILD.gn | 3 +- test/unittest/config_policy_utils_test.cpp | 6 ++++ test/unittest/config_policy_utils_test.h | 3 ++ 7 files changed, 40 insertions(+), 23 deletions(-) diff --git a/bundle.json b/bundle.json index cf2c993..2eb63d4 100644 --- a/bundle.json +++ b/bundle.json @@ -25,11 +25,10 @@ "hisysevent", "hilog", "napi", - "init" - ], - "third_party": [ + "init", "bounds_checking_function" - ] + ], + "third_party": [] }, "build": { "sub_component": [ @@ -44,6 +43,16 @@ ] }, "name": "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" + }, + { + "header": { + "header_base": "//base/customization/config_policy/interfaces/inner_api/include", + "header_files": [ + "config_policy_utils.h" + ] + }, + "name": "//base/customization/config_policy/frameworks/config_policy:configpolicy_util_for_init_static", + "visibility": ["init"] } ], "test": [ diff --git a/frameworks/config_policy/BUILD.gn b/frameworks/config_policy/BUILD.gn index 978cbc6..76797ff 100644 --- a/frameworks/config_policy/BUILD.gn +++ b/frameworks/config_policy/BUILD.gn @@ -20,12 +20,7 @@ if (defined(ohos_lite)) { config_policy_sources = [ "src/config_policy_utils.c" ] config("config_policy_config") { - include_dirs = [ - "../../interfaces/inner_api/include", - "//third_party/bounds_checking_function/include", - "$STARTUP_INIT_ROOT_DIR/interfaces/innerkits/include/param", - "$TEL_CORESERVICE_ROOT_DIR/utils/common/include", - ] + include_dirs = [ "../../interfaces/inner_api/include" ] } if (defined(ohos_lite) && ohos_kernel_type == "liteos_m") { @@ -35,26 +30,25 @@ if (defined(ohos_lite) && ohos_kernel_type == "liteos_m") { print("cust config_policy_fs_prefix: ${config_policy_fs_prefix}") defines = [ "ROOT_PREFIX=\"${config_policy_fs_prefix}\"" ] } - include_dirs = [ - "../../interfaces/inner_api/include", - "//third_party/bounds_checking_function/include", - ] + public_configs = [ ":config_policy_config" ] + external_deps = [ "bounds_checking_function:libsec_shared" ] } } else if (defined(ohos_lite)) { shared_library("configpolicy_util") { sources = config_policy_sources public_configs = [ ":config_policy_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + external_deps = [ "bounds_checking_function:libsec_shared" ] } } else { ohos_shared_library("configpolicy_util") { sources = config_policy_sources public_configs = [ ":config_policy_config" ] - deps = [ - "etc:customization_etc", - "//third_party/bounds_checking_function:libsec_shared", - ] - external_deps = [ "init:libbegetutil" ] + include_dirs = [ "$TEL_CORESERVICE_ROOT_DIR/utils/common/include" ] + deps = [ "etc:customization_etc" ] + external_deps = [ + "init:libbegetutil", + "bounds_checking_function:libsec_shared", + ] install_images = [ "system", "updater", @@ -70,6 +64,11 @@ if (defined(ohos_lite) && ohos_kernel_type == "liteos_m") { ohos_static_library("configpolicy_util_for_init_static") { sources = config_policy_sources public_configs = [ ":config_policy_config" ] + include_dirs = [ "$TEL_CORESERVICE_ROOT_DIR/utils/common/include" ] + external_deps = [ + "bounds_checking_function:libsec_shared", + "init:export_headers_lib" + ] subsystem_name = "customization" part_name = "config_policy" } diff --git a/frameworks/config_policy/src/config_policy_utils.c b/frameworks/config_policy/src/config_policy_utils.c index 54d8ca3..1693d3d 100644 --- a/frameworks/config_policy/src/config_policy_utils.c +++ b/frameworks/config_policy/src/config_policy_utils.c @@ -27,8 +27,10 @@ #endif static const size_t MIN_APPEND_LEN = 32; +#ifndef __LITEOS__ // set min opkey length static const unsigned int MIN_OPKEY_LEN = 3; +#endif // ':' split different x rules, example:":relPath,mode[,extra][:]" // ',' split different param for x rules // ":-" split for key:-value diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 2ef6328..01b1b76 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -17,7 +17,6 @@ ohos_shared_library("configpolicy") { include_dirs = [ "include", "../../../interfaces/inner_api/include", - "//third_party/bounds_checking_function/include", "../../../frameworks/dfx/hisysevent_adapter", ] diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 10642ea..b0e4c6a 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -22,7 +22,6 @@ if (defined(ohos_lite)) { config_policy_sources = [ "config_policy_utils_test.cpp" ] config_policy_include_dirs = [ "../../interfaces/inner_api/include", - "$STARTUP_INIT_ROOT_DIR/interfaces/innerkits/include/param", "$TEL_CORESERVICE_ROOT_DIR/utils/common/include", ] config_policy_deps = [ "../../frameworks/config_policy:configpolicy_util" ] @@ -31,7 +30,7 @@ if (defined(ohos_lite)) { unittest("ConfigPolicyUtilsTest") { output_extension = "bin" sources = config_policy_sources - include_dirs = config_policy_include_dirs + include_dirs = [ "../../interfaces/inner_api/include" ] deps = config_policy_deps } group("unittest") { diff --git a/test/unittest/config_policy_utils_test.cpp b/test/unittest/config_policy_utils_test.cpp index f38d113..6128a94 100644 --- a/test/unittest/config_policy_utils_test.cpp +++ b/test/unittest/config_policy_utils_test.cpp @@ -19,8 +19,10 @@ #include "config_policy_utils.h" #include "config_policy_impl.h" +#ifndef __LITEOS__ #include "init_param.h" #include "telephony_config_c.h" +#endif using namespace testing::ext; @@ -30,6 +32,7 @@ class ConfigPolicyUtilsTest : public testing::Test { static void SetUpTestCase(void); }; +#ifndef __LITEOS__ void ConfigPolicyUtilsTest::SetUpTestCase(void) { SystemSetParameter(CUST_OPKEY0, "46060"); @@ -37,6 +40,7 @@ void ConfigPolicyUtilsTest::SetUpTestCase(void) SystemSetParameter(CUST_FOLLOW_X_RULES, ":etc/custxmltest/user.xml,10:etc/custxmltest/both.xml,100,etc/carrier/${test:-46061}"); } +#endif bool TestGetCfgFile(const char *testPathSuffix, int type, const char *extra) { @@ -131,6 +135,7 @@ HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest005, TestSize.Level1) EXPECT_TRUE(flag); } +#ifndef __LITEOS__ /** * @tc.name: CfgPolicyUtilsFuncTest006 * @tc.desc: Test GetOneCfgFile & GetCfgFiles function, follow default sim rule. @@ -194,4 +199,5 @@ HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest010, TestSize.Level1) EXPECT_TRUE(TestGetCfgFile("etc/custxmltest/user.xml", FOLLOWX_MODE_USER_DEFINED, extraString.c_str())); EXPECT_TRUE(TestGetCfgFile("etc/custxmltest/both.xml", FOLLOWX_MODE_USER_DEFINED, extraString.c_str())); } +#endif // __LITEOS__ } // namespace OHOS diff --git a/test/unittest/config_policy_utils_test.h b/test/unittest/config_policy_utils_test.h index 538dad5..3c886aa 100644 --- a/test/unittest/config_policy_utils_test.h +++ b/test/unittest/config_policy_utils_test.h @@ -21,10 +21,13 @@ int CfgPolicyUtilsFuncTest002(void); int CfgPolicyUtilsFuncTest003(void); int CfgPolicyUtilsFuncTest004(void); int CfgPolicyUtilsFuncTest005(void); + +#ifndef __LITEOS__ int CfgPolicyUtilsFuncTest006(void); int CfgPolicyUtilsFuncTest007(void); int CfgPolicyUtilsFuncTest008(void); int CfgPolicyUtilsFuncTest009(void); int CfgPolicyUtilsFuncTest010(void); +#endif // __LITEOS__ #endif -- Gitee From d7cdd8bcbd4933d1ec1f17f47bf74f6d85dab2fa Mon Sep 17 00:00:00 2001 From: xiekaiming Date: Wed, 6 Mar 2024 12:03:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiekaiming --- frameworks/config_policy/BUILD.gn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frameworks/config_policy/BUILD.gn b/frameworks/config_policy/BUILD.gn index 76797ff..b818a15 100644 --- a/frameworks/config_policy/BUILD.gn +++ b/frameworks/config_policy/BUILD.gn @@ -46,9 +46,9 @@ if (defined(ohos_lite) && ohos_kernel_type == "liteos_m") { include_dirs = [ "$TEL_CORESERVICE_ROOT_DIR/utils/common/include" ] deps = [ "etc:customization_etc" ] external_deps = [ - "init:libbegetutil", "bounds_checking_function:libsec_shared", - ] + "init:libbegetutil", + ] install_images = [ "system", "updater", @@ -65,10 +65,10 @@ if (defined(ohos_lite) && ohos_kernel_type == "liteos_m") { sources = config_policy_sources public_configs = [ ":config_policy_config" ] include_dirs = [ "$TEL_CORESERVICE_ROOT_DIR/utils/common/include" ] - external_deps = [ + external_deps = [ "bounds_checking_function:libsec_shared", - "init:export_headers_lib" - ] + "init:export_headers_lib", + ] subsystem_name = "customization" part_name = "config_policy" } -- Gitee