From dab16a982e60e9e40659b151b67242d759cb7052 Mon Sep 17 00:00:00 2001 From: chen Date: Thu, 13 Jan 2022 12:20:27 +0800 Subject: [PATCH] update gn Signed-off-by: chen Change-Id: Id0c17f3187e35db9e45156ad69e3b4074dda1658 --- bundle.json | 2 +- interfaces/innerkits/samgr_proxy/BUILD.gn | 16 +-- .../include/system_ability_definition.h | 2 +- services/samgr/native/BUILD.gn | 14 +-- services/samgr/native/test/unittest/BUILD.gn | 7 +- utils/native/include/parcel_helper.h | 113 ++++++++++++++++++ 6 files changed, 127 insertions(+), 27 deletions(-) mode change 100644 => 100755 interfaces/innerkits/samgr_proxy/BUILD.gn mode change 100644 => 100755 services/samgr/native/BUILD.gn create mode 100755 utils/native/include/parcel_helper.h diff --git a/bundle.json b/bundle.json index 9361510e..362cb268 100755 --- a/bundle.json +++ b/bundle.json @@ -1,6 +1,6 @@ { "name": "@ohos/distributedschedule_samgr", - "description": "提供系统服务的注册、发现能力。", + "description": "system ability manager", "homePage": "https://gitee.com/openharmony", "version": "3.1", "license": "Apache License 2.0", diff --git a/interfaces/innerkits/samgr_proxy/BUILD.gn b/interfaces/innerkits/samgr_proxy/BUILD.gn old mode 100644 new mode 100755 index 63687db4..6ada9ec6 --- a/interfaces/innerkits/samgr_proxy/BUILD.gn +++ b/interfaces/innerkits/samgr_proxy/BUILD.gn @@ -15,24 +15,16 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") config("samgr_proxy_config") { - include_dirs = [ - "include", - "//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include", - ] + include_dirs = [ "include" ] } config("samgr_proxy_private_config") { include_dirs = [ - "//utils/native/base/include", - "//utils/system/safwk/native/include", - "../../../services/lsamgr/include", + "include", "//foundation/distributedschedule/samgr/interfaces/innerkits/lsamgr", "//foundation/distributedschedule/samgr/services/lsamgr/include", - "//developtools/liblog", "//foundation/distributedschedule/samgr/services/samgr/native/include", - "//foundation/distributedschedule/samgr/frameworks/native/jni/include", - "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include", - "//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include", + "//foundation/distributedschedule/samgr/utils/native/include", ] } @@ -51,9 +43,9 @@ ohos_shared_library("samgr_proxy") { external_deps = [ "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", + "utils_base:utils", ] - deps = [ "//utils/native/base:utils" ] part_name = "samgr_standard" } subsystem_name = "distributedschedule" diff --git a/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h b/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h index 856ddbb3..6245d399 100755 --- a/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h +++ b/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 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 diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn old mode 100644 new mode 100755 index bc7fa7c1..e76dcb15 --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -16,24 +16,18 @@ import("//build/ohos_var.gni") config("distributed_store_config") { visibility = [ ":*" ] - include_dirs = [ - "//foundation/distributedschedule/samgr/services/samgr/native/include", - "//third_party/json/include", - "//foundation/distributedschedule/dmsfwk/services/dtbdecidefwk/include", - ] + include_dirs = + [ "//foundation/distributedschedule/samgr/services/samgr/native/include" ] } config("sam_config") { # header file path include_dirs = [ - "//developtools/liblog", "//foundation/distributedschedule/samgr/services/samgr/native/include", - "//foundation/distributedschedule/samgr/services/samgr/java/include", "//foundation/distributedschedule/samgr/utils/native/include", - "//utils/native/base/include", - "//utils/system/safwk/native/include", "//foundation/distributedschedule/samgr/services/lsamgr/include", "//foundation/distributedschedule/samgr/interfaces/innerkits/common/include", + "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include", ] } @@ -68,7 +62,6 @@ ohos_executable("samgr") { "//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common", "//foundation/distributedschedule/samgr/interfaces/innerkits/lsamgr:lsamgr", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - "//utils/native/base:utils", ] configs = [ @@ -85,6 +78,7 @@ ohos_executable("samgr") { "init:libbegetutil", "ipc:ipc_core", "ipc:libdbinder", + "utils_base:utils", ] public_deps = [ "//third_party/libxml2:libxml2" ] part_name = "samgr_standard" diff --git a/services/samgr/native/test/unittest/BUILD.gn b/services/samgr/native/test/unittest/BUILD.gn index a930ae3f..619656d2 100755 --- a/services/samgr/native/test/unittest/BUILD.gn +++ b/services/samgr/native/test/unittest/BUILD.gn @@ -21,7 +21,7 @@ config("sam_test_config") { visibility = [ ":*" ] include_dirs = [ "${samgr_services_dir}/test/unittest/include", - "//utils/system/safwk/native/include", + "//foundation/distributedschedule/samgr/utils/native/include", ] } @@ -56,7 +56,6 @@ ohos_unittest("SystemAbilityMgrTest") { "${samgr_dir}/interfaces/innerkits/lsamgr:lsamgr", "${samgr_dir}/interfaces/innerkits/samgr_proxy:samgr_proxy", "//third_party/googletest:gtest_main", - "//utils/native/base:utils", ] external_deps = [ @@ -65,6 +64,7 @@ ohos_unittest("SystemAbilityMgrTest") { "init:libbegetutil", "ipc:ipc_core", "ipc:libdbinder", + "utils_base:utils", ] } @@ -74,7 +74,7 @@ ohos_executable("ondemand") { ":sam_test_config", "${samgr_dir}/interfaces/innerkits/lsamgr:config_samgr", ] - deps = [ "//utils/native/base:utils" ] + deps = [ "${samgr_dir}/interfaces/innerkits/samgr_proxy:samgr_proxy" ] if (is_standard_system) { external_deps = [ "hiviewdfx_hilog_native:libhilog_base" ] } else { @@ -88,6 +88,7 @@ ohos_executable("ondemand") { external_deps += [ "ipc:ipc_core", "samgr_standard:samgr_proxy", + "utils_base:utils", ] part_name = "samgr_standard" subsystem_name = "distributedschedule" diff --git a/utils/native/include/parcel_helper.h b/utils/native/include/parcel_helper.h new file mode 100755 index 00000000..c998a2bb --- /dev/null +++ b/utils/native/include/parcel_helper.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2022 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. + */ + +#ifndef OHOS_DISTRIBUTED_SCHEDULE_PARCEL_HELPER_H +#define OHOS_DISTRIBUTED_SCHEDULE_PARCEL_HELPER_H + +#include + +#include "sam_log.h" + +namespace OHOS { +namespace DistributedSchedule { +#define PARCEL_WRITE_HELPER(parcel, type, value) \ + do { \ + bool ret = parcel.Write##type((value)); \ + if (!ret) { \ + HILOGE("%{public}s write value failed!", __func__); \ + return ERR_FLATTEN_OBJECT; \ + } \ + } while (0) + +#define PARCEL_WRITE_HELPER_NORET(parcel, type, value) \ + do { \ + bool ret = parcel.Write##type((value)); \ + if (!ret) { \ + HILOGE("%{public}s write value failed!", __func__); \ + return; \ + } \ + } while (0) + +#define PARCEL_WRITE_HELPER_RET(parcel, type, value, failRet) \ + do { \ + bool ret = parcel.Write##type((value)); \ + if (!ret) { \ + HILOGE("%{public}s write value failed!", __func__); \ + return failRet; \ + } \ + } while (0) + +#define PARCEL_READ_HELPER(parcel, type, out) \ + do { \ + bool ret = parcel.Read##type((out)); \ + if (!ret) { \ + HILOGE("%{public}s read value failed!", __func__); \ + return ERR_FLATTEN_OBJECT; \ + } \ + } while (0) + +#define PARCEL_READ_HELPER_RET(parcel, type, out, failRet) \ + do { \ + bool ret = parcel.Read##type((out)); \ + if (!ret) { \ + HILOGE("%{public}s read value failed!", __func__); \ + return failRet; \ + } \ + } while (0) + +#define PARCEL_READ_HELPER_NORET(parcel, type, out) \ + do { \ + bool ret = parcel.Read##type((out)); \ + if (!ret) { \ + HILOGW("%{public}s read value failed!", __func__); \ + } \ + } while (0) + +#define PARCEL_TRANSACT_SYNC_RET_INT(remote, code, data, reply) \ + do { \ + MessageOption option; \ + int32_t error = remote->SendRequest(code, data, reply, option); \ + if (error != ERR_NONE) { \ + HILOGE("%{public}s transact failed, error: %{public}d", __func__, error); \ + return error; \ + } \ + int32_t result = reply.ReadInt32(); \ + HILOGD("%{public}s get result from server data = %{public}d", __func__, result); \ + return result; \ + } while (0) + +#define PARCEL_TRANSACT_SYNC_NORET(remote, code, data, reply) \ + do { \ + MessageOption option; \ + int32_t error = remote->SendRequest(code, data, reply, option); \ + if (error != ERR_NONE) { \ + HILOGE("%{public}s transact failed, error: %{public}d", __func__, error); \ + return; \ + } \ + HILOGD("%{public}s transact success!", __func__); \ + } while (0) + +#define PARCEL_WRITE_REPLY_NOERROR(reply, type, result) \ + do { \ + bool ret = reply.Write##type(result); \ + if (!ret) { \ + HILOGW("%{public}s write reply failed.", __func__); \ + } \ + return ERR_NONE; \ + } while (0) +} // namespace DistributedSchedule +} // namespace OHOS + +#endif /* OHOS_DISTRIBUTED_SCHEDULE_PARCEL_HELPER_H */ -- Gitee