• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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
14ide_previewer_path = "//ide/tools/previewer"
15googletest_path = "//third_party/googletest"
16secodefuzz_path = "//Secodefuzz"
17secodepits_path = "//Secodepits"
18
19secodefuzz_deps = "$secodefuzz_path:secodefuzz"
20secodepits_deps = "$secodepits_path:secodepits"
21googletest_deps = "$googletest_path:gmock_main"
22googletest_include_path = "$googletest_path/include"
23
24ace_engine_path = "//foundation/arkui/ace_engine"
25ace_engine_include_path = [
26  "$ace_engine_path",
27  "$ace_engine_path/adapter/preview/entrance",
28  "$ace_engine_path/frameworks",
29  "$ace_engine_path/frameworks/base/utils",
30  "$ace_engine_path/frameworks/core/event",
31  "$ace_engine_path/engine",
32  "$ace_engine_path/engine/flutter/shell/platform/common/cpp/public",
33  "$ace_engine_path/engine/ace_adapter/flutter/shell/platform/glfw/public",
34  "$ace_engine_path/frameworks/core/common",
35  "$ace_engine_path/frameworks/core/common/clipboard",
36  "$ace_engine_path/adapter/preview/entrance/clipboard",
37  "$ace_engine_path/interfaces/inner_api/ace",
38]
39ability_runtime_path = "//foundation/ability/ability_runtime"
40ability_runtime_include_path = [
41  "$ability_runtime_path/frameworks/simulator/common/include",
42  "$ability_runtime_path/frameworks/simulator/ability_simulator/include",
43]
44window_manager_path = "//foundation/window/window_manager"
45window_manager_include_path = [
46  "$window_manager_path/previewer/include",
47  "$window_manager_path/previewer/mock",
48  "$window_manager_path/utils/include",
49]
50graphic_2d_path = "//foundation/graphic/graphic_2d"
51graphic_2d_include_path = [
52  "$graphic_2d_path/rosen/modules/glfw_render_context/export",
53  "$graphic_2d_path/rosen/modules/platform/ipc_core",
54  "$graphic_2d_path/rosen/modules/platform/image_native",
55  "$graphic_2d_path/rosen/modules/platform/utils",
56]
57
58template("ide_test") {
59  executable(target_name) {
60    testonly = invoker.testonly
61    subsystem_name = invoker.subsystem_name
62    part_name = invoker.part_name
63    module_out_path = invoker.module_out_path
64    output_name = invoker.output_name
65    print("$subsystem_name-$part_name-$module_out_path-$output_name")
66    defines = invoker.defines
67    sources = invoker.sources
68    include_dirs = invoker.include_dirs
69    include_dirs += [ googletest_include_path ]
70    deps = invoker.deps
71    deps += [
72      googletest_deps,
73      secodefuzz_deps,
74      secodepits_deps,
75    ]
76    libs = invoker.libs
77    libs += [ "pthread" ]
78    cflags = invoker.cflags
79    cflags += [
80      "-std=c++17",
81      "-Wno-deprecated-declarations",
82      "-Wno-reorder",
83      "-Wno-sign-compare",
84      "-Wno-error",
85      "-Wno-warnings",
86      "-Wno-unused-variable",
87      "-fsanitize=address",
88      "-fsanitize=undefined",
89      "-fsanitize-coverage=trace-pc",
90      "-fprofile-arcs",
91      "-ftest-coverage",
92      "-fdump-rtl-expand",
93      "-g",
94      "-O0",
95      "-fno-omit-frame-pointer",
96    ]
97    cflags_cc = invoker.cflags_cc
98    cflags_cc += [
99      "-fsanitize=address",
100      "-fsanitize=undefined",
101      "-fsanitize-coverage=trace-pc",
102      "-fprofile-arcs",
103      "-ftest-coverage",
104      "-fdump-rtl-expand",
105      "-g",
106      "-O0",
107      "-fno-omit-frame-pointer",
108    ]
109    ldflags = invoker.ldflags
110    ldflags += [
111      "-fsanitize=address",
112      "-fsanitize=undefined",
113      "-fsanitize-coverage=trace-pc",
114      "-fprofile-arcs",
115      "-lgcov",
116    ]
117  }
118}
119
120template("ide_fuzztest") {
121  ide_test(target_name) {
122    testonly = invoker.testonly
123    subsystem_name = invoker.subsystem_name
124    part_name = invoker.part_name
125    module_out_path = invoker.module_out_path
126    output_name = invoker.output_name
127    sources = invoker.sources
128    include_dirs = invoker.include_dirs
129    include_dirs += [
130      secodefuzz_path,
131      secodepits_path,
132    ]
133    deps = invoker.deps
134    libs = invoker.libs
135    cflags = invoker.cflags
136    cflags_cc = invoker.cflags_cc
137    ldflags = invoker.ldflags
138    defines = []
139  }
140}
141
142template("ide_unittest") {
143  ide_test(target_name) {
144    testonly = invoker.testonly
145    subsystem_name = invoker.subsystem_name
146    part_name = invoker.part_name
147    module_out_path = invoker.module_out_path
148    output_name = invoker.output_name
149    sources = invoker.sources
150    include_dirs = invoker.include_dirs
151    deps = invoker.deps
152    libs = invoker.libs
153    cflags = invoker.cflags
154    cflags_cc = invoker.cflags_cc
155    ldflags = invoker.ldflags
156    defines = [ "REPLACE_WINDOW_HEADER=1" ]
157  }
158}
159