diff --git a/BUILD.gn b/BUILD.gn index d90f564..2d857a7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -13,9 +13,11 @@ import("//build/lite/config/component/lite_component.gni") import("//build/ohos.gni") +import("config.gni") -config("pubilc") { +config("internal") { include_dirs = [ "include" ] + include_dirs += [ syscap_codec_config_path ] } sources_platform_common = [ @@ -25,7 +27,7 @@ sources_platform_common = [ ] ohos_executable("syscap_define_check_bin") { - include_dirs = [ "include" ] + configs = [ ":internal" ] sources = [ "./test/syscap_define_check.c" ] if (is_mingw) { @@ -53,7 +55,7 @@ ohos_executable("syscap_tool_bin") { output_name = "syscap_tool" install_enable = true include_dirs = [ "src" ] - public_configs = [ ":pubilc" ] + configs = [ ":internal" ] defines = [] if (is_mingw) { @@ -96,10 +98,8 @@ if (defined(ohos_lite)) { "-Wl,--version-script=${_version_script}", ] - include_dirs = [ - "include", - "src", - ] + include_dirs = [ "src" ] + configs += [ ":internal" ] public_configs = [ ":syscap_interface_public_config" ] sources = [ "./interfaces/inner_api/syscap_interface.c", @@ -116,10 +116,8 @@ if (defined(ohos_lite)) { } else { ohos_shared_library("syscap_interface_shared") { version_script = "libsyscap_interface_shared.versionscript" - include_dirs = [ - "include", - "src", - ] + include_dirs = [ "src" ] + configs = [ ":internal" ] public_configs = [ ":syscap_interface_public_config" ] sources = [ "./interfaces/inner_api/syscap_interface.c", diff --git a/bundle.json b/bundle.json index f05efa3..6190d87 100644 --- a/bundle.json +++ b/bundle.json @@ -13,7 +13,7 @@ "name": "syscap_codec", "subsystem": "developtools", "syscap": [ "SystemCapability.Developtools.Syscap" ], - "feature": [], + "feature": [ "syscap_codec_config_path" ], "adapted_system_type": [ "small", "standard" ], "deps": { "components": [ diff --git a/config.gni b/config.gni new file mode 100644 index 0000000..cbdf88c --- /dev/null +++ b/config.gni @@ -0,0 +1,18 @@ +# Copyright (C) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +declare_args() { + syscap_codec_config_path = + # customization for head file syscap_define.h. + "//developtools/syscap_codec/include/codec_config" +} diff --git a/include/syscap_define.h b/include/codec_config/syscap_define.h similarity index 100% rename from include/syscap_define.h rename to include/codec_config/syscap_define.h diff --git a/napi/BUILD.gn b/napi/BUILD.gn index d49937b..d10bbdf 100644 --- a/napi/BUILD.gn +++ b/napi/BUILD.gn @@ -13,6 +13,7 @@ import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") +import("../config.gni") base_output_path = get_label_info(":query_syscap", "target_out_dir") query_syscap_obj_path = base_output_path + "/query_syscap.o" @@ -31,13 +32,11 @@ sources_platform_common = [ ohos_shared_library("systemcapability") { include_dirs = [ - "//third_party/node/src", - "//foundation/arkui/napi/interfaces/kits", - "//developtools/syscap_codec/src", - "//developtools/syscap_codec/napi", - "//developtools/syscap_codec/interfaces/inner_api", - "//developtools/syscap_codec/include", + "../src", + "../interfaces/inner_api", + "../include", ] + include_dirs += [ syscap_codec_config_path ] sources = [ "napi_query_syscap.cpp" ] sources += sources_platform_common diff --git a/test/unittest/common/BUILD.gn b/test/unittest/common/BUILD.gn index 4c431f5..8560596 100644 --- a/test/unittest/common/BUILD.gn +++ b/test/unittest/common/BUILD.gn @@ -12,6 +12,8 @@ # limitations under the License. import("//build/lite/config/component/lite_component.gni") +import("../../../config.gni") + if (defined(ohos_lite)) { import("//build/lite/config/test.gni") @@ -23,22 +25,21 @@ if (defined(ohos_lite)) { output_dir = test_output_root include_dirs = [ - "//commonlibrary/c_utils/base/include", "//third_party/node/src", - "//third_party/googletest/include", - "//developtools/syscap_codec/src/", - "//developtools/syscap_codec/include/", - "//developtools/syscap_codec/interfaces/inner_api/", - "//developtools/syscap_codec/test/unittest/common/include/", + "../../../src/", + "../../../include/", + "../../../interfaces/inner_api/", + "include/", ] + include_dirs += [ syscap_codec_config_path ] cflags = [ "-g3" ] sources = [ - "//developtools/syscap_codec/interfaces/inner_api/syscap_interface.c", - "//developtools/syscap_codec/src/create_pcid.c", - "//developtools/syscap_codec/src/endian_internal.c", - "//developtools/syscap_codec/src/syscap_tool.c", + "../../../interfaces/inner_api/syscap_interface.c", + "../../../src/create_pcid.c", + "../../../src/endian_internal.c", + "../../../src/syscap_tool.c", "syscap_codec_test.cpp", ] @@ -46,11 +47,10 @@ if (defined(ohos_lite)) { deps = [ "//base//hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//build/lite/config/component/cJSON:cjson_static", "//test/testfwk/developer_test/third_party/lib/cpp:gtest_main", "//third_party/bounds_checking_function:libsec_static", ] - - deps += [ "//build/lite/config/component/cJSON:cjson_static" ] } } @@ -69,26 +69,26 @@ if (defined(ohos_lite)) { module_out_path = module_output_path include_dirs = [ - "//developtools/syscap_codec/src/", - "//developtools/syscap_codec/include/", - "//developtools/syscap_codec/interfaces/inner_api/", - "//developtools/syscap_codec/test/unittest/common/include/", + "../../../src", + "../../../include", + "../../../interfaces/inner_api", + "../../../test/unittest/common/include", ] + include_dirs += [ syscap_codec_config_path ] sources = [ - "//developtools/syscap_codec/interfaces/inner_api/syscap_interface.c", - "//developtools/syscap_codec/src/create_pcid.c", - "//developtools/syscap_codec/src/endian_internal.c", - "//developtools/syscap_codec/src/syscap_tool.c", + "../../../interfaces/inner_api/syscap_interface.c", + "../../../src/create_pcid.c", + "../../../src/endian_internal.c", + "../../../src/syscap_tool.c", "syscap_codec_test.cpp", ] deps = [ "//third_party/bounds_checking_function:libsec_static", + "//third_party/cJSON:cjson_static", "//third_party/googletest:gtest_main", ] - - deps += [ "//third_party/cJSON:cjson_static" ] } group("unittest") {