• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
15import("//arkcompiler/ets_runtime/js_runtime_config.gni")
16import("$build_root/config/sanitizers/sanitizers.gni")
17import("$build_root/toolchain/toolchain.gni")
18
19group("ark_js_packages") {
20  deps = []
21  if (host_os != "mac") {
22    deps += [
23      ":libark_jsruntime",
24      "ecmascript/compiler:stub.an",
25      "ecmascript/js_vm:ark_js_context",
26      "ecmascript/js_vm:ark_js_vm",
27      "ecmascript/quick_fix:quick_fix",
28    ]
29    if (is_clang && clang_version != "9.0.3" && current_cpu == "arm64" &&
30        is_ohos) {
31      deps += [
32        "ecmascript/compiler:ark_aot_compiler",
33        "ecmascript/pgo_profiler/prof_dump:profdump",
34      ]
35    }
36  }
37}
38
39group("ark_js_host_windows_tools_packages") {
40  deps = []
41  if (host_os != "mac" && target_os != "android") {
42    deps += [
43      "ecmascript/compiler:ark_aot_compiler($build_root/toolchain/mingw:mingw_x86_64)",
44      "ecmascript/js_vm:ark_js_context($build_root/toolchain/mingw:mingw_x86_64)",
45      "ecmascript/js_vm:ark_js_vm($build_root/toolchain/mingw:mingw_x86_64)",
46      "ecmascript/pgo_profiler/prof_dump:profdump($build_root/toolchain/mingw:mingw_x86_64)",
47    ]
48  }
49}
50
51group("ark_js_host_mac_tools_packages") {
52  deps = []
53  if (host_os == "mac") {
54    if (host_cpu == "arm64") {
55      deps += [
56        "ecmascript/compiler:ark_aot_compiler($build_root/toolchain/mac:clang_arm64)",
57        "ecmascript/js_vm:ark_js_context($build_root/toolchain/mac:clang_arm64)",
58        "ecmascript/js_vm:ark_js_vm($build_root/toolchain/mac:clang_arm64)",
59        "ecmascript/pgo_profiler/prof_dump:profdump($build_root/toolchain/mac:clang_arm64)",
60      ]
61    } else {
62      deps += [
63        "ecmascript/compiler:ark_aot_compiler($build_root/toolchain/mac:clang_x64)",
64        "ecmascript/js_vm:ark_js_context($build_root/toolchain/mac:clang_x64)",
65        "ecmascript/js_vm:ark_js_vm($build_root/toolchain/mac:clang_x64)",
66        "ecmascript/pgo_profiler/prof_dump:profdump($build_root/toolchain/mac:clang_x64)",
67      ]
68    }
69  }
70}
71
72group("ark_js_host_linux_tools_packages") {
73  deps = []
74  if (host_os != "mac") {
75    deps += [
76      "ecmascript/js_vm:ark_js_context(${host_toolchain})",
77      "ecmascript/js_vm:ark_js_vm(${host_toolchain})",
78      "ecmascript/quick_fix:quick_fix(${host_toolchain})",
79    ]
80    if (is_standard_system) {
81      deps += [
82        "ecmascript/pgo_profiler/prof_dump:profdump(${host_toolchain})",
83        "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})",
84        "//arkcompiler/ets_runtime/ecmascript/compiler:ark_stub_compiler(${host_toolchain})",
85      ]
86    }
87  }
88}
89
90group("ark_js_unittest") {
91  testonly = true
92  deps = []
93  if (host_os != "mac") {
94    deps += [
95      "ecmascript/pgo_profiler/tests:unittest",
96      "//arkcompiler/ets_runtime/ecmascript/base/tests:unittest",
97      "//arkcompiler/ets_runtime/ecmascript/builtins/tests:unittest",
98      "//arkcompiler/ets_runtime/ecmascript/containers/tests:unittest",
99      "//arkcompiler/ets_runtime/ecmascript/debugger/tests:unittest",
100      "//arkcompiler/ets_runtime/ecmascript/dfx/hprof/tests:unittest",
101      "//arkcompiler/ets_runtime/ecmascript/ic/tests:unittest",
102      "//arkcompiler/ets_runtime/ecmascript/jobs/tests:unittest",
103      "//arkcompiler/ets_runtime/ecmascript/jspandafile/tests:unittest",
104      "//arkcompiler/ets_runtime/ecmascript/module/tests:unittest",
105      "//arkcompiler/ets_runtime/ecmascript/napi/test:unittest",
106      "//arkcompiler/ets_runtime/ecmascript/regexp/tests:unittest",
107      "//arkcompiler/ets_runtime/ecmascript/require/tests:unittest",
108      "//arkcompiler/ets_runtime/ecmascript/snapshot/tests:unittest",
109      "//arkcompiler/ets_runtime/ecmascript/tests:unittest",
110      "//arkcompiler/ets_runtime/ecmascript/ts_types/tests:unittest",
111    ]
112    if (is_ohos && is_standard_system) {
113      deps += [ "//arkcompiler/ets_runtime/test/fuzztest:fuzztest" ]
114    }
115  }
116}
117
118group("ark_js_perform") {
119  testonly = true
120  deps = []
121  deps += [ "//arkcompiler/ets_runtime/test/perform:perform" ]
122}
123
124group("ark_unittest") {
125  testonly = true
126  deps = []
127  if (host_os != "mac") {
128    # js unittest
129    deps += [
130      "ecmascript/base/tests:host_unittest",
131      "ecmascript/builtins/tests:host_unittest",
132      "ecmascript/containers/tests:host_unittest",
133      "ecmascript/dfx/hprof/tests:host_unittest",
134      "ecmascript/ic/tests:host_unittest",
135      "ecmascript/jobs/tests:host_unittest",
136      "ecmascript/jspandafile/tests:host_unittest",
137      "ecmascript/module/tests:host_unittest",
138      "ecmascript/napi/test:host_unittest",
139      "ecmascript/pgo_profiler/tests:host_unittest",
140      "ecmascript/regexp/tests:host_unittest",
141      "ecmascript/require/tests:host_unittest",
142      "ecmascript/snapshot/tests:host_unittest",
143      "ecmascript/tests:host_unittest",
144      "ecmascript/ts_types/tests:host_unittest",
145    ]
146    if (!run_with_asan) {
147      if (!(ark_standalone_build && current_os == "ohos")) {
148        deps += [ "ecmascript/compiler/tests:host_unittest" ]
149      }
150    }
151  }
152}
153
154if (!run_with_asan) {
155  _builtins_dts_path_ =
156      rebase_path("./ecmascript/ts_types/lib_ark_builtins.d.ts")
157
158  _es2abc_builtins_d_abc_path_ =
159      "$target_out_dir/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
160
161  es2abc_gen_abc("es2abc_gen_builtins_d_abc") {
162    extra_visibility = [ "*" ]
163
164    # extra_dependencies = _deps_
165    src_js = rebase_path(_builtins_dts_path_)
166    dst_file = rebase_path(_es2abc_builtins_d_abc_path_)
167    extension = "ts"
168    extra_args = [
169      "--module",
170      "--merge-abc",
171      "--type-extractor",
172      "--type-dts-builtin",
173    ]
174
175    in_puts = [ _builtins_dts_path_ ]
176    out_puts = [ _es2abc_builtins_d_abc_path_ ]
177  }
178}
179
180group("ark_runtime_host_unittest") {
181  testonly = true
182  deps = []
183  if (host_os != "mac") {
184    # js unittest
185    deps += [ ":ark_unittest" ]
186
187    # js bytecode test
188    deps += [ "$js_root/test/moduletest:ark_js_moduletest" ]
189
190    # quickfix test
191    deps += [ "$js_root/test/quickfix:ark_quickfix_test" ]
192
193    # ts aot test and asm test
194    if (!run_with_asan) {
195      deps += [
196        "$js_root/test/aottest:ark_aot_test",
197
198        #"$js_root/test/moduletest:ark_asm_single_step_test",
199        "$js_root/test/deopttest:ark_deopt_test",
200        "$js_root/test/moduletest:ark_asm_test",
201        "$js_root/test/typeinfer:ark_typeinfer_test",
202      ]
203    }
204  }
205}
206
207config("ark_jsruntime_public_config") {
208  configs = [
209    "$ark_root/libpandabase:arkbase_public_config",
210    "$ark_root/libpandafile:arkfile_public_config",
211    "$ark_third_party_root/icu/icu4c:icu_config",
212    sdk_libc_secshared_config,
213  ]
214
215  include_dirs = [
216    "$js_root",
217    "$js_root/ecmascript/napi/include",
218  ]
219}
220
221intl_sources = []
222
223if (enable_ark_intl) {
224  intl_sources += [
225    "ecmascript/builtins/builtins_collator.cpp",
226    "ecmascript/builtins/builtins_date_time_format.cpp",
227    "ecmascript/builtins/builtins_displaynames.cpp",
228    "ecmascript/builtins/builtins_intl.cpp",
229    "ecmascript/builtins/builtins_list_format.cpp",
230    "ecmascript/builtins/builtins_locale.cpp",
231    "ecmascript/builtins/builtins_number_format.cpp",
232    "ecmascript/builtins/builtins_plural_rules.cpp",
233    "ecmascript/builtins/builtins_relative_time_format.cpp",
234    "ecmascript/js_collator.cpp",
235    "ecmascript/js_date_time_format.cpp",
236    "ecmascript/js_displaynames.cpp",
237    "ecmascript/js_list_format.cpp",
238    "ecmascript/js_locale.cpp",
239    "ecmascript/js_number_format.cpp",
240    "ecmascript/js_plural_rules.cpp",
241    "ecmascript/js_relative_time_format.cpp",
242  ]
243} else {
244  if (target_os != "android" && target_os != "ios") {
245    intl_sources += [ "ecmascript/intl/global_intl_helper.cpp" ]
246  }
247}
248
249config("ark_jsruntime_compiler_config") {
250  configs = [ "$js_root:ark_jsruntime_common_config" ]
251}
252
253config("hiviewdfx_config") {
254  defines = []
255  if (enable_dump_in_faultlog) {
256    defines += [ "ENABLE_DUMP_IN_FAULTLOG" ]
257  }
258  if (enable_bytrace) {
259    defines += [ "ENABLE_BYTRACE" ]
260    cflags_cc = [ "-Wno-gnu-zero-variadic-macro-arguments" ]
261  }
262  if (enable_hitrace) {
263    defines += [ "ENABLE_HITRACE" ]
264  }
265  if (enable_hilog) {
266    defines += [ "ENABLE_HILOG" ]
267  }
268
269  include_dirs = [ "$hilog_root/include" ]
270}
271
272config("ark_jsruntime_common_config") {
273  configs = [ ":hiviewdfx_config" ]
274
275  defines = [ "PANDA_ENABLE_LTO" ]
276  cflags_cc = [
277    "-Wall",
278    "-Wshadow",
279    "-Werror",
280    "-Wextra",
281    "-pedantic",
282    "-Wno-invalid-offsetof",
283    "-Wno-gnu-statement-expression",
284    "-pipe",
285    "-Wdate-time",
286    "-funwind-tables",
287    "-fno-rtti",
288    "-fasynchronous-unwind-tables",
289    "-Wformat=2",
290    "-std=c++17",
291    "-Wno-unused-but-set-variable",
292  ]
293
294  if (use_musl) {
295    defines += [ "PANDA_USE_MUSL" ]
296  }
297
298  if (build_public_version) {
299    defines += [ "IS_PUBLIC_VERSION" ]
300  }
301
302  if (ark_compile_mode != "release") {
303    ark_profiler_features = [
304      "ECMASCRIPT_SUPPORT_CPUPROFILER",
305      "ECMASCRIPT_SUPPORT_HEAPPROFILER",
306      "ECMASCRIPT_SUPPORT_HEAPSAMPLING",
307      "ECMASCRIPT_SUPPORT_SNAPSHOT",
308    ]
309    defines += [ "ECMASCRIPT_SUPPORT_DEBUGGER" ]
310    defines += ark_profiler_features
311  }
312
313  ldflags = []
314  if (is_linux) {
315    defines += [
316      "PANDA_TARGET_UNIX",
317      "PANDA_TARGET_LINUX",
318      "PANDA_USE_FUTEX",
319    ]
320  } else if (is_mingw) {
321    cflags_cc += [
322      "-std=c++17",
323      "-Wno-ignored-attributes",
324    ]
325    defines += [
326      "PANDA_TARGET_WINDOWS",
327      "_CRTBLD",
328      "__LIBMSVCRT__",
329    ]
330
331    ldflags += [ "-lshlwapi" ]
332
333    # not support profiler on Windows yet
334    if (ark_compile_mode != "release") {
335      defines -= ark_profiler_features
336    }
337  } else if (is_mac) {
338    defines += [
339      "PANDA_TARGET_UNIX",
340      "PANDA_TARGET_MACOS",
341    ]
342
343    # not support profiler on MacOS yet
344    if (ark_compile_mode != "release") {
345      defines -= ark_profiler_features
346    }
347  } else if (target_os == "android") {
348    defines += [
349      "PANDA_TARGET_ANDROID",
350      "PANDA_TARGET_UNIX",
351      "PANDA_USE_FUTEX",
352    ]
353    if (current_cpu == "arm64") {
354      defines += [ "EXCLUDE_C_INTERPRETER" ]
355    }
356    if (!ark_standalone_build) {
357      defines += [ "ENABLE_ANLOG" ]
358    }
359  } else if (target_os == "ios") {
360    defines += [
361      "PANDA_TARGET_IOS",
362      "PANDA_TARGET_UNIX",
363    ]
364
365    # not support profiler on iOS yet
366    if (ark_compile_mode != "release") {
367      defines -= ark_profiler_features
368    }
369  } else {
370    defines += [
371      "PANDA_TARGET_UNIX",
372      "PANDA_USE_FUTEX",
373    ]
374    if (!is_standard_system && (current_cpu != "arm" || is_wearable_product)) {
375      defines += [ "PANDA_TARGET_MOBILE" ]
376    }
377  }
378
379  if (!is_mac && target_os != "ios" && !use_libfuzzer &&
380      !(ark_standalone_build && !enable_lto)) {
381    cflags_cc += [ "-flto=thin" ]
382    ldflags += [ "-flto=thin" ]
383  }
384
385  if (is_debug) {
386    cflags_cc += [
387      "-O0",
388      "-ggdb3",
389    ]
390  } else {
391    defines += [ "NDEBUG" ]
392  }
393
394  if (enable_asm_assert) {
395    defines += [ "ENABLE_ASM_ASSERT" ]
396  }
397
398  if (run_with_asan) {
399    defines += [ "RUN_WITH_ASAN" ]
400  }
401
402  if (enable_cow_array) {
403    defines += [ "ENABLE_COW_ARRAY" ]
404  }
405
406  if (run_with_asan && is_linux &&
407      (current_cpu == "x86" || current_cpu == "x64")) {
408    cflags_cc += [
409      "-fno-inline-functions",
410      "-fno-inline",
411      "-fsanitize=address",
412      "-fsanitize-address-use-after-scope",
413      "-fno-omit-frame-pointer",
414      "-fsanitize=leak",
415    ]
416
417    if (!use_musl) {
418      libs = [ "$clang_base_path/lib64/clang/$clang_version/lib/linux/libclang_rt.asan-x86_64.a" ]
419    } else {
420      libs = [ "$clang_base_path/lib/clang/$clang_version/lib/x86_64-linux-ohos/libclang_rt.asan.a" ]
421    }
422  }
423
424  if (current_cpu == "arm") {
425    defines += [
426      "PANDA_TARGET_ARM32_ABI_SOFT=1",
427      "PANDA_TARGET_ARM32",
428      "PANDA_TARGET_32",
429    ]
430  } else if (current_cpu == "arm64") {
431    defines += [
432      "PANDA_TARGET_ARM64",
433      "PANDA_TARGET_64",
434      "PANDA_ENABLE_GLOBAL_REGISTER_VARIABLES",
435      "PANDA_USE_32_BIT_POINTER",
436    ]
437  } else if (current_cpu == "x86") {
438    defines += [ "PANDA_TARGET_X86" ]
439  } else if (current_cpu == "amd64" || current_cpu == "x64" ||
440             current_cpu == "x86_64") {
441    defines += [
442      "PANDA_TARGET_64",
443      "PANDA_TARGET_AMD64",
444      "PANDA_USE_32_BIT_POINTER",
445    ]
446  }
447  if (enable_ark_intl) {
448    defines += [ "ARK_SUPPORT_INTL" ]
449  } else {
450    if (target_os == "android" || target_os == "ios") {
451      defines += [ "ARK_NOT_SUPPORT_INTL_GLOBAL" ]
452    } else {
453      configs += [ "$global_root/frameworks/intl:intl_util_config" ]
454    }
455  }
456
457  if (enable_leak_check || is_asan) {
458    defines += [ "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK" ]
459  }
460
461  if (is_ohos && is_standard_system) {
462    defines += [ "ENABLE_EXCEPTION_BACKTRACE" ]
463
464    if (use_musl && (current_cpu == "arm" || current_cpu == "arm64") &&
465        !is_mac && !is_mingw && target_os != "ios" && !is_asan) {
466      defines += [ "HOOK_ENABLE" ]
467    }
468  }
469
470  # is_asan: skynet config; run_with_asan: est_runtime enable asan config
471  if (is_asan) {
472    defines += [ "ECMASCRIPT_ENABLE_DFX_CONFIG" ]
473  }
474}
475
476# ecmascript unit testcase config
477config("ecma_test_config") {
478  visibility = [
479    "./ecmascript/*",
480    "./test/fuzztest/*",
481  ]
482
483  configs = [
484    "$js_root:ark_jsruntime_public_config",
485    "$js_root:ark_jsruntime_common_config",
486  ]
487
488  if (enable_leak_check || is_asan) {
489    defines = [ "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK" ]
490  }
491
492  ldflags = [ "-Wl,-rpath=\$ORIGIN/" ]
493  if (!ark_standalone_build) {
494    ldflags += [ "-Wl,--lto-O0" ]
495  }
496}
497
498# ecmascript icu path for testcase config
499config("icu_path_test_config") {
500  icu_data_path = rebase_path("//third_party/icu/ohos_icu4j/data")
501  defines = [ "ICU_PATH=\"${icu_data_path}\"" ]
502}
503
504# asm interpreter enable config
505config("asm_interp_enable_config") {
506  if ((current_cpu == "amd64" || current_cpu == "x64" ||
507       current_cpu == "x86_64" || current_cpu == "arm64") && !is_mingw &&
508      !is_mac && target_os != "ios" && !is_emulator) {
509    defines = [ "SUPPORT_ENABLE_ASM_INTERP" ]
510  }
511}
512
513ecma_source = [
514  "ecmascript/base/array_helper.cpp",
515  "ecmascript/base/atomic_helper.cpp",
516  "ecmascript/base/builtins_base.cpp",
517  "ecmascript/base/error_helper.cpp",
518  "ecmascript/base/json_parser.cpp",
519  "ecmascript/base/json_stringifier.cpp",
520  "ecmascript/base/number_helper.cpp",
521  "ecmascript/base/path_helper.cpp",
522  "ecmascript/base/string_helper.cpp",
523  "ecmascript/base/typed_array_helper.cpp",
524  "ecmascript/base/utf_helper.cpp",
525  "ecmascript/builtins/builtins.cpp",
526  "ecmascript/builtins/builtins_ark_tools.cpp",
527  "ecmascript/builtins/builtins_array.cpp",
528  "ecmascript/builtins/builtins_arraybuffer.cpp",
529  "ecmascript/builtins/builtins_async_from_sync_iterator.cpp",
530  "ecmascript/builtins/builtins_async_function.cpp",
531  "ecmascript/builtins/builtins_async_generator.cpp",
532  "ecmascript/builtins/builtins_atomics.cpp",
533  "ecmascript/builtins/builtins_bigint.cpp",
534  "ecmascript/builtins/builtins_boolean.cpp",
535  "ecmascript/builtins/builtins_dataview.cpp",
536  "ecmascript/builtins/builtins_date.cpp",
537  "ecmascript/builtins/builtins_errors.cpp",
538  "ecmascript/builtins/builtins_finalization_registry.cpp",
539  "ecmascript/builtins/builtins_function.cpp",
540  "ecmascript/builtins/builtins_generator.cpp",
541  "ecmascript/builtins/builtins_global.cpp",
542  "ecmascript/builtins/builtins_iterator.cpp",
543  "ecmascript/builtins/builtins_async_iterator.cpp",
544  "ecmascript/builtins/builtins_json.cpp",
545  "ecmascript/builtins/builtins_lazy_callback.cpp",
546  "ecmascript/builtins/builtins_map.cpp",
547  "ecmascript/builtins/builtins_math.cpp",
548  "ecmascript/builtins/builtins_number.cpp",
549  "ecmascript/builtins/builtins_object.cpp",
550  "ecmascript/builtins/builtins_promise.cpp",
551  "ecmascript/builtins/builtins_promise_handler.cpp",
552  "ecmascript/builtins/builtins_promise_job.cpp",
553  "ecmascript/builtins/builtins_proxy.cpp",
554  "ecmascript/builtins/builtins_reflect.cpp",
555  "ecmascript/builtins/builtins_regexp.cpp",
556  "ecmascript/builtins/builtins_set.cpp",
557  "ecmascript/builtins/builtins_sharedarraybuffer.cpp",
558  "ecmascript/builtins/builtins_string.cpp",
559  "ecmascript/builtins/builtins_string_iterator.cpp",
560  "ecmascript/builtins/builtins_symbol.cpp",
561  "ecmascript/builtins/builtins_typedarray.cpp",
562  "ecmascript/builtins/builtins_weak_map.cpp",
563  "ecmascript/builtins/builtins_weak_ref.cpp",
564  "ecmascript/builtins/builtins_weak_set.cpp",
565  "ecmascript/byte_array.cpp",
566  "ecmascript/compiler/aot_file/elf_builder.cpp",
567  "ecmascript/compiler/aot_file/elf_reader.cpp",
568  "ecmascript/compiler/aot_file/an_file_data_manager.cpp",
569  "ecmascript/compiler/aot_file/an_file_info.cpp",
570  "ecmascript/compiler/aot_file/aot_file_info.cpp",
571  "ecmascript/compiler/aot_file/stub_file_info.cpp",
572  "ecmascript/compiler/aot_file/binary_buffer_parser.cpp",
573  "ecmascript/compiler/aot_file/module_section_des.cpp",
574  "ecmascript/compiler/aot_file/aot_file_manager.cpp",
575  "ecmascript/compiler/pgo_bc_info.cpp",
576  "ecmascript/containers/containers_arraylist.cpp",
577  "ecmascript/containers/containers_deque.cpp",
578  "ecmascript/containers/containers_errors.cpp",
579  "ecmascript/containers/containers_hashmap.cpp",
580  "ecmascript/containers/containers_hashset.cpp",
581  "ecmascript/containers/containers_lightweightmap.cpp",
582  "ecmascript/containers/containers_lightweightset.cpp",
583  "ecmascript/containers/containers_linked_list.cpp",
584  "ecmascript/containers/containers_list.cpp",
585  "ecmascript/containers/containers_plainarray.cpp",
586  "ecmascript/containers/containers_private.cpp",
587  "ecmascript/containers/containers_queue.cpp",
588  "ecmascript/containers/containers_stack.cpp",
589  "ecmascript/containers/containers_treemap.cpp",
590  "ecmascript/containers/containers_treeset.cpp",
591  "ecmascript/containers/containers_vector.cpp",
592  "ecmascript/date_parse.cpp",
593  "ecmascript/deoptimizer/calleeReg.cpp",
594  "ecmascript/deoptimizer/deoptimizer.cpp",
595  "ecmascript/dfx/stackinfo/js_stackinfo.cpp",
596  "ecmascript/dfx/vmstat/caller_stat.cpp",
597  "ecmascript/dfx/vmstat/function_call_timer.cpp",
598  "ecmascript/dfx/vmstat/opt_code_profiler.cpp",
599  "ecmascript/dfx/vmstat/runtime_stat.cpp",
600  "ecmascript/dfx/vm_thread_control.cpp",
601  "ecmascript/dump.cpp",
602  "ecmascript/ecma_context.cpp",
603  "ecmascript/ecma_handle_scope.cpp",
604  "ecmascript/ecma_string.cpp",
605  "ecmascript/ecma_string_table.cpp",
606  "ecmascript/ecma_vm.cpp",
607  "ecmascript/elements.cpp",
608  "ecmascript/frames.cpp",
609  "ecmascript/free_object.cpp",
610  "ecmascript/generator_helper.cpp",
611  "ecmascript/async_generator_helper.cpp",
612  "ecmascript/global_env.cpp",
613  "ecmascript/global_env_constants.cpp",
614  "ecmascript/ic/ic_runtime.cpp",
615  "ecmascript/ic/ic_compare_op.cpp",
616  "ecmascript/ic/invoke_cache.cpp",
617  "ecmascript/ic/profile_type_info.cpp",
618  "ecmascript/ic/property_box.cpp",
619  "ecmascript/ic/proto_change_details.cpp",
620  "ecmascript/interpreter/frame_handler.cpp",
621  "ecmascript/interpreter/interpreter.cpp",
622  "ecmascript/interpreter/interpreter_assembly.cpp",
623  "ecmascript/interpreter/slow_runtime_stub.cpp",
624  "ecmascript/intl/locale_helper.cpp",
625  "ecmascript/jobs/micro_job_queue.cpp",
626  "ecmascript/jspandafile/js_pandafile.cpp",
627  "ecmascript/jspandafile/js_pandafile_manager.cpp",
628  "ecmascript/jspandafile/class_info_extractor.cpp",
629  "ecmascript/jspandafile/debug_info_extractor.cpp",
630  "ecmascript/jspandafile/literal_data_extractor.cpp",
631  "ecmascript/jspandafile/type_literal_extractor.cpp",
632  "ecmascript/jspandafile/accessor/module_data_accessor.cpp",
633  "ecmascript/jspandafile/panda_file_translator.cpp",
634  "ecmascript/jspandafile/js_pandafile_executor.cpp",
635  "ecmascript/jspandafile/scope_info_extractor.cpp",
636  "ecmascript/jspandafile/method_literal.cpp",
637  "ecmascript/jspandafile/program_object.cpp",
638  "ecmascript/js_api/js_api_arraylist.cpp",
639  "ecmascript/js_api/js_api_arraylist_iterator.cpp",
640  "ecmascript/js_api/js_api_deque.cpp",
641  "ecmascript/js_api/js_api_deque_iterator.cpp",
642  "ecmascript/js_api/js_api_hashmap.cpp",
643  "ecmascript/js_api/js_api_hashmap_iterator.cpp",
644  "ecmascript/js_api/js_api_hashset.cpp",
645  "ecmascript/js_api/js_api_hashset_iterator.cpp",
646  "ecmascript/js_api/js_api_lightweightmap.cpp",
647  "ecmascript/js_api/js_api_lightweightmap_iterator.cpp",
648  "ecmascript/js_api/js_api_lightweightset.cpp",
649  "ecmascript/js_api/js_api_lightweightset_iterator.cpp",
650  "ecmascript/js_api/js_api_linked_list.cpp",
651  "ecmascript/js_api/js_api_linked_list_iterator.cpp",
652  "ecmascript/js_api/js_api_list.cpp",
653  "ecmascript/js_api/js_api_list_iterator.cpp",
654  "ecmascript/js_api/js_api_plain_array.cpp",
655  "ecmascript/js_api/js_api_plain_array_iterator.cpp",
656  "ecmascript/js_api/js_api_queue.cpp",
657  "ecmascript/js_api/js_api_queue_iterator.cpp",
658  "ecmascript/js_api/js_api_stack.cpp",
659  "ecmascript/js_api/js_api_stack_iterator.cpp",
660  "ecmascript/js_api/js_api_tree_map.cpp",
661  "ecmascript/js_api/js_api_tree_map_iterator.cpp",
662  "ecmascript/js_api/js_api_tree_set.cpp",
663  "ecmascript/js_api/js_api_tree_set_iterator.cpp",
664  "ecmascript/js_api/js_api_vector.cpp",
665  "ecmascript/js_api/js_api_vector_iterator.cpp",
666  "ecmascript/js_arguments.cpp",
667  "ecmascript/js_array.cpp",
668  "ecmascript/js_array_iterator.cpp",
669  "ecmascript/js_arraybuffer.cpp",
670  "ecmascript/js_async_from_sync_iterator.cpp",
671  "ecmascript/js_async_function.cpp",
672  "ecmascript/js_bigint.cpp",
673  "ecmascript/js_dataview.cpp",
674  "ecmascript/js_date.cpp",
675  "ecmascript/js_for_in_iterator.cpp",
676  "ecmascript/js_finalization_registry.cpp",
677  "ecmascript/js_file_path.cpp",
678  "ecmascript/js_function.cpp",
679  "ecmascript/js_generator_object.cpp",
680  "ecmascript/js_async_generator_object.cpp",
681  "ecmascript/js_hclass.cpp",
682  "ecmascript/js_iterator.cpp",
683  "ecmascript/js_map.cpp",
684  "ecmascript/js_map_iterator.cpp",
685  "ecmascript/method.cpp",
686  "ecmascript/js_object.cpp",
687  "ecmascript/js_primitive_ref.cpp",
688  "ecmascript/js_promise.cpp",
689  "ecmascript/js_proxy.cpp",
690  "ecmascript/js_regexp_iterator.cpp",
691  "ecmascript/js_runtime_options.cpp",
692  "ecmascript/js_serializer.cpp",
693  "ecmascript/js_set.cpp",
694  "ecmascript/js_set_iterator.cpp",
695  "ecmascript/js_stable_array.cpp",
696  "ecmascript/js_string_iterator.cpp",
697  "ecmascript/js_tagged_value.cpp",
698  "ecmascript/js_thread.cpp",
699  "ecmascript/js_typed_array.cpp",
700  "ecmascript/js_weak_container.cpp",
701  "ecmascript/linked_hash_table.cpp",
702  "ecmascript/log.cpp",
703  "ecmascript/message_string.cpp",
704  "ecmascript/mem/barriers.cpp",
705  "ecmascript/mem/c_string.cpp",
706  "ecmascript/mem/chunk.cpp",
707  "ecmascript/mem/dyn_chunk.cpp",
708  "ecmascript/mem/full_gc.cpp",
709  "ecmascript/mem/concurrent_marker.cpp",
710  "ecmascript/mem/concurrent_sweeper.cpp",
711  "ecmascript/mem/free_object_list.cpp",
712  "ecmascript/mem/free_object_set.cpp",
713  "ecmascript/mem/gc_stats.cpp",
714  "ecmascript/mem/heap.cpp",
715  "ecmascript/mem/heap_region_allocator.cpp",
716  "ecmascript/mem/incremental_marker.cpp",
717  "ecmascript/mem/linear_space.cpp",
718  "ecmascript/mem/mem_controller.cpp",
719  "ecmascript/mem/mem_map_allocator.cpp",
720  "ecmascript/mem/native_area_allocator.cpp",
721  "ecmascript/mem/parallel_evacuator.cpp",
722  "ecmascript/mem/parallel_marker.cpp",
723  "ecmascript/mem/partial_gc.cpp",
724  "ecmascript/mem/stw_young_gc.cpp",
725  "ecmascript/mem/space.cpp",
726  "ecmascript/mem/sparse_space.cpp",
727  "ecmascript/mem/verification.cpp",
728  "ecmascript/mem/work_manager.cpp",
729  "ecmascript/mem/allocation_inspector.cpp",
730  "ecmascript/module/js_module_manager.cpp",
731  "ecmascript/module/js_dynamic_import.cpp",
732  "ecmascript/module/js_module_namespace.cpp",
733  "ecmascript/module/js_module_record.cpp",
734  "ecmascript/module/js_module_source_text.cpp",
735  "ecmascript/module/js_module_deregister.cpp",
736  "ecmascript/module/module_data_extractor.cpp",
737  "ecmascript/module/module_path_helper.cpp",
738  "ecmascript/napi/jsnapi.cpp",
739  "ecmascript/object_factory.cpp",
740  "ecmascript/object_operator.cpp",
741  "ecmascript/patch/patch_loader.cpp",
742  "ecmascript/patch/quick_fix_manager.cpp",
743  "ecmascript/pgo_profiler/pgo_profiler.cpp",
744  "ecmascript/pgo_profiler/pgo_profiler_decoder.cpp",
745  "ecmascript/pgo_profiler/pgo_profiler_encoder.cpp",
746  "ecmascript/pgo_profiler/pgo_profiler_info.cpp",
747  "ecmascript/pgo_profiler/pgo_profiler_layout.cpp",
748  "ecmascript/pgo_profiler/pgo_profiler_manager.cpp",
749  "ecmascript/stackmap/ark_stackmap_builder.cpp",
750  "ecmascript/stackmap/ark_stackmap_parser.cpp",
751  "ecmascript/stackmap/llvm_stackmap_parser.cpp",
752  "ecmascript/stackmap/llvm_stackmap_type.cpp",
753  "ecmascript/subtyping_operator.cpp",
754  "ecmascript/taskpool/taskpool.cpp",
755  "ecmascript/taskpool/runner.cpp",
756  "ecmascript/taskpool/task_queue.cpp",
757  "ecmascript/layout_info.cpp",
758  "ecmascript/regexp/regexp_executor.cpp",
759  "ecmascript/regexp/regexp_opcode.cpp",
760  "ecmascript/regexp/regexp_parser.cpp",
761  "ecmascript/regexp/regexp_parser_cache.cpp",
762  "ecmascript/shared_mm/shared_mm.cpp",
763  "ecmascript/tagged_dictionary.cpp",
764  "ecmascript/tagged_hash_array.cpp",
765  "ecmascript/tagged_list.cpp",
766  "ecmascript/tagged_node.cpp",
767  "ecmascript/tagged_tree.cpp",
768  "ecmascript/template_string.cpp",
769  "ecmascript/vtable.cpp",
770  "ecmascript/waiter_list.cpp",
771  "ecmascript/weak_vector.cpp",
772  "ecmascript/stubs/runtime_stubs.cpp",
773  "ecmascript/ts_types/ts_type.cpp",
774  "ecmascript/ts_types/ts_type_accessor.cpp",
775  "ecmascript/ts_types/ts_type_table.cpp",
776  "ecmascript/ts_types/ts_manager.cpp",
777  "ecmascript/ts_types/ts_obj_layout_info.cpp",
778  "ecmascript/ts_types/ts_type_parser.cpp",
779  "ecmascript/ts_types/ts_type_table_generator.cpp",
780  "ecmascript/stubs/test_runtime_stubs.cpp",
781  "ecmascript/builtins/builtins_cjs_module.cpp",
782  "ecmascript/builtins/builtins_cjs_require.cpp",
783  "ecmascript/builtins/builtins_cjs_exports.cpp",
784  "ecmascript/require/js_cjs_module_cache.cpp",
785  "ecmascript/require/js_cjs_module.cpp",
786  "ecmascript/require/js_require_manager.cpp",
787]
788
789hitrace_scope_source = []
790if (is_ohos && is_standard_system && enable_hitrace) {
791  hitrace_scope_source += [ "ecmascript/jobs/hitrace_scope.cpp" ]
792}
793
794ecma_debugger_source = [
795  "ecmascript/debugger/debugger_api.cpp",
796  "ecmascript/debugger/js_debugger.cpp",
797  "ecmascript/debugger/dropframe_manager.cpp",
798  "ecmascript/debugger/hot_reload_manager.cpp",
799]
800
801ecma_profiler_source = [ "ecmascript/napi/dfx_jsnapi.cpp" ]
802if (!is_mingw && !is_mac && target_os != "ios") {
803  if (ark_compile_mode == "debug") {
804    ecma_profiler_source += [
805      "ecmascript/dfx/cpu_profiler/cpu_profiler.cpp",
806      "ecmascript/dfx/cpu_profiler/sampling_processor.cpp",
807      "ecmascript/dfx/cpu_profiler/samples_record.cpp",
808      "ecmascript/dfx/hprof/file_stream.cpp",
809      "ecmascript/dfx/hprof/heap_profiler.cpp",
810      "ecmascript/dfx/hprof/heap_profiler_interface.cpp",
811      "ecmascript/dfx/hprof/heap_root_visitor.cpp",
812      "ecmascript/dfx/hprof/heap_sampling.cpp",
813      "ecmascript/dfx/hprof/heap_snapshot.cpp",
814      "ecmascript/dfx/hprof/heap_snapshot_json_serializer.cpp",
815      "ecmascript/dfx/hprof/heap_tracker.cpp",
816      "ecmascript/dfx/hprof/string_hashmap.cpp",
817      "ecmascript/dfx/stackinfo/js_stackgetter.cpp",
818      "ecmascript/base/block_hook_scope.cpp",
819    ]
820  }
821}
822
823ecma_profiler_source += [
824  "ecmascript/snapshot/mem/snapshot.cpp",
825  "ecmascript/snapshot/mem/snapshot_env.cpp",
826  "ecmascript/snapshot/mem/snapshot_processor.cpp",
827]
828
829ecma_platform_source = []
830
831ecma_platform_source += [ "ecmascript/platform/common/map.cpp" ]
832
833config("include_llvm") {
834  if (compile_llvm_online) {
835    include_dirs = [
836      "//third_party/third_party_llvm-project/build/include",
837      "//third_party/third_party_llvm-project/llvm/include/",
838    ]
839  } else {
840    if (is_mingw) {
841      include_dirs = [
842        "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_windows/llvm/include",
843        "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_windows/build/include",
844      ]
845    } else if (is_mac || is_ios) {
846      if (host_cpu == "arm64") {
847        include_dirs = [
848          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_arm64/llvm/include",
849          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_arm64/build/include",
850        ]
851      } else {
852        include_dirs = [
853          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_x64/llvm/include",
854          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_x64/build/include",
855        ]
856      }
857    } else {
858      if (current_cpu == "arm64") {
859        include_dirs = [
860          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_aarch64/llvm/include",
861          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_aarch64/build/include",
862        ]
863      } else {
864        include_dirs = [
865          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/llvm/include",
866          "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/include",
867        ]
868      }
869    }
870  }
871}
872
873if (is_mingw) {
874  ecma_platform_source += [
875    "ecmascript/platform/windows/backtrace.cpp",
876    "ecmascript/platform/windows/map.cpp",
877    "ecmascript/platform/windows/file.cpp",
878    "ecmascript/platform/windows/os.cpp",
879    "ecmascript/platform/windows/time.cpp",
880  ]
881} else {
882  ecma_platform_source += [
883    "ecmascript/platform/unix/file.cpp",
884    "ecmascript/platform/unix/map.cpp",
885    "ecmascript/platform/unix/time.cpp",
886  ]
887  if (is_mac || target_os == "ios") {
888    ecma_platform_source += [
889      "ecmascript/platform/unix/mac/os.cpp",
890      "ecmascript/platform/unix/mac/backtrace.cpp",
891    ]
892  } else if (is_ohos || target_os == "android") {
893    ecma_platform_source += [
894      "ecmascript/platform/unix/linux/os.cpp",
895      "ecmascript/platform/unix/ohos/backtrace.cpp",
896    ]
897  } else if (is_linux) {
898    ecma_platform_source += [
899      "ecmascript/platform/unix/linux/os.cpp",
900      "ecmascript/platform/unix/linux/backtrace.cpp",
901    ]
902  } else {
903    print("Invalid os!")
904    assert(false)
905  }
906}
907
908if (enable_target_compilation) {
909  ecma_platform_source += [ "ecmascript/platform/unix/ohos/directory.cpp" ]
910} else if (is_mingw) {
911  ecma_platform_source += [ "ecmascript/platform/windows/directory.cpp" ]
912} else {
913  ecma_platform_source += [ "ecmascript/platform/unix/directory.cpp" ]
914}
915
916ohos_source_set("libark_jsruntime_set") {
917  stack_protector_ret = false
918  if (is_ohos && is_standard_system) {
919    stub_an_file_path = "/system/lib64/${arkcompiler_relative_lib_path}/stub.an"
920  } else {
921    stub_an_file_path =
922        rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an")
923  }
924  defines = [ "STUB_AN_FILE=\"${stub_an_file_path}\"" ]
925  target_builtins_dts_path =
926      "/system/lib64/${arkcompiler_relative_lib_path}/lib_ark_builtins.d.abc"
927  defines += [ "TARGET_BUILTINS_DTS_PATH=\"${target_builtins_dts_path}\"" ]
928
929  sources = ecma_source
930  sources += ecma_profiler_source
931  sources += ecma_debugger_source
932  sources += hitrace_scope_source
933  sources += ecma_platform_source
934
935  public_configs = [ "$js_root:ark_jsruntime_public_config" ]
936  public_configs += [ ":include_llvm" ]
937
938  configs = [
939    "$js_root:ark_jsruntime_common_config",
940    "$js_root:asm_interp_enable_config",
941  ]
942
943  cflags_cc = []
944  if (is_standard_system || target_os == "android" || target_os == "ios") {
945    cflags_cc += [ "-fvisibility=hidden" ]
946  }
947
948  external_deps = []
949  deps = []
950  if (!is_cross_platform_build) {
951    external_deps += [ "runtime_core:arkfile_header_deps" ]
952  } else {
953    deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
954  }
955
956  if (enable_target_compilation) {
957    external_deps += [ "c_utils:utils" ]
958  }
959
960  # hiviewdfx libraries
961  external_deps += hiviewdfx_ext_deps
962  deps += hiviewdfx_deps
963
964  if (ark_standalone_build || target_os == "ios") {
965    deps += [ "$ark_third_party_root/zlib:libz" ]
966  } else {
967    deps += [ "$ark_third_party_root/zlib:shared_libz" ]
968  }
969
970  part_name = "ets_runtime"
971  subsystem_name = "arkcompiler"
972}
973
974ohos_source_set("libark_js_intl_set") {
975  stack_protector_ret = false
976  sources = intl_sources
977
978  public_configs = [ "$js_root:ark_jsruntime_public_config" ]
979
980  configs = [ "$js_root:ark_jsruntime_common_config" ]
981
982  cflags_cc = []
983  if (is_standard_system || target_os == "android" || target_os == "ios") {
984    cflags_cc += [ "-fvisibility=hidden" ]
985  }
986
987  external_deps = []
988  deps = []
989  if (!is_cross_platform_build) {
990    external_deps += [ "runtime_core:arkfile_header_deps" ]
991  } else {
992    deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
993  }
994
995  # hiviewdfx libraries
996  external_deps += hiviewdfx_ext_deps
997  deps += hiviewdfx_deps
998
999  part_name = "ets_runtime"
1000  subsystem_name = "arkcompiler"
1001}
1002
1003config("ark_jsruntime_test_nolto") {
1004  cflags_cc = [ "-fno-lto" ]
1005}
1006
1007ohos_source_set("libark_jsruntime_test_set") {
1008  stack_protector_ret = false
1009  sources = ecma_source
1010  sources += intl_sources
1011  sources += ecma_profiler_source
1012  sources += ecma_debugger_source
1013  sources += hitrace_scope_source
1014  sources += ecma_platform_source
1015
1016  defines = [ "OHOS_UNIT_TEST" ]
1017  if (is_ohos && is_standard_system) {
1018    stub_an_file_path = "/system/lib64/${arkcompiler_relative_lib_path}/stub.an"
1019  } else {
1020    stub_an_file_path =
1021        rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an")
1022  }
1023  defines += [ "STUB_AN_FILE=\"${stub_an_file_path}\"" ]
1024  target_builtins_dts_path =
1025      "/system/lib64/${arkcompiler_relative_lib_path}/lib_ark_builtins.d.abc"
1026  defines += [ "TARGET_BUILTINS_DTS_PATH=\"${target_builtins_dts_path}\"" ]
1027
1028  deps = [
1029    "$ark_third_party_root/icu/icu4c:shared_icui18n",
1030    "$ark_third_party_root/icu/icu4c:shared_icuuc",
1031  ]
1032  external_deps = []
1033  if (!is_cross_platform_build) {
1034    external_deps += [ "runtime_core:arkfile_header_deps" ]
1035  } else {
1036    deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
1037  }
1038
1039  if (enable_coverage) {
1040    ldflags = [ "--coverage" ]
1041    cflags_cc = [ "--coverage" ]
1042  }
1043
1044  if ((current_cpu == "amd64" || current_cpu == "x64" ||
1045       current_cpu == "x86_64" || current_cpu == "arm64") && !is_mingw &&
1046      !is_mac && target_os != "ios") {
1047    deps += [ "ecmascript/compiler:libark_stub_set" ]
1048  } else {
1049    deps += [ "$js_root/ecmascript/compiler:libark_mock_stub_set" ]
1050  }
1051
1052  if (enable_leak_check || is_asan) {
1053    defines += [ "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK" ]
1054  }
1055
1056  public_configs = [ "$js_root:ark_jsruntime_public_config" ]
1057  public_configs += [ ":include_llvm" ]
1058
1059  configs = [
1060    "$js_root:ark_jsruntime_common_config",
1061    "$js_root:asm_interp_enable_config",
1062    "$js_root:icu_path_test_config",
1063    "$js_root:ark_jsruntime_test_nolto",
1064  ]
1065
1066  if (enable_target_compilation) {
1067    external_deps += [ "c_utils:utils" ]
1068  }
1069
1070  # hiviewdfx libraries
1071  external_deps += hiviewdfx_ext_deps
1072  deps += hiviewdfx_deps
1073  part_name = "ets_runtime"
1074  subsystem_name = "arkcompiler"
1075}
1076
1077ohos_source_set("libark_jsruntime_static") {
1078  stack_protector_ret = false
1079  deps = [
1080    ":libark_js_intl_set",
1081    ":libark_jsruntime_set",
1082  ]
1083  external_deps = []
1084  if (!is_cross_platform_build) {
1085    external_deps += [ "runtime_core:arkfile_header_deps" ]
1086  } else {
1087    deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
1088  }
1089
1090  public_configs = [ "$js_root:ark_jsruntime_public_config" ]
1091
1092  if ((current_cpu == "amd64" || current_cpu == "x64" ||
1093       current_cpu == "x86_64" || current_cpu == "arm64") && !is_mingw &&
1094      !is_mac && target_os != "ios") {
1095    deps += [ "ecmascript/compiler:libark_stub_set" ]
1096  } else {
1097    deps += [ "$js_root/ecmascript/compiler:libark_mock_stub_set" ]
1098  }
1099
1100  part_name = "ets_runtime"
1101  subsystem_name = "arkcompiler"
1102}
1103
1104ohos_shared_library("libark_jsruntime") {
1105  stack_protector_ret = false
1106  deps = [
1107    ":libark_jsruntime_static",
1108    sdk_libc_secshared_dep,
1109  ]
1110  external_deps = []
1111  if (!is_cross_platform_build) {
1112    external_deps += [ "runtime_core:libarkfile_static" ]
1113  } else {
1114    deps += [ "$ark_root/libpandafile:libarkfile_static" ]
1115  }
1116
1117  public_configs = [ "$js_root:ark_jsruntime_public_config" ]
1118
1119  if (is_ohos && is_standard_system && !is_debug) {
1120    version_script = "libark_jsruntime.map"
1121  }
1122
1123  # hiviewdfx libraries
1124  external_deps += hiviewdfx_ext_deps
1125  deps += hiviewdfx_deps
1126
1127  if (!enable_ark_intl) {
1128    external_deps += [ "i18n:intl_util" ]
1129  }
1130
1131  install_enable = true
1132
1133  if (!is_mingw && !is_mac) {
1134    output_extension = "so"
1135  }
1136  if (!is_standard_system) {
1137    relative_install_dir = "ark"
1138  }
1139
1140  if (target_os == "android" && !ark_standalone_build) {
1141    libs = [ "log" ]
1142    version_script = "libark_jsruntime.map"
1143  }
1144  if (target_os == "ios" || ark_standalone_build) {
1145    deps += [
1146      "$ark_third_party_root/icu/icu4c:static_icui18n",
1147      "$ark_third_party_root/icu/icu4c:static_icuuc",
1148    ]
1149  } else {
1150    deps += [
1151      "$ark_third_party_root/icu/icu4c:shared_icui18n",
1152      "$ark_third_party_root/icu/icu4c:shared_icuuc",
1153    ]
1154  }
1155  innerapi_tags = [ "platformsdk_indirect" ]
1156  part_name = "ets_runtime"
1157  subsystem_name = "arkcompiler"
1158}
1159
1160ohos_shared_library("libark_jsruntime_test") {
1161  stack_protector_ret = false
1162  deps = [
1163    ":libark_jsruntime_test_set",
1164    "$ark_root/libpandafile:libarkfile_static",
1165  ]
1166
1167  public_configs = [ "$js_root:ark_jsruntime_public_config" ]
1168  public_configs += [ ":include_llvm" ]
1169
1170  ldflags = []
1171  if (enable_coverage) {
1172    ldflags += [ "--coverage" ]
1173    cflags_cc = [ "--coverage" ]
1174  }
1175  if (!ark_standalone_build) {
1176    ldflags += [ "-Wl,--lto-O0" ]
1177  }
1178
1179  install_enable = false
1180  if (!is_mingw && !is_mac) {
1181    output_extension = "so"
1182  }
1183  subsystem_name = "test"
1184}
1185