• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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("//build/ohos.gni")
15import("//foundation/arkui/ace_engine/ace_config.gni")
16
17template("js_pa_engine_qjs") {
18  forward_variables_from(invoker, "*")
19
20  ohos_source_set(target_name) {
21    subsystem_name = ace_engine_subsystem
22    part_name = ace_engine_part
23    defines += invoker.defines
24
25    configs = [ "$ace_root:ace_config" ]
26
27    include_dirs = [
28      "$ability_runtime_inner_api_path/ability_manager/include",
29      "$ability_runtime_path/interfaces/kits/native/ability/native",
30      "$ability_runtime_services_path/common/include",
31      "$ability_runtime_services_path/abilitymgr/include",
32      "$ability_runtime_napi_path/context",
33      "$ability_runtime_napi_path/inner/napi_common",
34      "//foundation/arkui/ace_engine/adapter/ohos/entrance/pa_engine/engine/common",
35    ]
36    deps = [
37      "$ability_runtime_napi_path/inner/napi_common:napi_common",
38      "$ability_runtime_path/frameworks/native/ability/native:abilitykit_native",
39      "$ability_runtime_path/frameworks/native/appkit:appkit_native",
40      "//foundation/arkui/napi:ace_napi",
41      "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk:system_ability_fwk",
42      "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
43    ]
44    external_deps = [
45      "ability_base:want",
46      "ability_base:zuri",
47      "bundle_framework:appexecfwk_base",
48      "bundle_framework:appexecfwk_core",
49      "c_utils:utils",
50      "eventhandler:libeventhandler",
51      "form_fwk:form_manager",
52      "hiviewdfx_hilog_native:libhilog",
53      "ipc:ipc_core",
54      "ipc_js:rpc",
55      "napi:ace_napi",
56      "relational_store:native_dataability",
57      "relational_store:native_rdb",
58      "samgr:samgr_proxy",
59    ]
60
61    public_deps =
62        [ "//base/global/resource_management/frameworks/resmgr:global_resmgr" ]
63
64    sources = [
65      "$ace_root/adapter/ohos/entrance/pa_engine/engine/common/js_backend_timer_module.cpp",
66      "qjs_pa_engine.cpp",
67      "qjs_pa_engine_loader.cpp",
68    ]
69
70    if (target_cpu == "arm64") {
71      defines += [ "_ARM64_" ]
72    } else if (target_cpu == "arm") {
73      defines += [ "_ARM_" ]
74    }
75
76    if (use_js_debug) {
77      deps += [ "//third_party/quickjs:qjs_debugger" ]
78      defines += [ "ENABLE_JS_DEBUG" ]
79      configs += [ "//third_party/quickjs:qjs_debug_config" ]
80    } else {
81      deps += [ "//third_party/quickjs:qjs" ]
82    }
83
84    if (defined(config.use_build_in_js_engine) &&
85        config.use_build_in_js_engine) {
86      defines += [ "BUILT_IN_JS_ENGINE" ]
87    } else {
88      sources += [
89        "$ace_root/frameworks/bridge/js_frontend/engine/quickjs/qjs_group_js_bridge.cpp",
90        "$ace_root/frameworks/bridge/js_frontend/engine/quickjs/qjs_utils.cpp",
91      ]
92    }
93
94    if (use_js_debug) {
95      deps += [ "//foundation/arkui/napi:ace_napi_quickjs_debug" ]
96    } else {
97      deps += [ "//foundation/arkui/napi:ace_napi_quickjs" ]
98    }
99  }
100}
101
102foreach(item, ace_platforms) {
103  platform = item.name
104  engine_config = {
105  }
106  engine_config = item.config
107  support_engines = []
108  support_engines = engine_config.js_engines
109  foreach(engine, support_engines) {
110    if (engine.engine_name == "qjs") {
111      js_pa_engine_qjs("js_pa_engine_bridge_qjs_$platform") {
112        defines = engine.engine_defines
113        use_js_debug = false
114        config = {
115        }
116
117        if (defined(item.config)) {
118          config = item.config
119        }
120        if (defined(config.defines)) {
121          defines += config.defines
122        }
123      }
124
125      js_pa_engine_qjs("js_pa_engine_bridge_qjs_debug_$platform") {
126        defines = engine.engine_defines
127        use_js_debug = true
128        config = {
129        }
130
131        if (defined(item.config)) {
132          config = item.config
133        }
134        if (defined(config.defines)) {
135          defines += config.defines
136        }
137      }
138    }
139  }
140}
141