提交 78cb423c 编写于 作者: L liangshenglin1 提交者: Gitee

adapt rpc to ark

Signed-off-by: Nliangshenglin <liangshenglin1@huawei.com>
上级 9c810632
......@@ -11,10 +11,36 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//ark/ts2abc/ts2panda/ts2abc_config.gni")
import("//build/ohos.gni")
import("//foundation/ace/ace_engine/ace_config.gni")
SUBSYSTEM_DIR = "//foundation/communication/ipc"
# compile .js to .abc.
action("gen_rpc_abc") {
visibility = [ ":*" ]
script = "//ark/ts2abc/ts2panda/scripts/generate_js_bytecode.py"
args = [
"--src-js",
rebase_path(
"//foundation/communication/ipc/interfaces/kits/js/napi/rpc.js"),
"--dst-file",
rebase_path(target_out_dir + "/rpc.abc"),
"--node",
rebase_path("${node_path}"),
"--frontend-tool-path",
rebase_path("${ts2abc_build_path}"),
"--node-modules",
rebase_path("${node_modules}"),
]
deps = [ "//ark/ts2abc/ts2panda:ark_ts2abc_build" ]
inputs = [ "//foundation/communication/ipc/interfaces/kits/js/napi/rpc.js" ]
outputs = [ target_out_dir + "/rpc.abc" ]
}
base_output_path = get_label_info(":rpc_js", "target_out_dir")
ipc_js_obj_path = base_output_path + "/rpc.o"
......@@ -23,6 +49,14 @@ gen_js_obj("rpc_js") {
output = ipc_js_obj_path
}
abc_output_path = get_label_info(":rpc_abc", "target_out_dir")
rpc_abc_obj_path = abc_output_path + "/rpc_abc.o"
gen_js_obj("rpc_abc") {
input = "$target_out_dir/rpc.abc"
output = rpc_abc_obj_path
dep = ":gen_rpc_abc"
}
config("rpc_public_config") {
visibility = [ ":*" ]
include_dirs = [ "$SUBSYSTEM_DIR/ipc/native/src/napi/include" ]
......@@ -44,6 +78,7 @@ ohos_shared_library("rpc") {
]
deps = [
":rpc_abc",
":rpc_js",
"//foundation/ace/napi:ace_napi",
"//third_party/libuv:uv_static",
......
......@@ -23,6 +23,8 @@
extern const char _binary_rpc_js_start[];
extern const char _binary_rpc_js_end[];
extern const char _binary_rpc_abc_start[];
extern const char _binary_rpc_abc_end[];
namespace OHOS {
EXTERN_C_START
......@@ -48,6 +50,17 @@ extern "C" __attribute__((visibility("default"))) void NAPI_rpc_GetJSCode(const
}
}
// rpc JS register
extern "C" __attribute__((visibility("default"))) void NAPI_rpc_GetABCCode(const char **buf, int *buflen)
{
if (buf != nullptr) {
*buf = _binary_rpc_abc_start;
}
if (buflen != nullptr) {
*buflen = _binary_rpc_abc_end - _binary_rpc_abc_start;
}
}
static napi_module RPCModule_ = {
.nm_version = 1,
.nm_flags = 0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册