mirror of
https://gitee.com/openharmony/ability_idl_tool
synced 2024-11-23 07:20:29 +00:00
Merge branch 'master' of https://gitee.com/zzdpy/ability_idl_tool
Signed-off-by: zhangjidong <873721519@qq.com>
This commit is contained in:
commit
bdca63ce92
15
Makefile
15
Makefile
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -45,18 +45,23 @@ 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"])
|
||||
idl_list += [get_path_info(invoker.src_idl, "file")]
|
||||
not_needed(invoker, [ "dst_file" ])
|
||||
idl_list += [ get_path_info(invoker.src_idl, "file") ]
|
||||
}
|
||||
|
||||
# language, default cpp, support c/cpp/rust
|
||||
language = "cpp"
|
||||
if (defined(invoker.language)) {
|
||||
assert(invoker.language == "c" || invoker.language == "cpp" || invoker.language == "rust",
|
||||
"the language must be set to 'c' or 'cpp' or 'rust', default 'cpp'")
|
||||
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
|
||||
}
|
||||
|
||||
@ -74,9 +79,10 @@ template("idl_gen_interface") {
|
||||
src_idl_fullpath += [ rebase_path(idl_name) ]
|
||||
name = string_replace(idl_name, ".idl", "")
|
||||
foreach(s, str_upper_list) {
|
||||
name = string_replace(name, s, "_"+str_lower_list[i])
|
||||
i = i+1
|
||||
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
|
||||
}
|
||||
@ -146,7 +150,7 @@ template("idl_gen_interface") {
|
||||
ohos_shared_library(lib_client) {
|
||||
sources = []
|
||||
output_values = get_target_outputs(action_target_name)
|
||||
sources += filter_include(output_values, ["*_proxy.cpp"])
|
||||
sources += filter_include(output_values, [ "*_proxy.cpp" ])
|
||||
if (defined(invoker.sources_cpp)) {
|
||||
sources += invoker.sources_cpp
|
||||
}
|
||||
@ -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" ]
|
||||
}
|
||||
@ -203,7 +205,7 @@ template("idl_gen_interface") {
|
||||
ohos_shared_library(lib_server) {
|
||||
sources = []
|
||||
output_values = get_target_outputs(action_target_name)
|
||||
sources += filter_include(output_values, ["*_stub.cpp"])
|
||||
sources += filter_include(output_values, [ "*_stub.cpp" ])
|
||||
if (defined(invoker.sources_cpp)) {
|
||||
sources += invoker.sources_cpp
|
||||
}
|
||||
@ -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 = [
|
||||
|
@ -42,20 +42,6 @@ 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:
|
||||
print("idl_gen_interface run os.remove start")
|
||||
dst_file_list = input_arguments.dst_file.split(',')
|
||||
for dst_file in dst_file_list:
|
||||
i_dst_file = 'i' + dst_file
|
||||
for file_name in os.listdir(input_arguments.dst_path):
|
||||
if ((file_name.startswith(dst_file) or file_name.startswith(i_dst_file)) and
|
||||
(file_name.endswith('.cpp') or file_name.endswith('.h'))):
|
||||
file_path = os.path.join(input_arguments.dst_path, file_name)
|
||||
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)
|
||||
@ -64,6 +50,17 @@ def idl_gen_interface(input_arguments):
|
||||
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:
|
||||
i_dst_file = 'i' + dst_file
|
||||
for file_name in os.listdir(input_arguments.dst_path):
|
||||
if ((file_name.startswith(dst_file) or file_name.startswith(i_dst_file)) and
|
||||
(file_name.endswith('.cpp') or file_name.endswith('.h'))):
|
||||
file_path = os.path.join(input_arguments.dst_path, file_name)
|
||||
os.remove(file_path)
|
||||
print("idl_gen_interface run os.remove", i_dst_file)
|
||||
|
||||
gen_language = "-gen-cpp"
|
||||
if input_arguments.language == "rust":
|
||||
gen_language = "-gen-rust"
|
||||
|
@ -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",
|
||||
]
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "ipc_debug.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "log_tags.h"
|
||||
#include "test_client.h"
|
||||
|
||||
using namespace OHOS;
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "ipc_debug.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "log_tags.h"
|
||||
#include "test_service.h"
|
||||
|
||||
using namespace OHOS;
|
||||
|
Loading…
Reference in New Issue
Block a user