modify tdsafeFunc

Signed-off-by: zhaojunxia <zhaojunxia@kaihong.com>
This commit is contained in:
zhaojunxia 2023-12-04 23:03:48 -08:00
parent c3dfd51bdd
commit b43d5ba906
24 changed files with 0 additions and 3091 deletions

View File

@ -1,40 +0,0 @@
# Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
import("//build/ohos.gni")
ohos_shared_library("napitest")
{
sources = [
"napitest_middle.cpp",
"napitest.cpp",
"tool_utility.cpp",
]
include_dirs = [
".",
"//third_party/node/src",
]
deps=[
"//foundation/ace/napi:ace_napi",
]
remove_configs = [ "//build/config/compiler:no_rtti" ]
cflags=[
]
cflags_cc=[
"-frtti",
]
ldflags = [
]
relative_install_dir = "module"
part_name = "test"
subsystem_name = "napitest"
}

View File

@ -1,25 +0,0 @@
# Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
{
"targets": [
{
"target_name": "napitest",
"sources": [
"./napitest.cpp",
"./napitest_middle.cpp",
"./tool_utility.cpp"],
"include_dirs": ["."],
"cflags_cc": [ "-frtti","-std=c++17" ]
}
]
}

View File

@ -1,324 +0,0 @@
# We borrow heavily from the kernel build setup, though we are simpler since
# we don't have Kconfig tweaking settings on us.
# The implicit make rules have it looking for RCS files, among other things.
# We instead explicitly write all the rules we care about.
# It's even quicker (saves ~200ms) to pass -r on the command line.
MAKEFLAGS=-r
# The source directory tree.
srcdir := ..
abs_srcdir := $(abspath $(srcdir))
# The name of the builddir.
builddir_name ?= .
# The V=1 flag on command line makes us verbosely print command lines.
ifdef V
quiet=
else
quiet=quiet_
endif
# Specify BUILDTYPE=Release on the command line for a release build.
BUILDTYPE ?= Release
# Directory all our build output goes into.
# Note that this must be two directories beneath src/ for unit tests to pass,
# as they reach into the src/ directory for data with relative paths.
builddir ?= $(builddir_name)/$(BUILDTYPE)
abs_builddir := $(abspath $(builddir))
depsdir := $(builddir)/.deps
# Object output directory.
obj := $(builddir)/obj
abs_obj := $(abspath $(obj))
# We build up a list of every single one of the targets so we can slurp in the
# generated dependency rule Makefiles in one pass.
all_deps :=
CC.target ?= $(CC)
CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS)
CXX.target ?= $(CXX)
CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS)
LINK.target ?= $(LINK)
LDFLAGS.target ?= $(LDFLAGS)
AR.target ?= $(AR)
# C++ apps need to be linked with g++.
LINK ?= $(CXX.target)
# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
# to replicate this environment fallback in make as well.
CC.host ?= gcc
CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host)
CXX.host ?= g++
CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host)
LINK.host ?= $(CXX.host)
LDFLAGS.host ?= $(LDFLAGS_host)
AR.host ?= ar
# Define a dir function that can handle spaces.
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
# "leading spaces cannot appear in the text of the first argument as written.
# These characters can be put into the argument value by variable substitution."
empty :=
space := $(empty) $(empty)
# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
replace_spaces = $(subst $(space),?,$1)
unreplace_spaces = $(subst ?,$(space),$1)
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
# Flags to make gcc output dependency info. Note that you need to be
# careful here to use the flags that ccache and distcc can understand.
# We write to a dep file on the side first and then rename at the end
# so we can't end up with a broken dep file.
depfile = $(depsdir)/$(call replace_spaces,$@).d
DEPFLAGS = -MMD -MF $(depfile).raw
# We have to fixup the deps output in a few ways.
# (1) the file output should mention the proper .o file.
# ccache or distcc lose the path to the target, so we convert a rule of
# the form:
# foobar.o: DEP1 DEP2
# into
# path/to/foobar.o: DEP1 DEP2
# (2) we want missing files not to cause us to fail to build.
# We want to rewrite
# foobar.o: DEP1 DEP2 \
# DEP3
# to
# DEP1:
# DEP2:
# DEP3:
# so if the files are missing, they're just considered phony rules.
# We have to do some pretty insane escaping to get those backslashes
# and dollar signs past make, the shell, and sed at the same time.
# Doesn't work with spaces, but that's fine: .d files have spaces in
# their names replaced with other characters.
define fixup_dep
# The depfile may not exist if the input file didn't have any #includes.
touch $(depfile).raw
# Fixup path as in (1).
sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
# Add extra rules as in (2).
# We remove slashes and replace spaces with new lines;
# remove blank lines;
# delete the first line and append a colon to the remaining lines.
sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
grep -v '^$$' |\
sed -e 1d -e 's|$$|:|' \
>> $(depfile)
rm $(depfile).raw
endef
# Command definitions:
# - cmd_foo is the actual command to run;
# - quiet_cmd_foo is the brief-output summary of the command.
quiet_cmd_cc = CC($(TOOLSET)) $@
cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c
quiet_cmd_cxx = CXX($(TOOLSET)) $@
cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c
quiet_cmd_touch = TOUCH $@
cmd_touch = touch $@
quiet_cmd_copy = COPY $@
# send stderr to /dev/null to ignore messages when linking directories.
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@")
quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
# Due to circular dependencies between libraries :(, we wrap the
# special "figure out circular dependencies" flags around the entire
# input list during linking.
quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group
# We support two kinds of shared objects (.so):
# 1) shared_library, which is just bundling together many dependent libraries
# into a link line.
# 2) loadable_module, which is generating a module intended for dlopen().
#
# They differ only slightly:
# In the former case, we want to package all dependent code into the .so.
# In the latter case, we want to package just the API exposed by the
# outermost module.
# This means shared_library uses --whole-archive, while loadable_module doesn't.
# (Note that --whole-archive is incompatible with the --start-group used in
# normal linking.)
# Other shared-object link notes:
# - Set SONAME to the library filename so our binaries don't reference
# the local, absolute paths used on the link command-line.
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
# Define an escape_quotes function to escape single quotes.
# This allows us to handle quotes properly as long as we always use
# use single quotes and escape_quotes.
escape_quotes = $(subst ','\'',$(1))
# This comment is here just to include a ' to unconfuse syntax highlighting.
# Define an escape_vars function to escape '$' variable syntax.
# This allows us to read/write command lines with shell variables (e.g.
# $LD_LIBRARY_PATH), without triggering make substitution.
escape_vars = $(subst $$,$$$$,$(1))
# Helper that expands to a shell command to echo a string exactly as it is in
# make. This uses printf instead of echo because printf's behaviour with respect
# to escape sequences is more portable than echo's across different shells
# (e.g., dash, bash).
exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
# Helper to compare the command we're about to run against the command
# we logged the last time we ran the command. Produces an empty
# string (false) when the commands match.
# Tricky point: Make has no string-equality test function.
# The kernel uses the following, but it seems like it would have false
# positives, where one string reordered its arguments.
# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
# $(filter-out $(cmd_$@), $(cmd_$(1))))
# We instead substitute each for the empty string into the other, and
# say they're equal if both substitutions produce the empty string.
# .d files contain ? instead of spaces, take that into account.
command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
$(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
# Helper that is non-empty when a prerequisite changes.
# Normally make does this implicitly, but we force rules to always run
# so we can check their command lines.
# $? -- new prerequisites
# $| -- order-only dependencies
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
# Helper that executes all postbuilds until one fails.
define do_postbuilds
@E=0;\
for p in $(POSTBUILDS); do\
eval $$p;\
E=$$?;\
if [ $$E -ne 0 ]; then\
break;\
fi;\
done;\
if [ $$E -ne 0 ]; then\
rm -rf "$@";\
exit $$E;\
fi
endef
# do_cmd: run a command via the above cmd_foo names, if necessary.
# Should always run for a given target to handle command-line changes.
# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
# Third argument, if non-zero, makes it do POSTBUILDS processing.
# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
# spaces already and dirx strips the ? characters.
define do_cmd
$(if $(or $(command_changed),$(prereq_changed)),
@$(call exact_echo, $($(quiet)cmd_$(1)))
@mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
$(if $(findstring flock,$(word 1,$(cmd_$1))),
@$(cmd_$(1))
@echo " $(quiet_cmd_$(1)): Finished",
@$(cmd_$(1))
)
@$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
@$(if $(2),$(fixup_dep))
$(if $(and $(3), $(POSTBUILDS)),
$(call do_postbuilds)
)
)
endef
# Declare the "all" target first so it is the default,
# even though we don't have the deps yet.
.PHONY: all
all:
# make looks for ways to re-generate included makefiles, but in our case, we
# don't have a direct way. Explicitly telling make that it has nothing to do
# for them makes it go faster.
%.d: ;
# Use FORCE_DO_CMD to force a target to run. Should be coupled with
# do_cmd.
.PHONY: FORCE_DO_CMD
FORCE_DO_CMD:
TOOLSET := target
# Suffix rules, putting all outputs into $(obj).
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
@$(call do_cmd,cc,1)
# Try building from generated source, too.
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
@$(call do_cmd,cc,1)
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
$(findstring $(join ^,$(prefix)),\
$(join ^,napitest.target.mk)))),)
include napitest.target.mk
endif
quiet_cmd_regen_makefile = ACTION Regenerating $@
cmd_regen_makefile = cd $(srcdir); /home/zhaojunxia/napi/napi_generator_0824/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/root/.cache/node-gyp/20.5.1" "-Dnode_gyp_dir=/home/zhaojunxia/napi/napi_generator_0824/node_modules/node-gyp" "-Dnode_lib_file=/root/.cache/node-gyp/20.5.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/zhaojunxia/napi/napi_generator_0824/test/storytest/test_threadsafe_func/out" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/zhaojunxia/napi/napi_generator_0824/test/storytest/test_threadsafe_func/out/build/config.gypi -I/home/zhaojunxia/napi/napi_generator_0824/node_modules/node-gyp/addon.gypi -I/root/.cache/node-gyp/20.5.1/include/node/common.gypi "--toplevel-dir=." binding.gyp
Makefile: $(srcdir)/../../../../node_modules/node-gyp/addon.gypi $(srcdir)/../../../../../../../../root/.cache/node-gyp/20.5.1/include/node/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp
$(call do_cmd,regen_makefile)
# "all" is a concatenation of the "all" targets from all the included
# sub-makefiles. This is just here to clarify.
all:
# Add in dependency-tracking rules. $(all_deps) is the list of every single
# target in our tree. Only consider the ones with .d (dependency) info:
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
ifneq ($(d_files),)
include $(d_files)
endif

View File

@ -1 +0,0 @@
cmd_Release/napitest.node := ln -f "Release/obj.target/napitest.node" "Release/napitest.node" 2>/dev/null || (rm -rf "Release/napitest.node" && cp -af "Release/obj.target/napitest.node" "Release/napitest.node")

View File

@ -1 +0,0 @@
cmd_Release/obj.target/napitest.node := g++ -o Release/obj.target/napitest.node -shared -pthread -rdynamic -m64 -Wl,-soname=napitest.node -Wl,--start-group Release/obj.target/napitest/napitest.o Release/obj.target/napitest/napitest_middle.o Release/obj.target/napitest/tool_utility.o -Wl,--end-group

View File

@ -1,16 +0,0 @@
cmd_Release/obj.target/napitest/napitest.o := g++ -o Release/obj.target/napitest/napitest.o ../napitest.cpp '-DNODE_GYP_MODULE_NAME=napitest' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/20.5.1/include/node -I/root/.cache/node-gyp/20.5.1/src -I/root/.cache/node-gyp/20.5.1/deps/openssl/config -I/root/.cache/node-gyp/20.5.1/deps/openssl/openssl/include -I/root/.cache/node-gyp/20.5.1/deps/uv/include -I/root/.cache/node-gyp/20.5.1/deps/zlib -I/root/.cache/node-gyp/20.5.1/deps/v8/include -I../. -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++17 -frtti -std=c++17 -MMD -MF ./Release/.deps/Release/obj.target/napitest/napitest.o.d.raw -c
Release/obj.target/napitest/napitest.o: ../napitest.cpp ../napitest.h \
../napitest_middle.h \
/root/.cache/node-gyp/20.5.1/include/node/node_api.h \
/root/.cache/node-gyp/20.5.1/include/node/js_native_api.h \
/root/.cache/node-gyp/20.5.1/include/node/js_native_api_types.h \
/root/.cache/node-gyp/20.5.1/include/node/node_api_types.h \
../tool_utility.h
../napitest.cpp:
../napitest.h:
../napitest_middle.h:
/root/.cache/node-gyp/20.5.1/include/node/node_api.h:
/root/.cache/node-gyp/20.5.1/include/node/js_native_api.h:
/root/.cache/node-gyp/20.5.1/include/node/js_native_api_types.h:
/root/.cache/node-gyp/20.5.1/include/node/node_api_types.h:
../tool_utility.h:

View File

@ -1,15 +0,0 @@
cmd_Release/obj.target/napitest/napitest_middle.o := g++ -o Release/obj.target/napitest/napitest_middle.o ../napitest_middle.cpp '-DNODE_GYP_MODULE_NAME=napitest' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/20.5.1/include/node -I/root/.cache/node-gyp/20.5.1/src -I/root/.cache/node-gyp/20.5.1/deps/openssl/config -I/root/.cache/node-gyp/20.5.1/deps/openssl/openssl/include -I/root/.cache/node-gyp/20.5.1/deps/uv/include -I/root/.cache/node-gyp/20.5.1/deps/zlib -I/root/.cache/node-gyp/20.5.1/deps/v8/include -I../. -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++17 -frtti -std=c++17 -MMD -MF ./Release/.deps/Release/obj.target/napitest/napitest_middle.o.d.raw -c
Release/obj.target/napitest/napitest_middle.o: ../napitest_middle.cpp \
/root/.cache/node-gyp/20.5.1/include/node/node_api.h \
/root/.cache/node-gyp/20.5.1/include/node/js_native_api.h \
/root/.cache/node-gyp/20.5.1/include/node/js_native_api_types.h \
/root/.cache/node-gyp/20.5.1/include/node/node_api_types.h \
../tool_utility.h ../napitest_middle.h ../napitest.h
../napitest_middle.cpp:
/root/.cache/node-gyp/20.5.1/include/node/node_api.h:
/root/.cache/node-gyp/20.5.1/include/node/js_native_api.h:
/root/.cache/node-gyp/20.5.1/include/node/js_native_api_types.h:
/root/.cache/node-gyp/20.5.1/include/node/node_api_types.h:
../tool_utility.h:
../napitest_middle.h:
../napitest.h:

View File

@ -1,24 +0,0 @@
cmd_Release/obj.target/napitest/tool_utility.o := g++ -o Release/obj.target/napitest/tool_utility.o ../tool_utility.cpp '-DNODE_GYP_MODULE_NAME=napitest' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/20.5.1/include/node -I/root/.cache/node-gyp/20.5.1/src -I/root/.cache/node-gyp/20.5.1/deps/openssl/config -I/root/.cache/node-gyp/20.5.1/deps/openssl/openssl/include -I/root/.cache/node-gyp/20.5.1/deps/uv/include -I/root/.cache/node-gyp/20.5.1/deps/zlib -I/root/.cache/node-gyp/20.5.1/deps/v8/include -I../. -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++17 -frtti -std=c++17 -MMD -MF ./Release/.deps/Release/obj.target/napitest/tool_utility.o.d.raw -c
Release/obj.target/napitest/tool_utility.o: ../tool_utility.cpp \
../tool_utility.h /root/.cache/node-gyp/20.5.1/include/node/node_api.h \
/root/.cache/node-gyp/20.5.1/include/node/js_native_api.h \
/root/.cache/node-gyp/20.5.1/include/node/js_native_api_types.h \
/root/.cache/node-gyp/20.5.1/include/node/node_api_types.h \
/root/.cache/node-gyp/20.5.1/include/node/uv.h \
/root/.cache/node-gyp/20.5.1/include/node/uv/errno.h \
/root/.cache/node-gyp/20.5.1/include/node/uv/version.h \
/root/.cache/node-gyp/20.5.1/include/node/uv/unix.h \
/root/.cache/node-gyp/20.5.1/include/node/uv/threadpool.h \
/root/.cache/node-gyp/20.5.1/include/node/uv/linux.h
../tool_utility.cpp:
../tool_utility.h:
/root/.cache/node-gyp/20.5.1/include/node/node_api.h:
/root/.cache/node-gyp/20.5.1/include/node/js_native_api.h:
/root/.cache/node-gyp/20.5.1/include/node/js_native_api_types.h:
/root/.cache/node-gyp/20.5.1/include/node/node_api_types.h:
/root/.cache/node-gyp/20.5.1/include/node/uv.h:
/root/.cache/node-gyp/20.5.1/include/node/uv/errno.h:
/root/.cache/node-gyp/20.5.1/include/node/uv/version.h:
/root/.cache/node-gyp/20.5.1/include/node/uv/unix.h:
/root/.cache/node-gyp/20.5.1/include/node/uv/threadpool.h:
/root/.cache/node-gyp/20.5.1/include/node/uv/linux.h:

View File

@ -1,6 +0,0 @@
# This file is generated by gyp; do not edit.
export builddir_name ?= ./build/.
.PHONY: all
all:
$(MAKE) napitest

View File

@ -1,426 +0,0 @@
# Do not edit. File was generated by node-gyp's "configure" step
{
"target_defaults": {
"cflags": [],
"default_configuration": "Release",
"defines": [],
"include_dirs": [],
"libraries": []
},
"variables": {
"asan": 0,
"coverage": "false",
"dcheck_always_on": 0,
"debug_nghttp2": "false",
"debug_node": "false",
"enable_lto": "false",
"enable_pgo_generate": "false",
"enable_pgo_use": "false",
"error_on_warn": "false",
"force_dynamic_crt": 0,
"gas_version": "2.35",
"host_arch": "x64",
"icu_data_in": "../../deps/icu-tmp/icudt73l.dat",
"icu_endianness": "l",
"icu_gyp_path": "tools/icu/icu-generic.gyp",
"icu_path": "deps/icu-small",
"icu_small": "false",
"icu_ver_major": "73",
"is_debug": 0,
"libdir": "lib",
"llvm_version": "0.0",
"napi_build_version": "9",
"node_builtin_shareable_builtins": [
"deps/cjs-module-lexer/lexer.js",
"deps/cjs-module-lexer/dist/lexer.js",
"deps/undici/undici.js"
],
"node_byteorder": "little",
"node_debug_lib": "false",
"node_enable_d8": "false",
"node_enable_v8_vtunejit": "false",
"node_fipsinstall": "false",
"node_install_corepack": "true",
"node_install_npm": "true",
"node_library_files": [
"lib/_http_agent.js",
"lib/_http_client.js",
"lib/_http_common.js",
"lib/_http_incoming.js",
"lib/_http_outgoing.js",
"lib/_http_server.js",
"lib/_stream_duplex.js",
"lib/_stream_passthrough.js",
"lib/_stream_readable.js",
"lib/_stream_transform.js",
"lib/_stream_wrap.js",
"lib/_stream_writable.js",
"lib/_tls_common.js",
"lib/_tls_wrap.js",
"lib/assert.js",
"lib/assert/strict.js",
"lib/async_hooks.js",
"lib/buffer.js",
"lib/child_process.js",
"lib/cluster.js",
"lib/console.js",
"lib/constants.js",
"lib/crypto.js",
"lib/dgram.js",
"lib/diagnostics_channel.js",
"lib/dns.js",
"lib/dns/promises.js",
"lib/domain.js",
"lib/events.js",
"lib/fs.js",
"lib/fs/promises.js",
"lib/http.js",
"lib/http2.js",
"lib/https.js",
"lib/inspector.js",
"lib/inspector/promises.js",
"lib/internal/abort_controller.js",
"lib/internal/assert.js",
"lib/internal/assert/assertion_error.js",
"lib/internal/assert/calltracker.js",
"lib/internal/async_hooks.js",
"lib/internal/blob.js",
"lib/internal/blocklist.js",
"lib/internal/bootstrap/node.js",
"lib/internal/bootstrap/realm.js",
"lib/internal/bootstrap/switches/does_not_own_process_state.js",
"lib/internal/bootstrap/switches/does_own_process_state.js",
"lib/internal/bootstrap/switches/is_main_thread.js",
"lib/internal/bootstrap/switches/is_not_main_thread.js",
"lib/internal/bootstrap/web/exposed-wildcard.js",
"lib/internal/bootstrap/web/exposed-window-or-worker.js",
"lib/internal/buffer.js",
"lib/internal/child_process.js",
"lib/internal/child_process/serialization.js",
"lib/internal/cli_table.js",
"lib/internal/cluster/child.js",
"lib/internal/cluster/primary.js",
"lib/internal/cluster/round_robin_handle.js",
"lib/internal/cluster/shared_handle.js",
"lib/internal/cluster/utils.js",
"lib/internal/cluster/worker.js",
"lib/internal/console/constructor.js",
"lib/internal/console/global.js",
"lib/internal/constants.js",
"lib/internal/crypto/aes.js",
"lib/internal/crypto/certificate.js",
"lib/internal/crypto/cfrg.js",
"lib/internal/crypto/cipher.js",
"lib/internal/crypto/diffiehellman.js",
"lib/internal/crypto/ec.js",
"lib/internal/crypto/hash.js",
"lib/internal/crypto/hashnames.js",
"lib/internal/crypto/hkdf.js",
"lib/internal/crypto/keygen.js",
"lib/internal/crypto/keys.js",
"lib/internal/crypto/mac.js",
"lib/internal/crypto/pbkdf2.js",
"lib/internal/crypto/random.js",
"lib/internal/crypto/rsa.js",
"lib/internal/crypto/scrypt.js",
"lib/internal/crypto/sig.js",
"lib/internal/crypto/util.js",
"lib/internal/crypto/webcrypto.js",
"lib/internal/crypto/webidl.js",
"lib/internal/crypto/x509.js",
"lib/internal/debugger/inspect.js",
"lib/internal/debugger/inspect_client.js",
"lib/internal/debugger/inspect_repl.js",
"lib/internal/dgram.js",
"lib/internal/dns/callback_resolver.js",
"lib/internal/dns/promises.js",
"lib/internal/dns/utils.js",
"lib/internal/encoding.js",
"lib/internal/error_serdes.js",
"lib/internal/errors.js",
"lib/internal/event_target.js",
"lib/internal/events/symbols.js",
"lib/internal/file.js",
"lib/internal/fixed_queue.js",
"lib/internal/freelist.js",
"lib/internal/freeze_intrinsics.js",
"lib/internal/fs/cp/cp-sync.js",
"lib/internal/fs/cp/cp.js",
"lib/internal/fs/dir.js",
"lib/internal/fs/promises.js",
"lib/internal/fs/read/context.js",
"lib/internal/fs/read/utf8.js",
"lib/internal/fs/recursive_watch.js",
"lib/internal/fs/rimraf.js",
"lib/internal/fs/streams.js",
"lib/internal/fs/sync_write_stream.js",
"lib/internal/fs/utils.js",
"lib/internal/fs/watchers.js",
"lib/internal/heap_utils.js",
"lib/internal/histogram.js",
"lib/internal/http.js",
"lib/internal/http2/compat.js",
"lib/internal/http2/core.js",
"lib/internal/http2/util.js",
"lib/internal/idna.js",
"lib/internal/inspector_async_hook.js",
"lib/internal/js_stream_socket.js",
"lib/internal/legacy/processbinding.js",
"lib/internal/linkedlist.js",
"lib/internal/main/check_syntax.js",
"lib/internal/main/embedding.js",
"lib/internal/main/eval_stdin.js",
"lib/internal/main/eval_string.js",
"lib/internal/main/inspect.js",
"lib/internal/main/mksnapshot.js",
"lib/internal/main/print_help.js",
"lib/internal/main/prof_process.js",
"lib/internal/main/repl.js",
"lib/internal/main/run_main_module.js",
"lib/internal/main/test_runner.js",
"lib/internal/main/watch_mode.js",
"lib/internal/main/worker_thread.js",
"lib/internal/mime.js",
"lib/internal/modules/cjs/loader.js",
"lib/internal/modules/esm/assert.js",
"lib/internal/modules/esm/create_dynamic_module.js",
"lib/internal/modules/esm/fetch_module.js",
"lib/internal/modules/esm/formats.js",
"lib/internal/modules/esm/get_format.js",
"lib/internal/modules/esm/handle_process_exit.js",
"lib/internal/modules/esm/hooks.js",
"lib/internal/modules/esm/initialize_import_meta.js",
"lib/internal/modules/esm/load.js",
"lib/internal/modules/esm/loader.js",
"lib/internal/modules/esm/module_job.js",
"lib/internal/modules/esm/module_map.js",
"lib/internal/modules/esm/package_config.js",
"lib/internal/modules/esm/resolve.js",
"lib/internal/modules/esm/shared_constants.js",
"lib/internal/modules/esm/translators.js",
"lib/internal/modules/esm/utils.js",
"lib/internal/modules/esm/worker.js",
"lib/internal/modules/helpers.js",
"lib/internal/modules/package_json_reader.js",
"lib/internal/modules/run_main.js",
"lib/internal/net.js",
"lib/internal/options.js",
"lib/internal/per_context/domexception.js",
"lib/internal/per_context/messageport.js",
"lib/internal/per_context/primordials.js",
"lib/internal/perf/event_loop_delay.js",
"lib/internal/perf/event_loop_utilization.js",
"lib/internal/perf/nodetiming.js",
"lib/internal/perf/observe.js",
"lib/internal/perf/performance.js",
"lib/internal/perf/performance_entry.js",
"lib/internal/perf/resource_timing.js",
"lib/internal/perf/timerify.js",
"lib/internal/perf/usertiming.js",
"lib/internal/perf/utils.js",
"lib/internal/policy/manifest.js",
"lib/internal/policy/sri.js",
"lib/internal/priority_queue.js",
"lib/internal/process/esm_loader.js",
"lib/internal/process/execution.js",
"lib/internal/process/per_thread.js",
"lib/internal/process/permission.js",
"lib/internal/process/policy.js",
"lib/internal/process/pre_execution.js",
"lib/internal/process/promises.js",
"lib/internal/process/report.js",
"lib/internal/process/signal.js",
"lib/internal/process/task_queues.js",
"lib/internal/process/warning.js",
"lib/internal/process/worker_thread_only.js",
"lib/internal/promise_hooks.js",
"lib/internal/querystring.js",
"lib/internal/readline/callbacks.js",
"lib/internal/readline/emitKeypressEvents.js",
"lib/internal/readline/interface.js",
"lib/internal/readline/promises.js",
"lib/internal/readline/utils.js",
"lib/internal/repl.js",
"lib/internal/repl/await.js",
"lib/internal/repl/history.js",
"lib/internal/repl/utils.js",
"lib/internal/socket_list.js",
"lib/internal/socketaddress.js",
"lib/internal/source_map/prepare_stack_trace.js",
"lib/internal/source_map/source_map.js",
"lib/internal/source_map/source_map_cache.js",
"lib/internal/stream_base_commons.js",
"lib/internal/streams/add-abort-signal.js",
"lib/internal/streams/buffer_list.js",
"lib/internal/streams/compose.js",
"lib/internal/streams/destroy.js",
"lib/internal/streams/duplex.js",
"lib/internal/streams/duplexify.js",
"lib/internal/streams/end-of-stream.js",
"lib/internal/streams/from.js",
"lib/internal/streams/lazy_transform.js",
"lib/internal/streams/legacy.js",
"lib/internal/streams/operators.js",
"lib/internal/streams/passthrough.js",
"lib/internal/streams/pipeline.js",
"lib/internal/streams/readable.js",
"lib/internal/streams/state.js",
"lib/internal/streams/transform.js",
"lib/internal/streams/utils.js",
"lib/internal/streams/writable.js",
"lib/internal/structured_clone.js",
"lib/internal/test/binding.js",
"lib/internal/test/transfer.js",
"lib/internal/test_runner/coverage.js",
"lib/internal/test_runner/harness.js",
"lib/internal/test_runner/mock/mock.js",
"lib/internal/test_runner/mock/mock_timers.js",
"lib/internal/test_runner/reporter/dot.js",
"lib/internal/test_runner/reporter/spec.js",
"lib/internal/test_runner/reporter/tap.js",
"lib/internal/test_runner/reporter/v8-serializer.js",
"lib/internal/test_runner/runner.js",
"lib/internal/test_runner/test.js",
"lib/internal/test_runner/tests_stream.js",
"lib/internal/test_runner/utils.js",
"lib/internal/timers.js",
"lib/internal/tls/secure-context.js",
"lib/internal/tls/secure-pair.js",
"lib/internal/trace_events_async_hooks.js",
"lib/internal/tty.js",
"lib/internal/url.js",
"lib/internal/util.js",
"lib/internal/util/colors.js",
"lib/internal/util/comparisons.js",
"lib/internal/util/debuglog.js",
"lib/internal/util/embedding.js",
"lib/internal/util/inspect.js",
"lib/internal/util/inspector.js",
"lib/internal/util/iterable_weak_map.js",
"lib/internal/util/parse_args/parse_args.js",
"lib/internal/util/parse_args/utils.js",
"lib/internal/util/types.js",
"lib/internal/v8/startup_snapshot.js",
"lib/internal/v8_prof_polyfill.js",
"lib/internal/v8_prof_processor.js",
"lib/internal/validators.js",
"lib/internal/vm.js",
"lib/internal/vm/module.js",
"lib/internal/wasm_web_api.js",
"lib/internal/watch_mode/files_watcher.js",
"lib/internal/watchdog.js",
"lib/internal/webidl.js",
"lib/internal/webstreams/adapters.js",
"lib/internal/webstreams/compression.js",
"lib/internal/webstreams/encoding.js",
"lib/internal/webstreams/queuingstrategies.js",
"lib/internal/webstreams/readablestream.js",
"lib/internal/webstreams/transfer.js",
"lib/internal/webstreams/transformstream.js",
"lib/internal/webstreams/util.js",
"lib/internal/webstreams/writablestream.js",
"lib/internal/worker.js",
"lib/internal/worker/io.js",
"lib/internal/worker/js_transferable.js",
"lib/module.js",
"lib/net.js",
"lib/os.js",
"lib/path.js",
"lib/path/posix.js",
"lib/path/win32.js",
"lib/perf_hooks.js",
"lib/process.js",
"lib/punycode.js",
"lib/querystring.js",
"lib/readline.js",
"lib/readline/promises.js",
"lib/repl.js",
"lib/stream.js",
"lib/stream/consumers.js",
"lib/stream/promises.js",
"lib/stream/web.js",
"lib/string_decoder.js",
"lib/sys.js",
"lib/test.js",
"lib/test/reporters.js",
"lib/timers.js",
"lib/timers/promises.js",
"lib/tls.js",
"lib/trace_events.js",
"lib/tty.js",
"lib/url.js",
"lib/util.js",
"lib/util/types.js",
"lib/v8.js",
"lib/vm.js",
"lib/wasi.js",
"lib/worker_threads.js",
"lib/zlib.js"
],
"node_module_version": 115,
"node_no_browser_globals": "false",
"node_prefix": "/",
"node_release_urlbase": "https://nodejs.org/download/release/",
"node_section_ordering_info": "",
"node_shared": "false",
"node_shared_brotli": "false",
"node_shared_cares": "false",
"node_shared_http_parser": "false",
"node_shared_libuv": "false",
"node_shared_nghttp2": "false",
"node_shared_nghttp3": "false",
"node_shared_ngtcp2": "false",
"node_shared_openssl": "false",
"node_shared_zlib": "false",
"node_tag": "",
"node_target_type": "executable",
"node_use_bundled_v8": "true",
"node_use_node_code_cache": "true",
"node_use_node_snapshot": "true",
"node_use_openssl": "true",
"node_use_v8_platform": "true",
"node_with_ltcg": "false",
"node_without_node_options": "false",
"openssl_is_fips": "false",
"openssl_quic": "true",
"ossfuzz": "false",
"shlib_suffix": "so.115",
"single_executable_application": "true",
"target_arch": "x64",
"v8_enable_31bit_smis_on_64bit_arch": 0,
"v8_enable_gdbjit": 0,
"v8_enable_hugepage": 0,
"v8_enable_i18n_support": 1,
"v8_enable_inspector": 1,
"v8_enable_javascript_promise_hooks": 1,
"v8_enable_lite_mode": 0,
"v8_enable_object_print": 1,
"v8_enable_pointer_compression": 0,
"v8_enable_shared_ro_heap": 1,
"v8_enable_short_builtin_calls": 1,
"v8_enable_webassembly": 1,
"v8_no_strict_aliasing": 1,
"v8_optimized_debug": 1,
"v8_promise_internal_field_count": 1,
"v8_random_seed": 0,
"v8_trace_maps": 0,
"v8_use_siphash": 1,
"want_separate_host_toolset": 0,
"nodedir": "/root/.cache/node-gyp/20.5.1",
"standalone_static_library": 1,
"userconfig": "/root/.npmrc",
"cache": "/root/.npm",
"local_prefix": "/home/zhaojunxia/napi/napi_generator_0824",
"lockfile": "",
"globalconfig": "/etc/npmrc",
"init_module": "/root/.npm-init.js",
"globalignorefile": "/etc/npmignore",
"npm_version": "10.2.4",
"prefix": "/usr/local",
"user_agent": "npm/10.2.4 node/v20.5.1 linux x64 workspaces/false",
"strict_ssl": "",
"node_gyp": "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",
"global_prefix": "/usr/local",
"registry": "https://repo.huaweicloud.com/repository/npm/"
}
}

View File

@ -1,167 +0,0 @@
# This file is generated by gyp; do not edit.
TOOLSET := target
TARGET := napitest
DEFS_Debug := \
'-DNODE_GYP_MODULE_NAME=napitest' \
'-DUSING_UV_SHARED=1' \
'-DUSING_V8_SHARED=1' \
'-DV8_DEPRECATION_WARNINGS=1' \
'-DV8_DEPRECATION_WARNINGS' \
'-DV8_IMMINENT_DEPRECATION_WARNINGS' \
'-D_GLIBCXX_USE_CXX11_ABI=1' \
'-D_LARGEFILE_SOURCE' \
'-D_FILE_OFFSET_BITS=64' \
'-D__STDC_FORMAT_MACROS' \
'-DOPENSSL_NO_PINSHARED' \
'-DOPENSSL_THREADS' \
'-DBUILDING_NODE_EXTENSION' \
'-DDEBUG' \
'-D_DEBUG' \
'-DV8_ENABLE_CHECKS'
# Flags passed to all source files.
CFLAGS_Debug := \
-fPIC \
-pthread \
-Wall \
-Wextra \
-Wno-unused-parameter \
-m64 \
-g \
-O0
# Flags passed to only C files.
CFLAGS_C_Debug :=
# Flags passed to only C++ files.
CFLAGS_CC_Debug := \
-fno-rtti \
-fno-exceptions \
-std=gnu++17 \
-frtti \
-std=c++17
INCS_Debug := \
-I/root/.cache/node-gyp/20.5.1/include/node \
-I/root/.cache/node-gyp/20.5.1/src \
-I/root/.cache/node-gyp/20.5.1/deps/openssl/config \
-I/root/.cache/node-gyp/20.5.1/deps/openssl/openssl/include \
-I/root/.cache/node-gyp/20.5.1/deps/uv/include \
-I/root/.cache/node-gyp/20.5.1/deps/zlib \
-I/root/.cache/node-gyp/20.5.1/deps/v8/include \
-I$(srcdir)/.
DEFS_Release := \
'-DNODE_GYP_MODULE_NAME=napitest' \
'-DUSING_UV_SHARED=1' \
'-DUSING_V8_SHARED=1' \
'-DV8_DEPRECATION_WARNINGS=1' \
'-DV8_DEPRECATION_WARNINGS' \
'-DV8_IMMINENT_DEPRECATION_WARNINGS' \
'-D_GLIBCXX_USE_CXX11_ABI=1' \
'-D_LARGEFILE_SOURCE' \
'-D_FILE_OFFSET_BITS=64' \
'-D__STDC_FORMAT_MACROS' \
'-DOPENSSL_NO_PINSHARED' \
'-DOPENSSL_THREADS' \
'-DBUILDING_NODE_EXTENSION'
# Flags passed to all source files.
CFLAGS_Release := \
-fPIC \
-pthread \
-Wall \
-Wextra \
-Wno-unused-parameter \
-m64 \
-O3 \
-fno-omit-frame-pointer
# Flags passed to only C files.
CFLAGS_C_Release :=
# Flags passed to only C++ files.
CFLAGS_CC_Release := \
-fno-rtti \
-fno-exceptions \
-std=gnu++17 \
-frtti \
-std=c++17
INCS_Release := \
-I/root/.cache/node-gyp/20.5.1/include/node \
-I/root/.cache/node-gyp/20.5.1/src \
-I/root/.cache/node-gyp/20.5.1/deps/openssl/config \
-I/root/.cache/node-gyp/20.5.1/deps/openssl/openssl/include \
-I/root/.cache/node-gyp/20.5.1/deps/uv/include \
-I/root/.cache/node-gyp/20.5.1/deps/zlib \
-I/root/.cache/node-gyp/20.5.1/deps/v8/include \
-I$(srcdir)/.
OBJS := \
$(obj).target/$(TARGET)/napitest.o \
$(obj).target/$(TARGET)/napitest_middle.o \
$(obj).target/$(TARGET)/tool_utility.o
# Add to the list of files we specially track dependencies for.
all_deps += $(OBJS)
# CFLAGS et al overrides must be target-local.
# See "Target-specific Variable Values" in the GNU Make manual.
$(OBJS): TOOLSET := $(TOOLSET)
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
# Suffix rules, putting all outputs into $(obj).
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
# Try building from generated source, too.
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
# End of this set of suffix rules
### Rules for final target.
LDFLAGS_Debug := \
-pthread \
-rdynamic \
-m64
LDFLAGS_Release := \
-pthread \
-rdynamic \
-m64
LIBS :=
$(obj).target/napitest.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
$(obj).target/napitest.node: LIBS := $(LIBS)
$(obj).target/napitest.node: TOOLSET := $(TOOLSET)
$(obj).target/napitest.node: $(OBJS) FORCE_DO_CMD
$(call do_cmd,solink_module)
all_deps += $(obj).target/napitest.node
# Add target alias
.PHONY: napitest
napitest: $(builddir)/napitest.node
# Copy this to the executable output path.
$(builddir)/napitest.node: TOOLSET := $(TOOLSET)
$(builddir)/napitest.node: $(obj).target/napitest.node FORCE_DO_CMD
$(call do_cmd,copy)
all_deps += $(builddir)/napitest.node
# Short alias for building this executable.
.PHONY: napitest.node
napitest.node: $(obj).target/napitest.node $(builddir)/napitest.node
# Add executable to "all" target.
.PHONY: all
all: $(builddir)/napitest.node

View File

@ -1,38 +0,0 @@
11/26/2023, 11:49:37 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
11/26/2023, 11:49:42 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(135:21)] [ERR] File '@ohos.test.d.ts' not found.
The file is in the program because:
Root file specified for compilation
11/26/2023, 11:49:42 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(151:13)] [INF] fail
File '@ohos.test.d.ts' not found.
The file is in the program because:
Root file specified for compilation
11/26/2023, 11:50:21 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
11/26/2023, 11:50:26 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
11/26/2023, 11:50:26 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(147:13)] [INF] success
11/30/2023, 11:54:51 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
11/30/2023, 11:54:54 PM at paramGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate/param_generate.js(1089:17)] [ERR] The current version does not support generating parameter [callback] with type [(value]., Please refer to for support capacity:https://gitee.com/openharmony/napi_generator/tree/master/release-notes
11/30/2023, 11:54:54 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
11/30/2023, 11:54:54 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(151:13)] [INF] fail
The current version does not support generating parameter [callback] with type [(value]., Please refer to for support capacity:https://gitee.com/openharmony/napi_generator/tree/master/release-notes
12/4/2023, 10:46:05 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
12/4/2023, 10:46:08 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
12/4/2023, 10:46:08 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(147:13)] [INF] success
12/4/2023, 10:49:22 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
12/4/2023, 10:49:24 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
12/4/2023, 10:49:24 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(147:13)] [INF] success
12/4/2023, 10:53:08 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
12/4/2023, 10:53:11 PM at paramGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate/param_generate.js(1089:17)] [ERR] The current version does not support generating parameter [callback] with type [(value]., Please refer to for support capacity:https://gitee.com/openharmony/napi_generator/tree/master/release-notes
12/4/2023, 10:53:11 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
12/4/2023, 10:53:11 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(151:13)] [INF] fail
The current version does not support generating parameter [callback] with type [(value]., Please refer to for support capacity:https://gitee.com/openharmony/napi_generator/tree/master/release-notes
12/4/2023, 10:56:18 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
12/4/2023, 10:56:21 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
12/4/2023, 10:56:21 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(147:13)] [INF] success
12/4/2023, 10:58:43 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
12/4/2023, 10:58:46 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
12/4/2023, 10:58:46 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(147:13)] [INF] success
12/4/2023, 10:59:45 PM at checkGenerate [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(116:13)] [INF] check file []
12/4/2023, 10:59:47 PM at formatCode [/home/zhaojunxia/napi/napi_generator_0824/src/gen/generate.js(180:17)] [INF] Warning: clang-format does not exist, can not format cpp file.
12/4/2023, 10:59:47 PM at Object.<anonymous> [/home/zhaojunxia/napi/napi_generator_0824/src/gen/cmd_gen.js(147:13)] [INF] success

View File

@ -1,22 +0,0 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
#include "napitest.h"
#include "napitest_middle.h"
namespace napitest {
namespace napitest_interface {
}
}

View File

@ -1,32 +0,0 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 IMPL_NAPITEST_H
#define IMPL_NAPITEST_H
#include <string>
#include <memory>
#include <vector>
#include <cmath>
#include <map>
#include <any>
#include <optional>
namespace napitest {
namespace napitest_interface {
}
}
#endif // IMPL_NAPITEST_H

View File

@ -1,149 +0,0 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
#include <cstring>
#include <string>
#include <memory>
#include <vector>
#include <node_api.h>
#include <any>
#include <optional>
#include "tool_utility.h"
#include "napitest_middle.h"
#define NUMBER_JS_2_C(napi_v, type, dest) \
if (typeid(type) == typeid(int32_t)) { \
dest = pxt->SwapJs2CInt32(napi_v); \
} \
else if (typeid(type) == typeid(uint32_t)) { \
dest = pxt->SwapJs2CUint32(napi_v); \
} \
else if (typeid(type) == typeid(int64_t)) { \
dest = pxt->SwapJs2CInt64(napi_v); \
} \
else if (typeid(type) == typeid(double_t)) { \
dest = pxt->SwapJs2CDouble(napi_v); \
}
#define NUMBER_JS_2_C_ENUM(napi_v, type, dest, enum_type) \
if (typeid(type) == typeid(int32_t)) { \
dest = static_cast<enum_type>(pxt->SwapJs2CInt32(napi_v)); \
} \
else if (typeid(type) == typeid(uint32_t)) { \
dest = static_cast<enum_type>(pxt->SwapJs2CUint32(napi_v)); \
} \
else if (typeid(type) == typeid(int64_t)) { \
dest = static_cast<enum_type>(pxt->SwapJs2CInt64(napi_v)); \
} \
else if (typeid(type) == typeid(double_t)) { \
dest = static_cast<enum_type>(pxt->SwapJs2CDouble(napi_v)); \
}
#define BOOLEAN_JS_2_C(napi_v, type, dest) { \
dest = pxt->SwapJs2CBool(napi_v); \
}
#define C_DELETE(p) \
if ((p)) { \
delete (p); \
}
__attribute__((unused)) static napi_value number_c_to_js(XNapiTool *pxt, const std::type_info &n, DataPtr num)
{
if (n == typeid(int32_t))
return pxt->SwapC2JsInt32(*(int32_t *)num);
else if (n == typeid(uint32_t))
return pxt->SwapC2JsUint32(*(uint32_t *)num);
else if (n == typeid(int64_t))
return pxt->SwapC2JsInt64(*(int64_t *)num);
else if (n == typeid(double_t))
return pxt->SwapC2JsDouble(*(double_t *)num);
return nullptr;
}
#define NUMBER_C_2_JS(pxt, n) \
number_c_to_js(pxt, typeid((n)), reinterpret_cast<DataPtr>(&(n)))
namespace napitest {
namespace napitest_interface {
void threadSafeFuncCallJsTest1(napi_env env, napi_value jsCallback, void *context, void *data)
{
// to add user CallJs code
}
napi_value createThreadSafeFuncTest1_middle(napi_env env, napi_callback_info info)
{
XNapiTool *pxt = std::make_unique<XNapiTool>(env, info).release();
if (pxt->IsFailed()) {
napi_value err = pxt->GetError();
delete pxt;
return err;
}
struct createThreadSafeFuncTest1_value_struct *vio = new createThreadSafeFuncTest1_value_struct();
const size_t argc = pxt->GetArgc();
// 获取第一个参数,线程安全函数名称 get ThreadSafeFunc name
pxt->SwapJs2CUtf8(pxt->GetArgv(XNapiTool::ZERO), vio->eventName);
// 判断最后一个参数是否为回调函数类型
napi_valuetype valueType = napi_undefined;
napi_status status = napi_typeof(env, pxt->GetArgv(argc - 1), &valueType);
if (status != napi_ok) {
return nullptr;
}
if (valueType != napi_function) {
printf("valueType is Err, not napi_function!");
return nullptr;
}
// create ThreadSafeFunc
napi_threadsafe_function thraedsafeFunc;
const size_t maxQueueSize = 0; // 0 means no limited
const size_t initialThreadCount = 1;
napi_value name = pxt->GetArgv(XNapiTool::ZERO); //资源名称复用线程安全函数名称
napi_create_threadsafe_function(env, pxt->GetArgv(argc - 1), nullptr,
name, maxQueueSize, initialThreadCount, nullptr, nullptr, nullptr, threadSafeFuncCallJsTest1, &thraedsafeFunc);
pxt->RegistThreadsafeFunc(env, vio->eventName, thraedsafeFunc);
napi_value result = pxt->UndefinedValue();
delete vio;
if (pxt->IsFailed()) {
result = pxt->GetError();
}
delete pxt; // release
return result;
}
}
}
static napi_value init(napi_env env, napi_value exports)
{
std::shared_ptr<XNapiTool> pxt = std::make_shared<XNapiTool>(env, exports);
pxt->DefineFunction("createThreadSafeFuncTest1", napitest::napitest_interface::createThreadSafeFuncTest1_middle);
return exports;
}
static napi_module g_napitest_Module = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = nullptr,
.nm_register_func = init,
.nm_modname = "test",
.nm_priv = ((void *)0),
.reserved = {(void *)0},
};
extern "C" __attribute__((constructor)) void Register_napitest_Module(void)
{
napi_module_register(&g_napitest_Module);
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 IMPL_NAPITEST_MIDDLE_H
#define IMPL_NAPITEST_MIDDLE_H
#include <cstring>
#include <string>
#include <memory>
#include <vector>
#include <node_api.h>
#include <any>
#include <optional>
#include "tool_utility.h"
#include "napitest.h"
namespace napitest {
namespace napitest_interface {
struct createThreadSafeFuncTest1_value_struct {
std::string eventName;
};
napi_value createThreadSafeFuncTest1_middle(napi_env env, napi_callback_info info);
}
}
#endif // IMPL_NAPITEST_MIDDLE_H

View File

@ -1 +0,0 @@
node-gyp configure build && sleep 0.5 && node --expose-gc test.js

File diff suppressed because it is too large Load Diff

View File

@ -1,251 +0,0 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 CC_TOOL_H
#define CC_TOOL_H
#include <node_api.h>
#include <string>
#include <memory>
#include <map>
#include <any>
#include <optional>
#include <vector>
#include <cmath>
using DataPtr = struct DumyData*;
struct CallFunc {
napi_env env_;
napi_ref funcRef_;
napi_ref thisVarRef_;
};
struct ThreadsafeFunc {
napi_env env_;
napi_ref thisVarRef_;
napi_threadsafe_function threadsafefunc_;
};
class XNapiTool {
public:
static const int ZERO = 0;
static const int ONE = 1;
static const int TWO = 2;
static const int THREE = 3;
static const int FOUE = 4;
static const int FIVE = 5;
static const int SIX = 6;
static const int SEVEN = 7;
static const int EIGHT = 8;
static const int NINE = 9;
void RegistOnOffFunc(std::string name, napi_value func);
void UnregistOnOffFunc(std::string name);
void RegistThreadsafeFunc(napi_env env, std::string name, napi_threadsafe_function thraedsafeFunc);
static void CallSyncFunc(CallFunc *pSyncFuncs, napi_value ret);
static void CallAsyncFunc(CallFunc *pAsyncFuncs, napi_value ret);
using CallbackFunction = void (*)(XNapiTool *pxt, DataPtr data);
using RELEASE_INSTANCE = void (*)(DataPtr p);
static napi_value UndefinedValue(napi_env env);
const uint32_t DEFAULT_ARG_COUNT = 8;
napi_value UndefinedValue();
napi_value CreateSubObject(napi_value parent, const char *name);
void DefineFunction(const char *funcName, napi_callback callback, napi_value dest = nullptr);
void DefineClass(const char *className, napi_callback constructorFunc,
std::map<const char *, std::map<const char *, napi_callback>> &valueList, std::map<const char *,
napi_callback> &funcList, napi_value dest = nullptr);
void SetEnumProperty(napi_value dstObj, const char *propName, const std::any objValue);
void CreateEnumObject(const char *enumName, std::map<const char *, std::any> enumMap);
XNapiTool(napi_env env, napi_callback_info info);
XNapiTool(napi_env env, napi_value exports);
~XNapiTool();
bool SwapJs2CBool(napi_value value);
int32_t SwapJs2CInt32(napi_value value);
uint32_t SwapJs2CUint32(napi_value value);
int64_t SwapJs2CInt64(napi_value value);
double_t SwapJs2CDouble(napi_value value);
size_t SwapJs2CUtf8(napi_value value, std::string &str);
napi_value SwapC2JsBool(bool value);
napi_value SwapC2JsInt32(int32_t value);
napi_value SwapC2JsUint32(uint32_t value);
napi_value SwapC2JsInt64(int64_t value);
napi_value SwapC2JsDouble(double_t value);
napi_value SwapC2JsUtf8(const char *value);
napi_value GetArgv(uint32_t p);
uint32_t GetArgc();
bool GetProperty(napi_value value, const char *propertyName);
napi_value GetValueProperty(napi_value value, const char *propertyName);
napi_value SetValueProperty(napi_value &value, const char *propertyName, napi_value property);
napi_value CreateArray(napi_value &value);
uint32_t GetArrayLength(napi_value value);
napi_value GetArrayElement(napi_value value, uint32_t p);
napi_value SetArrayElement(napi_value &value, uint32_t p, napi_value ele);
uint32_t GetMapLength(napi_value value);
napi_value GetMapElementName(napi_value value, uint32_t p);
napi_value GetMapElementValue(napi_value value, const char *p);
napi_value SetMapElement(napi_value &value, const char *ele_key, napi_value ele_value);
std::string GetUnionType(napi_value object);
std::string GetAnyType(napi_value object);
std::string GetAnyArrayType(napi_value object);
/**
* @brief Get any type when function param is any and any type is Array<map<string, string/number/boolean>>.
*
* @param object Indicates data to be parsed.
* @return Returns specific return value type if this function is successfully called such as arr_map_string.
*/
std::string GetAnyTypeArrMap(napi_value object);
/**
* @brief Get any type when function param is any and any type is map<string, Array<string/number/boolean>>.
*
* @param object Indicates data to be parsed.
* @return Returns specific return value type if this function is successfully called such as map_arr_string.
*/
std::string GetAnyTypeMapArr(napi_value object);
/**
* @brief Set any value when function param is any and any type is Array<map<string, string/number/boolean>>.
*
* @param any_type Indicates the type of the param any.
* @param argv Indicates data to be parsed.
* @param any Indicates parsed data of the param any.
* @param len Indicates the length of Array.
*/
void SetAnyValueArrMap(std::string &any_type, napi_value argv, std::any &any, uint32_t len);
/**
* @brief Set any value when function param is any and any type is map<string, Array<string/number/boolean>>.
*
* @param any_type Indicates the type of the param any.
* @param argv Indicates data to be parsed.
* @param any Indicates parsed data of the param any.
* @param len Indicates the length of map.
*/
void SetAnyValueMapArr(std::string &any_type, napi_value argv, std::any &any, uint32_t len);
void SetAnyValue(std::string &any_type, napi_value argv, std::any &any);
/**
* @brief Get any value when function param is any and any type is Array<map<string, string/number/boolean>>.
*
* @param any_type Indicates the type of the param any.
* @param result Indicates parsed data of the param any.
* @param any Indicates data to be parsed.
*/
void GetAnyValueArrMap(std::string any_type, napi_value &result, std::any any);
/**
* @brief Get any value when function param is any and any type is map<string, Array<string/number/boolean>>.
*
* @param any_type Indicates the type of the param any.
* @param result Indicates parsed data of the param any.
* @param any Indicates data to be parsed.
*/
void GetAnyValueMapArr(std::string any_type, napi_value &result, std::any any);
void GetAnyValue(std::string any_type, napi_value &result, std::any any);
void GetObjectValVecUint32(std::any &anyVal, napi_value &tnv2);
void GetObjectValVecInt32(std::any &anyVal, napi_value &tnv2);
void GetObjectValVecInt64(std::any &anyVal, napi_value &tnv2);
void GetObjectValVecDouble(std::any &anyVal, napi_value &tnv2);
void GetObjectValVecBool(std::any &anyVal, napi_value &tnv2);
void GetObjectValVecConstchar(std::any &anyVal, napi_value &tnv2);
void GetObjectValMapString(std::any &anyVal, napi_value &tnv2);
void GetObjectValMapUint32(std::any &anyVal, napi_value &tnv2);
void GetObjectValMapInt32(std::any &anyVal, napi_value &tnv2);
void GetObjectValMapInt64(std::any &anyVal, napi_value &tnv2);
void GetObjectValMapDouble(std::any &anyVal, napi_value &tnv2);
void GetObjectValMapBool(std::any &anyVal, napi_value &tnv2);
void GetObjectValMapAny(std::any &anyVal, napi_value &tnv2);
void GetObjectValue(napi_value &result, std::map<std::string, std::any> valueIn);
napi_value SyncCallBack(napi_value func, size_t argc, napi_value *args);
napi_value StartAsync(CallbackFunction pe, DataPtr data, CallbackFunction pc, napi_value func = nullptr);
void FinishAsync(size_t argc, napi_value *args);
bool IsFailed()
{
return bFailed_;
}
napi_value GetError()
{
return error_;
}
napi_env GetEnv()
{
return env_;
}
napi_value tmp_value;
// create code related class
public:
static void WrapFinalize(napi_env env, XNapiTool *data, DataPtr hint);
static std::map<std::string, CallFunc> callFuncs_;
static std::map<std::string, ThreadsafeFunc> threadsafeCallFuncs_;
void ReleaseInstance();
napi_value WrapInstance(DataPtr instance, RELEASE_INSTANCE ri);
DataPtr UnWarpInstance();
void SetAsyncInstance(DataPtr p);
void* GetAsyncInstance();
private:
napi_env env_;
napi_value exports_;
// analyze params
napi_value argv_[8];
size_t argc_size;
napi_value thisVar_;
void *data_;
// error message
napi_value error_;
bool bFailed_;
bool CheckFailed(bool b, const char *errStr);
bool CheckValueType(napi_value value, napi_valuetype type);
// asynchronous call related code
static void AsyncExecute(napi_env env, XNapiTool *p);
void AsyncExecuteFunction();
static void AsyncComplete(napi_env env, napi_status status, XNapiTool *p);
void AsyncCompleteFunction();
napi_ref callbackFunc_;
napi_ref asyncThisVar_;
napi_async_work work_;
bool asyncNeedRelease_;
CallbackFunction executeFunction_;
CallbackFunction completeFunction_;
DataPtr valueData_;
napi_deferred deferred_;
enum class AsyncMode {
NONE,
CALLBACK,
PROMISE,
};
AsyncMode asyncMode_;
private:
napi_ref wrapper_;
DataPtr pInstance_;
RELEASE_INSTANCE releaseInstance_;
DataPtr asyncInstance_;
};
#endif