Signed-off-by: zhangjidong <873721519@qq.com>
This commit is contained in:
zhangjidong 2024-03-30 11:02:22 +08:00
commit bdca63ce92
10 changed files with 54 additions and 49 deletions

View File

@ -1,8 +1,15 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
#
# HDF is dual licensed: you can use it either under the terms of
# the GPL, or the BSD license, at your option.
# See the LICENSE file in the root of this repository for complete details.
# 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.
export PWD := $(abspath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
export TARGET_DIR := $(PWD)

View File

@ -1,8 +1,15 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
#
# HDF is dual licensed: you can use it either under the terms of
# the GPL, or the BSD license, at your option.
# See the LICENSE file in the root of this repository for complete details.
# 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.
BOUNDS_CHECK_DIR := $(abspath ../../../third_party/bounds_checking_function)
INCLUDES = -I$(PWD) -I$(BOUNDS_CHECK_DIR)/include

View File

@ -32,7 +32,6 @@
"sub_component": [],
"inner_kits": [],
"test": [
"//foundation/ability/idl_tool/test/native:unittest",
"//foundation/ability/idl_tool/test/rust/moduletest:moduletest",
"//foundation/ability/idl_tool/test/rust/unittest:unittest",
"//foundation/ability/idl_tool/test/ts/moduletest:moduletest",

View File

@ -45,7 +45,11 @@ template("idl_gen_interface") {
idl_list = []
if (defined(invoker.sources)) {
idl_list += invoker.sources
not_needed(invoker, ["src_idl", "dst_file"])
not_needed(invoker,
[
"src_idl",
"dst_file",
])
} else {
assert(defined(invoker.src_idl), "src-idl is required!")
not_needed(invoker, [ "dst_file" ])
@ -55,7 +59,8 @@ template("idl_gen_interface") {
# language, default cpp, support c/cpp/rust
language = "cpp"
if (defined(invoker.language)) {
assert(invoker.language == "c" || invoker.language == "cpp" || invoker.language == "rust",
assert(invoker.language == "c" || invoker.language == "cpp" ||
invoker.language == "rust",
"the language must be set to 'c' or 'cpp' or 'rust', default 'cpp'")
language = invoker.language
}
@ -77,6 +82,7 @@ template("idl_gen_interface") {
name = string_replace(name, s, "_" + str_lower_list[i])
i = i + 1
}
# first letter
name_split = []
name_split = string_split(name, "_i_")
@ -134,9 +140,7 @@ template("idl_gen_interface") {
if ((language == "c" || language == "cpp") && defined(invoker.sources)) {
idl_headers_config = target_name + "_idl_headers_config"
config("$idl_headers_config") {
include_dirs = [
"${target_gen_dir}"
]
include_dirs = [ "${target_gen_dir}" ]
if (defined(invoker.sub_include)) {
include_dirs += invoker.sub_include
}
@ -160,9 +164,7 @@ template("idl_gen_interface") {
if (defined(invoker.sequenceable_pub_deps)) {
public_deps += invoker.sequenceable_pub_deps
}
external_deps = [
"c_utils:utils",
]
external_deps = [ "c_utils:utils" ]
if (defined(invoker.hitrace)) {
external_deps += [ "hitrace:hitrace_meter" ]
}
@ -217,9 +219,7 @@ template("idl_gen_interface") {
if (defined(invoker.sequenceable_pub_deps)) {
public_deps += invoker.sequenceable_pub_deps
}
external_deps = [
"c_utils:utils",
]
external_deps = [ "c_utils:utils" ]
if (defined(invoker.hitrace)) {
external_deps += [ "hitrace:hitrace_meter" ]
}
@ -253,6 +253,7 @@ template("idl_gen_interface") {
}
}
}
# generate code and shared library
group("$target_name" + "_idl_target") {
deps = [

View File

@ -42,7 +42,14 @@ def run_command(cmd, execution_path, input_arguments):
def idl_gen_interface(input_arguments):
(path, name) = os.path.split(input_arguments.idl_tool_path)
is_exists = os.path.exists(input_arguments.dst_path)
if is_exists:
if not is_exists:
try:
os.makedirs(input_arguments.dst_path, 0o750, exist_ok=True)
except (OSError, TypeError) as excep:
raise excep
finally:
pass
print("idl_gen_interface run os.remove start")
dst_file_list = input_arguments.dst_file.split(',')
for dst_file in dst_file_list:
@ -54,16 +61,6 @@ def idl_gen_interface(input_arguments):
os.remove(file_path)
print("idl_gen_interface run os.remove", i_dst_file)
is_exists = os.path.exists(input_arguments.dst_path)
if not is_exists:
try:
os.makedirs(input_arguments.dst_path, 0o750, exist_ok=True)
except (OSError, TypeError) as excep:
raise excep
finally:
pass
gen_language = "-gen-cpp"
if input_arguments.language == "rust":
gen_language = "-gen-rust"

View File

@ -34,14 +34,11 @@ idl_gen_interface("native_idl_test_service") {
config("ipc_test_config") {
include_dirs = [
"include",
"${IPC_SUBSYSTEM_DIR}/utils/include",
"${IPC_SUBSYSTEM_DIR}/ipc/native/src/mock/include",
]
}
ohos_executable("idl_server_test") {
sources = [
# "./src/idl_test_service_stub.cpp",
"./src/main_server.cpp",
"./src/test_service.cpp",
]
@ -56,6 +53,7 @@ ohos_executable("idl_server_test") {
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"samgr:samgr_proxy",
]
@ -65,7 +63,6 @@ ohos_executable("idl_server_test") {
ohos_executable("idl_client_test") {
sources = [
# "./src/idl_test_service_proxy.cpp",
"./src/main_client.cpp",
"./src/test_client.cpp",
]
@ -80,6 +77,7 @@ ohos_executable("idl_client_test") {
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_core",
"ipc:ipc_single",
"samgr:samgr_proxy",
]

View File

@ -17,7 +17,6 @@
#define OHOS_IPC_TEST_SERVICE_CLIENT_H
#include "ipc_debug.h"
#include "log_tags.h"
#include "idl_test_service_proxy.h"
#define LOG_ID_IPC 0xD003900

View File

@ -17,7 +17,6 @@
#define OHOS_IPC_TEST_SERVICE_H
#include "hilog/log.h"
#include "log_tags.h"
#include "idl_test_service_stub.h"
#define LOG_ID_IPC 0xD003900

View File

@ -18,7 +18,6 @@
#include "ipc_debug.h"
#include "ipc_skeleton.h"
#include "log_tags.h"
#include "test_client.h"
using namespace OHOS;

View File

@ -15,7 +15,6 @@
#include "ipc_debug.h"
#include "ipc_skeleton.h"
#include "log_tags.h"
#include "test_service.h"
using namespace OHOS;