• 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("//foundation/ace/ace_engine/ace_config.gni")
15
16source_set("ace_resource") {
17  include_dirs = [ "//utils/native/base/include" ]
18
19  # add resource file here
20  sources = [
21    "ace_res_config.cpp",
22    "ace_res_key_parser.cpp",
23    "data_provider_manager.cpp",
24    "internal_resource.cpp",
25    "shared_image_manager.cpp",
26  ]
27  if (current_os == "mac" || current_os == "mingw") {
28    deps = [ ":binary_resource_mac_and_windows" ]
29    sources -= [ "internal_resource.cpp" ]
30    sources += [ "internal_resource_previewer.cpp" ]
31  } else {
32    deps = [ ":binary_resource" ]
33  }
34  configs += [ "$ace_root:ace_config" ]
35
36  if (current_os == "mingw") {
37    cflags = [ "-std=c++17" ]
38  }
39}
40
41source_set("binary_resource") {
42  deps = [ ":objcopy_resource" ]
43  ace_resource_dir =
44      get_label_info(":binary_resource($current_toolchain)", "target_out_dir")
45  sources = [
46    "$ace_resource_dir/close.o",
47    "$ace_resource_dir/container_modal_window_close.o",
48    "$ace_resource_dir/container_modal_window_maximize.o",
49    "$ace_resource_dir/container_modal_window_minimize.o",
50    "$ace_resource_dir/container_modal_window_recover.o",
51    "$ace_resource_dir/container_modal_window_split_left.o",
52    "$ace_resource_dir/correct.o",
53    "$ace_resource_dir/down_arrow.o",
54    "$ace_resource_dir/entry.o",
55    "$ace_resource_dir/errorcode.o",
56    "$ace_resource_dir/exit_full_screen.o",
57    "$ace_resource_dir/fa_black_clock_widget_hour.o",
58    "$ace_resource_dir/fa_black_clock_widget_minute.o",
59    "$ace_resource_dir/fa_black_clock_widget_second.o",
60    "$ace_resource_dir/fa_clock_widget_hour.o",
61    "$ace_resource_dir/fa_clock_widget_minute.o",
62    "$ace_resource_dir/fa_clock_widget_second.o",
63    "$ace_resource_dir/full_screen.o",
64    "$ace_resource_dir/hide_password.o",
65    "$ace_resource_dir/ic_back.o",
66    "$ace_resource_dir/ic_more.o",
67    "$ace_resource_dir/ic_more_dark.o",
68    "$ace_resource_dir/ic_more_transparent.o",
69    "$ace_resource_dir/ic_public_drawer.o",
70    "$ace_resource_dir/indexer_arrow.o",
71    "$ace_resource_dir/indexletter_bar.o",
72    "$ace_resource_dir/left_arrow.o",
73    "$ace_resource_dir/pause.o",
74    "$ace_resource_dir/piece_delete.o",
75    "$ace_resource_dir/play.o",
76    "$ace_resource_dir/rate_star_big_off.o",
77    "$ace_resource_dir/rate_star_big_on.o",
78    "$ace_resource_dir/rate_star_small_off.o",
79    "$ace_resource_dir/rate_star_small_on.o",
80    "$ace_resource_dir/right_arrow.o",
81    "$ace_resource_dir/search.o",
82    "$ace_resource_dir/select_arrow_disabled.o",
83    "$ace_resource_dir/select_arrow_normal.o",
84    "$ace_resource_dir/semi_modal_bar_down.o",
85    "$ace_resource_dir/semi_modal_bar_middle.o",
86    "$ace_resource_dir/share.o",
87    "$ace_resource_dir/show_password.o",
88    "$ace_resource_dir/stepper_back_arrow.o",
89    "$ace_resource_dir/stepper_next_arrow.o",
90    "$ace_resource_dir/translate_c2e.o",
91    "$ace_resource_dir/tv_rate_star_big_off.o",
92    "$ace_resource_dir/tv_rate_star_big_on.o",
93    "$ace_resource_dir/tv_rate_star_small_off.o",
94    "$ace_resource_dir/tv_rate_star_small_on.o",
95    "$ace_resource_dir/up_arrow.o",
96    "$ace_resource_dir/watch_down_arrow.o",
97    "$ace_resource_dir/watch_up_arrow.o",
98    "$ace_resource_dir/wrong.o",
99  ]
100}
101
102source_set("binary_resource_mac_and_windows") {
103  deps = [ ":objcopy_resource_mac_and_windows" ]
104  ace_resource_dir =
105      get_label_info(":binary_resource($current_toolchain)", "target_out_dir")
106  sources = [
107    "$ace_resource_dir/close.c",
108    "$ace_resource_dir/container_modal_window_close.c",
109    "$ace_resource_dir/container_modal_window_maximize.c",
110    "$ace_resource_dir/container_modal_window_minimize.c",
111    "$ace_resource_dir/container_modal_window_recover.c",
112    "$ace_resource_dir/container_modal_window_split_left.c",
113    "$ace_resource_dir/correct.c",
114    "$ace_resource_dir/down_arrow.c",
115    "$ace_resource_dir/entry.c",
116    "$ace_resource_dir/errorcode.c",
117    "$ace_resource_dir/exit_full_screen.c",
118    "$ace_resource_dir/fa_black_clock_widget_hour.c",
119    "$ace_resource_dir/fa_black_clock_widget_minute.c",
120    "$ace_resource_dir/fa_black_clock_widget_second.c",
121    "$ace_resource_dir/fa_clock_widget_hour.c",
122    "$ace_resource_dir/fa_clock_widget_minute.c",
123    "$ace_resource_dir/fa_clock_widget_second.c",
124    "$ace_resource_dir/full_screen.c",
125    "$ace_resource_dir/hide_password.c",
126    "$ace_resource_dir/ic_back.c",
127    "$ace_resource_dir/ic_more.c",
128    "$ace_resource_dir/ic_more_dark.c",
129    "$ace_resource_dir/ic_more_transparent.c",
130    "$ace_resource_dir/ic_public_drawer.c",
131    "$ace_resource_dir/indexer_arrow.c",
132    "$ace_resource_dir/indexletter_bar.c",
133    "$ace_resource_dir/left_arrow.c",
134    "$ace_resource_dir/pause.c",
135    "$ace_resource_dir/piece_delete.c",
136    "$ace_resource_dir/play.c",
137    "$ace_resource_dir/rate_star_big_off.c",
138    "$ace_resource_dir/rate_star_big_on.c",
139    "$ace_resource_dir/rate_star_small_off.c",
140    "$ace_resource_dir/rate_star_small_on.c",
141    "$ace_resource_dir/right_arrow.c",
142    "$ace_resource_dir/search.c",
143    "$ace_resource_dir/select_arrow_disabled.c",
144    "$ace_resource_dir/select_arrow_normal.c",
145    "$ace_resource_dir/semi_modal_bar_down.c",
146    "$ace_resource_dir/semi_modal_bar_middle.c",
147    "$ace_resource_dir/share.c",
148    "$ace_resource_dir/show_password.c",
149    "$ace_resource_dir/stepper_back_arrow.c",
150    "$ace_resource_dir/stepper_next_arrow.c",
151    "$ace_resource_dir/translate_c2e.c",
152    "$ace_resource_dir/tv_rate_star_big_off.c",
153    "$ace_resource_dir/tv_rate_star_big_on.c",
154    "$ace_resource_dir/tv_rate_star_small_off.c",
155    "$ace_resource_dir/tv_rate_star_small_on.c",
156    "$ace_resource_dir/up_arrow.c",
157    "$ace_resource_dir/watch_down_arrow.c",
158    "$ace_resource_dir/watch_up_arrow.c",
159    "$ace_resource_dir/wrong.c",
160  ]
161}
162
163action_foreach("objcopy_resource") {
164  # add resource file here
165  sources = [
166    "binary/close.svg",
167    "binary/container_modal_window_close.svg",
168    "binary/container_modal_window_maximize.svg",
169    "binary/container_modal_window_minimize.svg",
170    "binary/container_modal_window_recover.svg",
171    "binary/container_modal_window_split_left.svg",
172    "binary/correct.svg",
173    "binary/down_arrow.svg",
174    "binary/exit_full_screen.svg",
175    "binary/fa_black_clock_widget_hour.png",
176    "binary/fa_black_clock_widget_minute.png",
177    "binary/fa_black_clock_widget_second.png",
178    "binary/fa_clock_widget_hour.png",
179    "binary/fa_clock_widget_minute.png",
180    "binary/fa_clock_widget_second.png",
181    "binary/full_screen.svg",
182    "binary/hide_password.svg",
183    "binary/i18n/entry.json",
184    "binary/i18n/errorcode.json",
185    "binary/ic_back.svg",
186    "binary/ic_more.svg",
187    "binary/ic_more_dark.svg",
188    "binary/ic_more_transparent.svg",
189    "binary/ic_public_drawer.svg",
190    "binary/indexer_arrow.png",
191    "binary/indexletter_bar.json",
192    "binary/left_arrow.svg",
193    "binary/pause.svg",
194    "binary/piece_delete.svg",
195    "binary/play.svg",
196    "binary/rate_star_big_off.svg",
197    "binary/rate_star_big_on.svg",
198    "binary/rate_star_small_off.svg",
199    "binary/rate_star_small_on.svg",
200    "binary/right_arrow.svg",
201    "binary/search.svg",
202    "binary/select_arrow_disabled.png",
203    "binary/select_arrow_normal.png",
204    "binary/semi_modal_bar_down.svg",
205    "binary/semi_modal_bar_middle.svg",
206    "binary/share.svg",
207    "binary/show_password.svg",
208    "binary/stepper_back_arrow.svg",
209    "binary/stepper_next_arrow.svg",
210    "binary/translate_c2e.svg",
211    "binary/tv_rate_star_big_off.svg",
212    "binary/tv_rate_star_big_on.svg",
213    "binary/tv_rate_star_small_off.svg",
214    "binary/tv_rate_star_small_on.svg",
215    "binary/up_arrow.svg",
216    "binary/watch_down_arrow.svg",
217    "binary/watch_up_arrow.svg",
218    "binary/wrong.svg",
219  ]
220
221  ace_resource_dir =
222      get_label_info(":binary_resource($current_toolchain)", "target_out_dir")
223
224  outputs = [ "$ace_resource_dir/{{source_name_part}}.o" ]
225
226  objcopy_tool = objcopy_default
227  script = "$flutter_root/engine/flutter/sky/tools/objcopy.py"
228  if (target_cpu == "x86_64") {
229    objcopy_tool = objcopy_x86_64
230  }
231
232  args = [
233    "--objcopy",
234    rebase_path("$objcopy_tool"),
235    "--input",
236    "{{source}}",
237    "--output",
238    rebase_path("$ace_resource_dir/") + "{{source_name_part}}.o",
239    "--arch",
240    current_cpu,
241  ]
242}
243
244action_foreach("objcopy_resource_mac_and_windows") {
245  # add resource file here
246  sources = [
247    "binary/close.svg",
248    "binary/container_modal_window_close.svg",
249    "binary/container_modal_window_maximize.svg",
250    "binary/container_modal_window_minimize.svg",
251    "binary/container_modal_window_recover.svg",
252    "binary/container_modal_window_split_left.svg",
253    "binary/correct.svg",
254    "binary/down_arrow.svg",
255    "binary/exit_full_screen.svg",
256    "binary/fa_black_clock_widget_hour.png",
257    "binary/fa_black_clock_widget_minute.png",
258    "binary/fa_black_clock_widget_second.png",
259    "binary/fa_clock_widget_hour.png",
260    "binary/fa_clock_widget_minute.png",
261    "binary/fa_clock_widget_second.png",
262    "binary/full_screen.svg",
263    "binary/hide_password.svg",
264    "binary/i18n/entry.json",
265    "binary/i18n/errorcode.json",
266    "binary/ic_back.svg",
267    "binary/ic_more.svg",
268    "binary/ic_more_dark.svg",
269    "binary/ic_more_transparent.svg",
270    "binary/ic_public_drawer.svg",
271    "binary/indexer_arrow.png",
272    "binary/indexletter_bar.json",
273    "binary/left_arrow.svg",
274    "binary/pause.svg",
275    "binary/piece_delete.svg",
276    "binary/play.svg",
277    "binary/rate_star_big_off.svg",
278    "binary/rate_star_big_on.svg",
279    "binary/rate_star_small_off.svg",
280    "binary/rate_star_small_on.svg",
281    "binary/right_arrow.svg",
282    "binary/search.svg",
283    "binary/select_arrow_disabled.png",
284    "binary/select_arrow_normal.png",
285    "binary/semi_modal_bar_down.svg",
286    "binary/semi_modal_bar_middle.svg",
287    "binary/share.svg",
288    "binary/show_password.svg",
289    "binary/stepper_back_arrow.svg",
290    "binary/stepper_next_arrow.svg",
291    "binary/translate_c2e.svg",
292    "binary/tv_rate_star_big_off.svg",
293    "binary/tv_rate_star_big_on.svg",
294    "binary/tv_rate_star_small_off.svg",
295    "binary/tv_rate_star_small_on.svg",
296    "binary/up_arrow.svg",
297    "binary/watch_down_arrow.svg",
298    "binary/watch_up_arrow.svg",
299    "binary/wrong.svg",
300  ]
301
302  ace_resource_dir =
303      get_label_info(":binary_resource($current_toolchain)", "target_out_dir")
304
305  outputs = [ "$ace_resource_dir/{{source_name_part}}.c" ]
306
307  script = "$ace_root/build/tools/build_resource_to_bytecode.py"
308  out_target = rebase_path("$ace_resource_dir/") + "{{source_name_part}}.c"
309
310  args = [
311    "--input",
312    "{{source}}",
313    "--output",
314    out_target,
315  ]
316}
317