diff --git a/bundle.json b/bundle.json index cf2c9933ec771c0651d7a5e771c6c9b379b32783..2eb63d47622edcd2fa9a3112594658ca99f1c72e 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 978cbc6e6ce811b21f0a4d19461399fbe228963c..b818a1577a2dd9c54776b10a31d84dc05879bb2c 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", + include_dirs = [ "$TEL_CORESERVICE_ROOT_DIR/utils/common/include" ] + deps = [ "etc:customization_etc" ] + external_deps = [ + "bounds_checking_function:libsec_shared", + "init:libbegetutil", ] - external_deps = [ "init:libbegetutil" ] 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 54d8ca3a64525c81ec5441da70a99cacda6233fc..1693d3d3843693e39c92b12ba3fc61c35edb3c70 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 2ef63286431b4ec1d21bcd01faf8e7fcfcf17ee3..01b1b766ed17a5b25899038a23b58e791e208f40 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 10642eaffdaadc5da286516c8e0bd61ea8b8599e..b0e4c6a4e77f01254325502f3315f76548112372 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 f38d113549847bbc9de20aef5cc263b84ee8e0d4..6128a94eb2bed6af0eb503ed70441f1706a0ea71 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 538dad507cddc96b9d24c6446c4e144ccfa30e2f..3c886aaac494d5791f16f8771d58e1d2eec3894b 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