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("//build/ohos.gni")
15import("//foundation/arkui/ace_engine/ace_config.gni")
16
17# build framework bridge
18template("framework_bridge") {
19  forward_variables_from(invoker, "*")
20
21  ohos_source_set(target_name) {
22    if (current_os == "ohos") {
23      sanitize = {
24        integer_overflow = true
25        boundary_sanitize = true
26        debug = ace_sanitize_debug
27      }
28    }
29    subsystem_name = ace_engine_subsystem
30    part_name = ace_engine_part
31    configs = [ "$ace_root:ace_config" ]
32
33    deps = [
34      "declarative_frontend:declarative_frontend_$platform",
35
36      # bridge source
37      "card_frontend:card_frontend_$platform",
38      "codec:data_codec",
39      "common:bridge_common_$platform",
40      "common/accessibility:bridge_accessibility_$platform",
41      "js_frontend:js_frontend_$platform",
42      "plugin_frontend:plugin_frontend_$platform",
43    ]
44
45    if (defined(config.js_pa_support) && config.js_pa_support) {
46      deps += [ "$ace_root/${config.pa_engine_path}:pa_backend_$platform" ]
47    }
48    if (use_hilog) {
49      external_deps = [ "hilog:libhilog" ]
50    }
51  }
52}
53
54# build ng framework bridge
55template("framework_bridge_ng") {
56  forward_variables_from(invoker, "*")
57
58  ohos_source_set(target_name) {
59    if (current_os == "ohos") {
60      sanitize = {
61        integer_overflow = true
62        boundary_sanitize = true
63        debug = ace_sanitize_debug
64      }
65    }
66    subsystem_name = ace_engine_subsystem
67    part_name = ace_engine_part
68    configs = [ "$ace_root:ace_config" ]
69
70    deps = [
71      "codec:data_codec",
72      "common:bridge_common_ng_$platform",
73      "common/accessibility:bridge_accessibility_$platform",
74      "declarative_frontend:declarative_frontend_$platform",
75    ]
76
77    if (defined(config.js_pa_support) && config.js_pa_support) {
78      deps += [ "$ace_root/${config.pa_engine_path}:pa_backend_$platform" ]
79    }
80    if (use_hilog) {
81      external_deps = [ "hilog:libhilog" ]
82    }
83  }
84}
85
86foreach(item, ace_platforms) {
87  framework_bridge("framework_bridge_" + item.name) {
88    platform = item.name
89    config = {
90    }
91
92    if (defined(item.config)) {
93      config = item.config
94    }
95  }
96
97  framework_bridge_ng("framework_bridge_ng_" + item.name) {
98    platform = item.name
99    config = {
100    }
101
102    if (defined(item.config)) {
103      config = item.config
104    }
105  }
106}
107