diff --git a/BUILD.gn b/BUILD.gn index b76254e930208dc943ba49eb654b1435de46cb1f..81c127b677c2a564009ffb315fc20d5a8d777b08 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -58,6 +58,11 @@ config("ark_toolchain_common_config") { "PANDA_TARGET_UNIX", "PANDA_USE_FUTEX", ] + } else if (target_os == "ios") { + defines += [ + "PANDA_TARGET_UNIX", + "PANDA_TARGET_IOS", + ] } else { defines += [ "PANDA_TARGET_UNIX", diff --git a/build/compile_script/ark.py b/build/compile_script/ark.py index 39031f760761b74e5d6a2374c2d39a0071a8bfde..0d2fe31a76332db24287cad68bf0d7473342ff2c 100644 --- a/build/compile_script/ark.py +++ b/build/compile_script/ark.py @@ -18,8 +18,6 @@ from __future__ import print_function import errno import os -import platform -import re import subprocess import sys @@ -31,8 +29,8 @@ ARCHES = ["x64", "arm", "arm64"] DEFAULT_ARCHES = "x64" MODES = ["release", "debug"] DEFAULT_MODES = "release" -TARGETS = ["ark_js_vm"] -DEFAULT_TARGETS = "all" +TARGETS = ["ets_runtime", "ets_frontend", "default", "all"] +DEFAULT_TARGETS = "default" TARGETS_TEST = ["-test262"] @@ -45,15 +43,15 @@ OUTDIR = "out" Help_message = """ -formot like python ark.py [arch].[mode].[options] [test] +formot like python ark.py [arch].[mode] [options] [test] for example , python ark.py x64.release [arch] can be one of ["x64", "arm", "arm64"] [mode] can be one of ["release", "debug"] [options] -target: only support ark_js_vm and all now -clean: clear your data in output dir + target: only support [ets_runtime | ets_frontend | default | all] now + clean: clear your data in output dir [test] --test262: run test262 + test262: run test262 """ def PrintHelp(): @@ -138,6 +136,7 @@ def Get_templete(args_list): global_test = part else: print("\033[34mUnkown word: %s\033[0m" % part) + PrintHelp() sys.exit(1) # Determine the target CPU if global_arche in ("arm", "arm64"): @@ -173,6 +172,7 @@ def Build(template): if code != 0: return code print("=== clean success! ===") + exit(0) build_log = os.path.join(path, "build.log") if not os.path.exists("args.gn"): args_gn = os.path.join(path, "args.gn") diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index e92dc231eace434eb88440e083940afc4581de64..1c0c52c114786895ba6d84b4b4d570073ab69d76 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -74,6 +74,13 @@ if (current_os == "ohos") { is_posix = true is_win = false is_mingw = false +} else if (current_os == "mingw") { + is_ohos = false + is_linux = false + is_mac = false + is_posix = true + is_win = false + is_mingw = true } if (host_toolchain == "") { diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn index fcf776fcec5b5e089ded3f02c0611d0479679013..0078fc5284907bd9c8800b730292201db4e6149f 100644 --- a/build/core/gn/BUILD.gn +++ b/build/core/gn/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ets_frontend/ts2panda/ts2abc_config.gni") +import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") import("//ets_runtime/js_runtime_config.gni") print("root_out_dir=$root_out_dir") @@ -25,10 +25,20 @@ print("target_os=$target_os, target_cpu=$target_cpu") print() -group("ark_js_packages") { +group("default") { + deps = [ + ":ets_frontend", + ":ets_runtime", + ] +} + +group("ets_runtime") { deps = [ "//ets_runtime/ecmascript/js_vm:ark_js_vm" ] } -group("ark_es2abc") { - deps = [ "//ets_frontend/es2panda:es2panda" ] +group("ets_frontend") { + deps = [ + "//arkcompiler/ets_frontend/es2panda:es2panda", + "//arkcompiler/ets_frontend/merge_abc:merge_abc", + ] } diff --git a/build/templates/cxx/cxx.gni b/build/templates/cxx/cxx.gni index 5c232d0a23497c6d885536f5bcf8b16861d5018d..6d15352314ec07372168b51bafca1daa4487fcc1 100755 --- a/build/templates/cxx/cxx.gni +++ b/build/templates/cxx/cxx.gni @@ -28,25 +28,12 @@ template("ohos_executable") { if (defined(invoker.subsystem_name) && defined(invoker.part_name)) { subsystem_name = invoker.subsystem_name part_name = invoker.part_name - } else if (defined(invoker.part_name)) { - part_name = invoker.part_name - _part_subsystem_info_file = - "$root_build_dir/build_configs/parts_info/part_subsystem.json" - _arguments = [ - "--part-name", - part_name, - "--part-subsystem-info-file", - rebase_path(_part_subsystem_info_file, root_build_dir), - ] - get_subsystem_script = "//build/templates/common/get_subsystem_name.py" - subsystem_name = - exec_script(get_subsystem_script, _arguments, "trim string") } else if (defined(invoker.subsystem_name)) { subsystem_name = invoker.subsystem_name part_name = subsystem_name } else { - subsystem_name = "common" - part_name = subsystem_name + subsystem_name = "arkcompiler" + part_name = "common" } if (is_standard_system) { output_dir = "${root_out_dir}/${subsystem_name}/${part_name}" @@ -104,6 +91,21 @@ template("ohos_shared_library") { "use_exceptions", "external_deps", ]) + if (defined(invoker.subsystem_name) && defined(invoker.part_name)) { + subsystem_name = invoker.subsystem_name + part_name = invoker.part_name + } else if (defined(invoker.subsystem_name)) { + subsystem_name = invoker.subsystem_name + part_name = subsystem_name + } else { + subsystem_name = "arkcompiler" + part_name = "common" + } + if (is_standard_system) { + output_dir = "${root_out_dir}/${subsystem_name}/${part_name}" + } else { + output_dir = "${root_out_dir}" + } } } diff --git a/build/test.gni b/build/test.gni new file mode 100644 index 0000000000000000000000000000000000000000..605d551b726f9e6e34bbb7767836e7dad6016274 --- /dev/null +++ b/build/test.gni @@ -0,0 +1,78 @@ +# Copyright (c) 2021 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("//arkcompiler/toolchain/build/templates/cxx/cxx.gni") + +# ohos test template +template("_ohos_test") { + assert(defined(invoker.test_type), "test_type is required.") + assert(defined(invoker.module_out_path)) + + _deps = [] + if (defined(invoker.deps)) { + _deps += invoker.deps + } + + # copy fuzz config file + if (defined(invoker.fuzz_config_file)) { + fuzz_config_file = invoker.fuzz_config_file + script = "//build/ohos/testfwk/fuzz_config_file_copy.py" + _arguments = [] + _arguments += [ + "--fuzz-config-file-path", + rebase_path(fuzz_config_file, root_build_dir), + "--fuzz-config-file-output-path", + rebase_path(root_out_dir + "/tests/res", root_build_dir), + ] + exec_script(script, _arguments) + } + + _has_sources = defined(invoker.sources) && invoker.sources != [] + if (_has_sources) { + _c_sources_file = "$target_gen_dir/$target_name.sources" + write_file(_c_sources_file, rebase_path(invoker.sources, root_build_dir)) + } + + ohos_executable(target_name) { + forward_variables_from(invoker, + "*", + [ + "test_type", + "module_out_path", + "visibility", + "resource_config_file", + ]) + forward_variables_from(invoker, [ "visibility" ]) + if (!defined(deps)) { + deps = [] + } + + subsystem_name = "tests" + part_name = invoker.test_type + testonly = true + output_name = "$target_name" + } +} + +template("ohos_unittest") { + _ohos_test(target_name) { + forward_variables_from(invoker, "*") + test_type = "unittest" + deps = [] + if (defined(invoker.deps)) { + deps += invoker.deps + } + + # deps += [ "//third_party/googletest:gtest_main" ] + } +} diff --git a/build/third_party_gn/protobuf/BUILD.gn b/build/third_party_gn/protobuf/BUILD.gn index 6c263fbc29c76b957295d73b5adc85c1177c3f3c..9bbc8ee8dcdf589d5a86050c12df20495ea4e491 100644 --- a/build/third_party_gn/protobuf/BUILD.gn +++ b/build/third_party_gn/protobuf/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. if (defined(ark_standalone_build)) { - import("//profiler//build/config.gni") + import("//developtools/profiler//build/config.gni") import("$build_root/ark.gni") } else { import("//build/ohos.gni") diff --git a/build/toolchain/mingw/BUILD.gn b/build/toolchain/mingw/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..c3e602c98d17bb13cb2b5e267a758b4519c01213 --- /dev/null +++ b/build/toolchain/mingw/BUILD.gn @@ -0,0 +1,58 @@ +# Copyright (c) 2021 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("//arkcompiler/toolchain/build/toolchain/gcc_toolchain.gni") +declare_args() { + # Whether unstripped binaries, i.e. compiled with debug symbols, should be + # considered runtime_deps rather than stripped ones. + mingw_unstripped_runtime_outputs = true +} + +template("mingw_toolchain") { + gcc_toolchain(target_name) { + assert(defined(invoker.toolchain_root), + "toolchain_root must be defined for mingw_toolchain.") + assert(defined(invoker.toolchain_args), + "toolchain_args must be defined for mingw_toolchain.") + toolchain_args = invoker.toolchain_args + + # Output linker map files for binary size analysis. + enable_linker_map = true + + _mingw_tool_prefix = + rebase_path("${invoker.toolchain_root}/bin", root_build_dir) + + cc = "${_mingw_tool_prefix}/clang" + cxx = "${_mingw_tool_prefix}/clang++" + ar = "${_mingw_tool_prefix}/llvm-ar" + ld = cxx + readelf = "${_mingw_tool_prefix}/llvm-readelf" + nm = "${_mingw_tool_prefix}/llvm-nm" + strip = "${_mingw_tool_prefix}/llvm-strip" + use_unstripped_as_runtime_outputs = mingw_unstripped_runtime_outputs + + executable_extension = ".exe" + shlib_extension = ".dll" + } +} + +mingw_toolchain("mingw_x86_64") { + toolchain_root = "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw" + toolchain_args = { + current_cpu = "x86_64" + current_os = "mingw" + + # use_custom_libcxx = false + is_clang = true + } +} diff --git a/build/toolchain/toolchain.gni b/build/toolchain/toolchain.gni index 0f051224fa66f413dc91403ede2d75cbc938f592..26c1dfbdbe200f22c92a8a35e2cb5c9104062a2d 100755 --- a/build/toolchain/toolchain.gni +++ b/build/toolchain/toolchain.gni @@ -101,7 +101,7 @@ stamp_description = "STAMP {{output}}" copy_description = "COPY {{source}} {{output}}" if (host_os == "win") { _tool_wrapper_path = - rebase_path("//build/toolchain/win/tool_wrapper.py", root_build_dir) + rebase_path("$build_root/toolchain/win/tool_wrapper.py", root_build_dir) stamp_command = "cmd /c type nul > \"{{output}}\"" copy_command = "$python_path $_tool_wrapper_path recursive-mirror {{source}} {{output}}" diff --git a/inspector/BUILD.gn b/inspector/BUILD.gn index 0e6f4952c53d8c6df0d93f810a01a621573c5a51..4cd8bd53eea84e303ff7614c03477c8cf67df222 100644 --- a/inspector/BUILD.gn +++ b/inspector/BUILD.gn @@ -25,43 +25,72 @@ config("ark_debugger_config") { ] } -ohos_shared_library("ark_debugger") { - deps = [] - defines = [ - "BOOST_ERROR_CODE_HEADER_ONLY", - "BOOST_CLANG", - ] +config("ark_platform_config") { + defines = [] + if (is_ohos) { + defines += [ + "OHOS_PLATFORM", + "UNIX_PLATFORM", + ] + } else if (is_mingw) { + defines += [ "WINDOWS_PLATFORM" ] + } else if (is_mac) { + defines += [ + "MAC_PLATFORM", + "UNIX_PLATFORM", + ] + } else if (target_os == "android") { + defines += [ + "ANDROID_PLATFORM", + "UNIX_PLATFORM", + ] + } else if (target_os == "ios") { + defines += [ + "UNIX_PLATFORM", + "IOS_PLATFORM", + ] + } else { + defines += [ "UNIX_PLATFORM" ] + } +} - defines += [ "ACE_LOG_TAG=\"ArkDebugger\"" ] +ohos_shared_library("ark_debugger") { + deps = [ ":ark_debugger_static" ] if (is_mingw || is_mac) { - cflags = [ "-std=c++17" ] if (is_mingw) { platform = "windows" - defines += [ "WINDOWS_PLATFORM" ] ldflags = [ "-lwsock32", "-lws2_32", ] } else { platform = "mac" - defines += [ - "MAC_PLATFORM", - "UNIX_PLATFORM", - ] } - deps = [ + deps += [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_$platform", ] } else if (target_os == "android") { - defines += [ - "ANDROID_PLATFORM", - "UNIX_PLATFORM", - ] aosp_deps = [ "shared_library:liblog" ] } else { external_deps = [ "hiviewdfx_hilog_native:libhilog" ] - defines += [ "UNIX_PLATFORM" ] + } + + part_name = "toolchain" + subsystem_name = "arkcompiler" +} + +ohos_source_set("ark_debugger_static") { + deps = [] + defines = [ + "BOOST_ERROR_CODE_HEADER_ONLY", + "BOOST_CLANG", + ] + + defines += [ "ACE_LOG_TAG=\"ArkDebugger\"" ] + + if (is_mingw || is_mac) { + cflags = [ "-std=c++17" ] } include_dirs = [ @@ -77,10 +106,20 @@ ohos_shared_library("ark_debugger") { ] if (target_os == "android") { sources += [ "log_wrapper.cpp" ] + } else if (target_os == "ios") { + sources += [ "log_wrapper.cpp" ] + include_dirs += [ + "//arkcompiler/toolchain", + "//arkcompiler/ets_runtime", + "//arkcompiler/runtime_core", + ] + } else { + include_dirs += + [ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include" ] } - configs = [ ":ark_debugger_config" ] - - part_name = "toolchain" - subsystem_name = "arkcompiler" + configs = [ + ":ark_debugger_config", + ":ark_platform_config", + ] } diff --git a/inspector/inspector.cpp b/inspector/inspector.cpp index f965277364f4c45c2b026a06afe330bc33f87fd4..592263c8092314e8d505702fe99444588b1cd8cd 100644 --- a/inspector/inspector.cpp +++ b/inspector/inspector.cpp @@ -23,6 +23,10 @@ #include "log_wrapper.h" #include "library_loader.h" +#if defined(IOS_PLATFORM) +#include "tooling/debugger_service.h" +#endif + namespace OHOS::ArkCompiler::Toolchain { namespace { enum DispatchStatus : int32_t { @@ -49,9 +53,12 @@ std::atomic g_hasArkFuncsInited = false; std::unordered_map g_inspectors; std::shared_mutex g_mutex; +#if !defined(IOS_PLATFORM) thread_local void* g_handle = nullptr; +#endif thread_local void* g_vm = nullptr; +#if !defined(IOS_PLATFORM) #if defined(WINDOWS_PLATFORM) constexpr char ARK_DEBUGGER_SHARED_LIB[] = "libark_ecma_debugger.dll"; #elif defined(MAC_PLATFORM) @@ -59,6 +66,7 @@ constexpr char ARK_DEBUGGER_SHARED_LIB[] = "libark_ecma_debugger.dylib"; #else constexpr char ARK_DEBUGGER_SHARED_LIB[] = "libark_ecma_debugger.so"; #endif +#endif void* HandleClient(void* const server) { @@ -71,6 +79,7 @@ void* HandleClient(void* const server) return nullptr; } +#if !defined(IOS_PLATFORM) bool LoadArkDebuggerLibrary() { if (g_handle != nullptr) { @@ -88,6 +97,7 @@ void* GetArkDynFunction(const char* symbol) { return ResolveSymbol(g_handle, symbol); } +#endif void SendReply(const void* vm, const std::string& message) { @@ -109,10 +119,12 @@ void ResetServiceLocked() iter->second = nullptr; g_inspectors.erase(iter); } +#if !defined(IOS_PLATFORM) if (g_handle != nullptr) { CloseHandle(g_handle); g_handle = nullptr; } +#endif } bool InitializeInspector(void* vm, const std::string& componentName, int32_t instanceId, @@ -158,6 +170,7 @@ bool InitializeArkFunctions() if (g_hasArkFuncsInited) { return true; } +#if !defined(IOS_PLATFORM) g_initializeDebugger = reinterpret_cast( GetArkDynFunction("InitializeDebugger")); if (g_initializeDebugger == nullptr) { @@ -194,6 +207,15 @@ bool InitializeArkFunctions() ResetServiceLocked(); return false; } +#else + using namespace panda::ecmascript; + g_initializeDebugger = reinterpret_cast(&tooling::InitializeDebugger); + g_uninitializeDebugger = reinterpret_cast(&tooling::UninitializeDebugger); + g_waitForDebugger = reinterpret_cast(&tooling::WaitForDebugger); + g_onMessage = reinterpret_cast(&tooling::OnMessage); + g_getDispatchStatus = reinterpret_cast(&tooling::GetDispatchStatus); + g_processMessage = reinterpret_cast(&tooling::ProcessMessage); +#endif g_hasArkFuncsInited = true; return true; @@ -231,9 +253,11 @@ bool StartDebug(const std::string& componentName, void* vm, bool isDebugMode, in const DebuggerPostTask& debuggerPostTask) { g_vm = vm; +#if !defined(IOS_PLATFORM) if (!LoadArkDebuggerLibrary()) { return false; } +#endif if (!InitializeArkFunctions()) { LOGE("Initialize ark functions failed"); return false; diff --git a/inspector/log_wrapper.cpp b/inspector/log_wrapper.cpp index 5e24b2684fb4ebcad74f4c12b7bd8b4f7bf0ab30..59f663ef70aff65b120dc56f6eccd6fa0c5eefb7 100644 --- a/inspector/log_wrapper.cpp +++ b/inspector/log_wrapper.cpp @@ -15,15 +15,12 @@ #include "log_wrapper.h" +#include #ifdef ANDROID_PLATFORM #include -#include #endif namespace OHOS::ArkCompiler::Toolchain { -#ifdef ANDROID_PLATFORM -const char* tag = "ArkCompiler"; - void StripString(const std::string& prefix, std::string& str) { for (auto pos = str.find(prefix, 0); pos != std::string::npos; pos = str.find(prefix, pos)) { @@ -38,8 +35,9 @@ std::string StripFormatString(const char* fmt) StripString("{private}", newFmt); return newFmt; } - -void AndroidLog::PrintLog(LogLevel level, const char* fmt, ...) +#ifdef ANDROID_PLATFORM +const char* tag = "ArkCompiler"; +void StdLog::PrintLog(LogLevel level, const char* fmt, ...) { std::string formatted = StripFormatString(fmt); va_list args; @@ -47,5 +45,50 @@ void AndroidLog::PrintLog(LogLevel level, const char* fmt, ...) __android_log_vprint(static_cast(level), tag, formatted.c_str(), args); va_end(args); } +#elif defined(IOS_PLATFORM) +constexpr int32_t MAX_BUFFER_SIZE = 100; +void StdLog::PrintLog(LogLevel level, const char* fmt, ...) +{ + std::string formatted = StripFormatString(fmt); + va_list args; + va_start(args, fmt); + + char buf[MAX_BUFFER_SIZE]; + if (vsnprintf(buf, sizeof(buf), formatted.c_str(), args) < 0 && errno == EINVAL) { + return; + } + va_end(args); + + char timeBuf[MAX_BUFFER_SIZE]; + const char* domainTag = "[ArkCompiler Debugger]"; + std::string levelTag; + switch (level) { + case LogLevel::FATAL: + levelTag = "[FATAL]"; + break; + case LogLevel::ERROR: + levelTag = "[ERROR]"; + break; + case LogLevel::WARN: + levelTag = "[WARN]"; + break; + case LogLevel::INFO: + levelTag = "[INFO]"; + break; + case LogLevel::DEBUG: + levelTag = "[DEBUG]"; + break; + default: + levelTag = "[DEFAULT]"; + break; + } + + if (snprintf(timeBuf, sizeof(timeBuf), "%s", + domainTag, levelTag.c_str(), std::this_thread::get_id()) < 0) { + return; + } + + printf("%s %s\r\n", timeBuf, buf); +} #endif } // namespace OHOS::ArkCompiler::Toolchain \ No newline at end of file diff --git a/inspector/log_wrapper.h b/inspector/log_wrapper.h index cc62b13204993d8df6f63ff9b70dad0dc178b07c..a8723a31d9963f8eeb7f2ea4505443f519788070 100644 --- a/inspector/log_wrapper.h +++ b/inspector/log_wrapper.h @@ -16,7 +16,7 @@ #ifndef ARKCOMPILER_TOOLCHAIN_INSPECTOR_LOG_WRAPPER_H #define ARKCOMPILER_TOOLCHAIN_INSPECTOR_LOG_WRAPPER_H -#if !defined(ANDROID_PLATFORM) +#if !defined(ANDROID_PLATFORM) && !defined(IOS_PLATFORM) #include "hilog/log.h" #endif @@ -37,7 +37,7 @@ namespace OHOS::ArkCompiler::Toolchain { #undef LOGD #endif -#if defined(ANDROID_PLATFORM) +#if defined(ANDROID_PLATFORM) || defined(IOS_PLATFORM) enum class LogLevel { UNKNOWN, DEFAULT, @@ -48,10 +48,10 @@ enum class LogLevel { ERROR, FATAL }; -class AndroidLog { +class StdLog { public: - AndroidLog() = default; - ~AndroidLog() = default; + StdLog() = default; + ~StdLog() = default; static void PrintLog(LogLevel level, const char* fmt, ...); }; @@ -63,12 +63,12 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { }; #endif -#if defined(ANDROID_PLATFORM) -#define LOGF(fmt, ...) AndroidLog::PrintLog(LogLevel::FATAL, fmt, ##__VA_ARGS__) -#define LOGE(fmt, ...) AndroidLog::PrintLog(LogLevel::ERROR, fmt, ##__VA_ARGS__) -#define LOGW(fmt, ...) AndroidLog::PrintLog(LogLevel::WARN, fmt, ##__VA_ARGS__) -#define LOGI(fmt, ...) AndroidLog::PrintLog(LogLevel::INFO, fmt, ##__VA_ARGS__) -#define LOGD(fmt, ...) AndroidLog::PrintLog(LogLevel::DEBUG, fmt, ##__VA_ARGS__) +#if defined(ANDROID_PLATFORM) || defined(IOS_PLATFORM) +#define LOGF(fmt, ...) StdLog::PrintLog(LogLevel::FATAL, fmt, ##__VA_ARGS__) +#define LOGE(fmt, ...) StdLog::PrintLog(LogLevel::ERROR, fmt, ##__VA_ARGS__) +#define LOGW(fmt, ...) StdLog::PrintLog(LogLevel::WARN, fmt, ##__VA_ARGS__) +#define LOGI(fmt, ...) StdLog::PrintLog(LogLevel::INFO, fmt, ##__VA_ARGS__) +#define LOGD(fmt, ...) StdLog::PrintLog(LogLevel::DEBUG, fmt, ##__VA_ARGS__) #else #define LOGF(fmt, ...) OHOS::HiviewDFX::HiLog::Fatal(LABEL, fmt, ##__VA_ARGS__) #define LOGE(fmt, ...) OHOS::HiviewDFX::HiLog::Error(LABEL, fmt, ##__VA_ARGS__) diff --git a/inspector/ws_server.cpp b/inspector/ws_server.cpp index 08f64103a2a9e9c48213d4d8900d63fa37066c0e..60de0a0fc1ab43b92d7d731f635dec77cc5cf2f9 100644 --- a/inspector/ws_server.cpp +++ b/inspector/ws_server.cpp @@ -30,7 +30,7 @@ void WsServer::RunServer() terminateExecution_ = false; try { tid_ = pthread_self(); -#if defined(WINDOWS_PLATFORM) || defined(MAC_PLATFORM) +#if !defined(OHOS_PLATFORM) constexpr int32_t DEFAULT_INSEPTOR_PORT = 9230; CommProtocol::endpoint endPoint(CommProtocol::v4(), DEFAULT_INSEPTOR_PORT); #else diff --git a/inspector/ws_server.h b/inspector/ws_server.h index f6bc44dac463cf124278ca4462219d31257974ce..752b6b0d65721b4c2832e290ca32a95f4287c9d9 100644 --- a/inspector/ws_server.h +++ b/inspector/ws_server.h @@ -17,7 +17,7 @@ #define ARKCOMPILER_TOOLCHAIN_INSPECTOR_WS_SERVER_H #include -#if defined(WINDOWS_PLATFORM) || defined(MAC_PLATFORM) +#if !defined(OHOS_PLATFORM) #include #else #include @@ -33,7 +33,7 @@ namespace OHOS::ArkCompiler::Toolchain { namespace beast = boost::beast; namespace websocket = beast::websocket; -#if defined(WINDOWS_PLATFORM) || defined(MAC_PLATFORM) +#if !defined(OHOS_PLATFORM) using CommProtocol = boost::asio::ip::tcp; #else using CommProtocol = boost::asio::local::stream_protocol; diff --git a/test/test_helper.gni b/test/test_helper.gni index e9a4c739061aec0ea54cdb546376db6b931947a1..0ab7c137448464addd6685820dd724b20247942c 100644 --- a/test/test_helper.gni +++ b/test/test_helper.gni @@ -12,12 +12,10 @@ # limitations under the License. import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") -import("//arkcompiler/ets_frontend/ts2panda/ts2abc_config.gni") import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//build/ohos.gni") -import("//build/test.gni") +import("$build_root/test.gni") -if (is_standard_system) { +if (is_standard_system || ark_standalone_build) { _icu_path_ = "thirdparty/icu" } else { _icu_path_ = "global/i18n" diff --git a/toolchain.gni b/toolchain.gni index 7cd13cfb7108e7c6ebce8c6cd173212de1cd2232..a358638585f8cfb61f75c614e181962a07c577d5 100644 --- a/toolchain.gni +++ b/toolchain.gni @@ -11,13 +11,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +if (!defined(ark_standalone_build)) { + ark_standalone_build = false +} + toolchain_root = "//arkcompiler//toolchain" ark_root = "//arkcompiler/runtime_core" js_root = "//arkcompiler/ets_runtime" -third_party_gn_path = "//third_party" + +if (!ark_standalone_build) { + ark_third_party_root = "//third_party" + build_root = "//build" + import("$build_root/ohos.gni") +} else { + ark_third_party_root = "//arkcompiler/toolchain/build/third_party_gn" + import("$build_root/ark.gni") +} # For OpenHarmony build, always link with the static lib: sdk_libc_secshared_dep = - "$third_party_gn_path/bounds_checking_function:libsec_static" + "$ark_third_party_root/bounds_checking_function:libsec_static" sdk_libc_secshared_config = - "$third_party_gn_path/bounds_checking_function:libsec_public_config" + "$ark_third_party_root/bounds_checking_function:libsec_public_config" diff --git a/tooling/BUILD.gn b/tooling/BUILD.gn index 3cfa4e16f9b7dcf1487fe31dcdc5de5ec9cd1bfb..845b2d2508c3f3a5332cb9864ba2c82a9d47a5df 100644 --- a/tooling/BUILD.gn +++ b/tooling/BUILD.gn @@ -44,7 +44,7 @@ debugger_sources = [ "dispatcher.cpp", "protocol_handler.cpp", ] -if (!is_mingw && !is_mac) { +if (!is_mingw && !is_mac && target_os != "ios") { debugger_sources += [ "agent/heapprofiler_impl.cpp", "agent/profiler_impl.cpp", diff --git a/tooling/agent/debugger_impl.cpp b/tooling/agent/debugger_impl.cpp index 11ee643cac67ca2d3f2c12face023271f3a629d4..dba95d62a5f5e0cc6537608d8891e4e70a70123a 100644 --- a/tooling/agent/debugger_impl.cpp +++ b/tooling/agent/debugger_impl.cpp @@ -62,7 +62,8 @@ DebuggerImpl::~DebuggerImpl() bool DebuggerImpl::NotifyScriptParsed(ScriptId scriptId, const std::string &fileName, std::string_view entryPoint) { -#if !defined(PANDA_TARGET_WINDOWS) && !defined(PANDA_TARGET_MACOS) && !defined(PANDA_TARGET_ANDROID) +#if !defined(PANDA_TARGET_WINDOWS) && !defined(PANDA_TARGET_MACOS) \ + && !defined(PANDA_TARGET_ANDROID) && !defined(PANDA_TARGET_IOS) if (fileName.substr(0, DATA_APP_PATH.length()) != DATA_APP_PATH) { LOG_DEBUGGER(DEBUG) << "NotifyScriptParsed: unsupport file: " << fileName; return false; diff --git a/tooling/test/BUILD.gn b/tooling/test/BUILD.gn index c8625b053fac0e00b1a1f111e59fbe90fe2c1bf4..97b9fd6d147d3a0943db51f2bdfebc2344dc1b9e 100644 --- a/tooling/test/BUILD.gn +++ b/tooling/test/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") -import("//arkcompiler/ets_frontend/ts2panda/ts2abc_config.gni") import("//arkcompiler/ets_runtime/js_runtime_config.gni") import("//arkcompiler/toolchain/test/test_helper.gni") import("//build/ohos.gni")