From ebb1dd5f8da6a5210059371e7edf314f67d92877 Mon Sep 17 00:00:00 2001 From: zhuhan Date: Thu, 18 Jan 2024 16:56:28 +0800 Subject: [PATCH] run env Signed-off-by: zhuhan Change-Id: Ic962f034e55808d0348e49a83f71b41bcf14787d --- ability/ability_runtime/BUILD.gn | 25 +++++++ .../ability_runtime/include/native_rumtime.h | 70 +++++++++++++++++++ ability/ability_runtime/libruntime.ndk.json | 10 +++ 3 files changed, 105 insertions(+) create mode 100644 ability/ability_runtime/BUILD.gn create mode 100644 ability/ability_runtime/include/native_rumtime.h create mode 100644 ability/ability_runtime/libruntime.ndk.json diff --git a/ability/ability_runtime/BUILD.gn b/ability/ability_runtime/BUILD.gn new file mode 100644 index 000000000..3fcc7d227 --- /dev/null +++ b/ability/ability_runtime/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 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 +# +# 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_ndk_headers("runtime_header") { + dest_dir = "$ndk_headers_out_dir/ability_runtime/" + sources = [ "./include/native_rumtime.h" ] +} + +ohos_ndk_library("libruntime_ndk") { + ndk_description_file = "./libruntime.ndk.json" + min_compact_version = "12" + output_name = "runtime_ndk" +} diff --git a/ability/ability_runtime/include/native_rumtime.h b/ability/ability_runtime/include/native_rumtime.h new file mode 100644 index 000000000..a2953cd5d --- /dev/null +++ b/ability/ability_runtime/include/native_rumtime.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 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 + * + * 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. + */ + +/** + * @addtogroup Ability_Runtime + * @{ + * + * @brief Provides ArkTS runtime environment. + + * + * @since 12 + * @version 1.0 + */ + +/** + * @file native_rumtime.h + * + * @brief Declare interfaces for creating and destroying Arkts runtime environments. + * + * @library libruntime.z.so + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @since 12 + * @version 1.0 + */ +#ifndef ABILITY_ABILITY_RUNTIME_NATIVE_RUNTIME_H +#define ABILITY_ABILITY_RUNTIME_NATIVE_RUNTIME_H + +#include +#include "napi/native_api.h" +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief Obtains the application info based on the The current bundle. + * + * @param env: The environment that the API is invoked under. + * @return Returns true on success, otherwise false. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeAbility_Create_NapiEnv(napi_env *env); + + +/** + * @brief Obtains the application info based on the The current bundle. + * + * @param env: The environment that the API is invoked under. + * @return Returns true on success, otherwise false. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeAbility_Destory_NapiEnv(napi_env *env); + +#ifdef __cplusplus +}; +#endif +/** @} */ +#endif // ABILITY_ABILITY_RUNTIME_RUNTIME_H \ No newline at end of file diff --git a/ability/ability_runtime/libruntime.ndk.json b/ability/ability_runtime/libruntime.ndk.json new file mode 100644 index 000000000..0eb1da674 --- /dev/null +++ b/ability/ability_runtime/libruntime.ndk.json @@ -0,0 +1,10 @@ +[ + { + "first_introduced": "12", + "name": "OH_NativeAbility_Create_NapiEnv" + }, + { + "first_introduced": "12", + "name": "OH_NativeAbility_Destory_NapiEnv" + } +] \ No newline at end of file -- Gitee