diff --git a/interfaces/taihe/syscap/BUILD.gn b/interfaces/taihe/syscap/BUILD.gn index 543e1bba6dc8e265c61fb3f5b94a71497b2bd114..31bde69d3d83e8466b9cba8b127d23b05516e760 100644 --- a/interfaces/taihe/syscap/BUILD.gn +++ b/interfaces/taihe/syscap/BUILD.gn @@ -16,18 +16,18 @@ import("//build/ohos.gni") import("//build/ohos/taihe_idl/taihe.gni") copy_taihe_idl("copy_global") { - sources = [ "idl/global.taihe" ] + sources = [ "idl/internal.full.global.taihe" ] } subsystem_name = "startup" part_name = "init" -taihe_generated_file_path = "$taihe_file_path/out/$subsystem_name/$part_name" +taihe_generated_file_path_global = "$taihe_file_path/out/$subsystem_name/$part_name/global" ohos_taihe("run_taihe") { - taihe_generated_file_path = "$taihe_generated_file_path" + taihe_generated_file_path = "$taihe_generated_file_path_global" deps = [ ":copy_global" ] outputs = [ - "$taihe_generated_file_path/src/global.ani.cpp", - "$taihe_generated_file_path/src/global.abi.c", + "$taihe_generated_file_path/src/internal.full.global.ani.cpp", + "$taihe_generated_file_path/src/internal.full.global.abi.c", ] } @@ -37,14 +37,14 @@ taihe_shared_library("global_taihe_native") { cfi_cross_dso = true debug = false } - taihe_generated_file_path = "$taihe_generated_file_path" + taihe_generated_file_path = "$taihe_generated_file_path_global" part_name = "$part_name" subsystem_name = "$subsystem_name" sources = get_target_outputs(":run_taihe") - include_dirs = [ "//base/startup/init/interfaces/innerkits/include" ] + include_dirs = [ "${init_innerkits_path}/include" ] sources += [ "src/ani_constructor.cpp", - "src/global.impl.cpp", + "src/internal.full.global.impl.cpp", ] deps = [ ":run_taihe", @@ -53,8 +53,8 @@ taihe_shared_library("global_taihe_native") { } generate_static_abc("global") { - base_url = "$taihe_generated_file_path" - files = [ "$taihe_generated_file_path/global.ets" ] + base_url = "$taihe_generated_file_path_global" + files = [ "$taihe_generated_file_path_global/@internal.full.global.ets" ] is_boot_abc = "True" device_dst_file = "/system/framework/global.abc" dependencies = [ ":run_taihe" ] @@ -66,4 +66,4 @@ ohos_prebuilt_etc("global_etc") { part_name = "$part_name" subsystem_name = "$subsystem_name" deps = [ ":global" ] -} +} \ No newline at end of file diff --git a/interfaces/taihe/syscap/idl/global.taihe b/interfaces/taihe/syscap/idl/internal.full.global.taihe similarity index 81% rename from interfaces/taihe/syscap/idl/global.taihe rename to interfaces/taihe/syscap/idl/internal.full.global.taihe index 4118a6476489e235fcc4826fa1f671ad88686834..cafb2b150b3b24adf6826ba3409a6995034d58aa 100644 --- a/interfaces/taihe/syscap/idl/global.taihe +++ b/interfaces/taihe/syscap/idl/internal.full.global.taihe @@ -12,7 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@!sts_inject(""" -loadLibrary("global_taihe_native") -""") -function canIUse(syscap: String): bool; \ No newline at end of file + @!namespace("@internal.full.global") + + @!sts_inject(""" + loadLibrary("global_taihe_native.z") + """) + function canIUse(syscap: String): bool; \ No newline at end of file diff --git a/interfaces/taihe/syscap/src/ani_constructor.cpp b/interfaces/taihe/syscap/src/ani_constructor.cpp index a90c1c3863443f569185c05e6afbdf969a4e97bf..f7cdf8b88f0097956efed88cd3fc7f5bbc024ac9 100644 --- a/interfaces/taihe/syscap/src/ani_constructor.cpp +++ b/interfaces/taihe/syscap/src/ani_constructor.cpp @@ -12,18 +12,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "taihe/runtime.hpp" -#include "global.ani.hpp" +#include "taihe.platform.ani.ani.hpp" +#include "internal.full.global.ani.hpp" +#if __has_include() +#include +#elif __has_include() +#include +#else +#error "ani.h not found, Please ensure the Ani SDK is correctly installed." +#endif ANI_EXPORT ani_status ANI_Constructor(ani_vm *vm, uint32_t *result) { ani_env *env; if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) { return ANI_ERROR; } - if (ANI_OK != global::ANIRegister(env)) { - std::cerr << "Error from global::ANIRegister" << std::endl; + if (ANI_OK != internal::full::global::ANIRegister(env)) { + std::cerr << "Error from internal::full::global::ANIRegister" << std::endl; return ANI_ERROR; } *result = ANI_VERSION_1; return ANI_OK; -} +} \ No newline at end of file diff --git a/interfaces/taihe/syscap/src/global.impl.cpp b/interfaces/taihe/syscap/src/internal.full.global.impl.cpp similarity index 84% rename from interfaces/taihe/syscap/src/global.impl.cpp rename to interfaces/taihe/syscap/src/internal.full.global.impl.cpp index e1f25df80cd06df681a1db8186d7d08caa700850..bc6a27880130fdc40698ff2bdcb7dc7abdab1225 100644 --- a/interfaces/taihe/syscap/src/global.impl.cpp +++ b/interfaces/taihe/syscap/src/internal.full.global.impl.cpp @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "global.proj.hpp" -#include "global.impl.hpp" +#include "internal.full.global.proj.hpp" +#include "internal.full.global.impl.hpp" #include "taihe/runtime.hpp" #include "stdexcept" #include "systemcapability.h" @@ -28,9 +28,6 @@ bool canIUse(string_view syscap) bool ret = HasSystemCapability(std::string(syscap).c_str()); return ret; } -} // namespace +} //namespace -// Since these macros are auto-generate, lint will cause false positive. -// NOLINTBEGIN TH_EXPORT_CPP_API_canIUse(canIUse); -// NOLINTEND