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("//foundation/arkui/ace_engine/ace_config.gni") 15 16source_set("ace_resource") { 17 include_dirs = [ "//third_party/bounds_checking_function/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" || current_os == "ios" || 28 current_os == "linux" || current_os == "android") { 29 deps = [ ":binary_resource_mac_and_windows" ] 30 sources -= [ "internal_resource.cpp" ] 31 sources += [ "internal_resource_previewer.cpp" ] 32 } else { 33 deps = [ ":binary_resource" ] 34 } 35 configs += [ "$ace_root:ace_config" ] 36 37 if (current_os == "mingw") { 38 cflags_cc = [ "-std=c++17" ] 39 } 40} 41 42source_set("binary_resource") { 43 deps = [ ":objcopy_resource" ] 44 ace_resource_dir = 45 get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 46 sources = [ 47 "$ace_resource_dir/entry.o", 48 "$ace_resource_dir/errorcode.o", 49 "$ace_resource_dir/indexletter_bar.o", 50 "$ace_resource_dir/tv_rate_star_big_off.o", 51 "$ace_resource_dir/tv_rate_star_big_on.o", 52 "$ace_resource_dir/tv_rate_star_small_off.o", 53 "$ace_resource_dir/tv_rate_star_small_on.o", 54 ] 55} 56 57source_set("binary_resource_mac_and_windows") { 58 deps = [ ":objcopy_resource_mac_and_windows" ] 59 ace_resource_dir = 60 get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 61 sources = [ 62 "$ace_resource_dir/app_bar_back.c", 63 "$ace_resource_dir/app_bar_fa.c", 64 "$ace_resource_dir/close.c", 65 "$ace_resource_dir/container_modal_window_close.c", 66 "$ace_resource_dir/container_modal_window_defocus_close.c", 67 "$ace_resource_dir/container_modal_window_defocus_maximize.c", 68 "$ace_resource_dir/container_modal_window_defocus_minimize.c", 69 "$ace_resource_dir/container_modal_window_defocus_recover.c", 70 "$ace_resource_dir/container_modal_window_defocus_split_left.c", 71 "$ace_resource_dir/container_modal_window_maximize.c", 72 "$ace_resource_dir/container_modal_window_minimize.c", 73 "$ace_resource_dir/container_modal_window_recover.c", 74 "$ace_resource_dir/container_modal_window_split_left.c", 75 "$ace_resource_dir/correct.c", 76 "$ace_resource_dir/down_arrow.c", 77 "$ace_resource_dir/entry.c", 78 "$ace_resource_dir/errorcode.c", 79 "$ace_resource_dir/exit_full_screen.c", 80 "$ace_resource_dir/fa_black_clock_widget_hour.c", 81 "$ace_resource_dir/fa_black_clock_widget_minute.c", 82 "$ace_resource_dir/fa_black_clock_widget_second.c", 83 "$ace_resource_dir/fa_clock_widget_hour.c", 84 "$ace_resource_dir/fa_clock_widget_minute.c", 85 "$ace_resource_dir/fa_clock_widget_second.c", 86 "$ace_resource_dir/full_screen.c", 87 "$ace_resource_dir/hide_password.c", 88 "$ace_resource_dir/ic_back.c", 89 "$ace_resource_dir/ic_bottomsheet_close.c", 90 "$ace_resource_dir/ic_more.c", 91 "$ace_resource_dir/ic_more_dark.c", 92 "$ace_resource_dir/ic_more_transparent.c", 93 "$ace_resource_dir/ic_public_drawer.c", 94 "$ace_resource_dir/ic_public_input_search.c", 95 "$ace_resource_dir/ic_public_spinner.c", 96 "$ace_resource_dir/indexer_arrow.c", 97 "$ace_resource_dir/indexletter_bar.c", 98 "$ace_resource_dir/left_arrow.c", 99 "$ace_resource_dir/pause.c", 100 "$ace_resource_dir/piece_delete.c", 101 "$ace_resource_dir/play.c", 102 "$ace_resource_dir/rate_star_big_off.c", 103 "$ace_resource_dir/rate_star_big_on.c", 104 "$ace_resource_dir/rate_star_small_off.c", 105 "$ace_resource_dir/rate_star_small_on.c", 106 "$ace_resource_dir/right_arrow.c", 107 "$ace_resource_dir/search.c", 108 "$ace_resource_dir/select_arrow_disabled.c", 109 "$ace_resource_dir/select_arrow_normal.c", 110 "$ace_resource_dir/semi_modal_bar_down.c", 111 "$ace_resource_dir/semi_modal_bar_middle.c", 112 "$ace_resource_dir/share.c", 113 "$ace_resource_dir/show_password.c", 114 "$ace_resource_dir/stepper_back_arrow.c", 115 "$ace_resource_dir/stepper_next_arrow.c", 116 "$ace_resource_dir/translate_c2e.c", 117 "$ace_resource_dir/tv_rate_star_big_off.c", 118 "$ace_resource_dir/tv_rate_star_big_on.c", 119 "$ace_resource_dir/tv_rate_star_small_off.c", 120 "$ace_resource_dir/tv_rate_star_small_on.c", 121 "$ace_resource_dir/up_arrow.c", 122 "$ace_resource_dir/watch_down_arrow.c", 123 "$ace_resource_dir/watch_up_arrow.c", 124 "$ace_resource_dir/wrong.c", 125 ] 126} 127 128action_foreach("objcopy_resource") { 129 # add resource file here 130 sources = [ 131 "binary/i18n/entry.json", 132 "binary/i18n/errorcode.json", 133 "binary/indexletter_bar.json", 134 "binary/tv_rate_star_big_off.svg", 135 "binary/tv_rate_star_big_on.svg", 136 "binary/tv_rate_star_small_off.svg", 137 "binary/tv_rate_star_small_on.svg", 138 ] 139 140 ace_resource_dir = 141 get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 142 143 outputs = [ "$ace_resource_dir/{{source_name_part}}.o" ] 144 145 objcopy_tool = objcopy_default 146 script = "$flutter_root/engine/flutter/sky/tools/objcopy.py" 147 if (target_cpu == "x86_64") { 148 objcopy_tool = objcopy_x86_64 149 } 150 151 args = [ 152 "--objcopy", 153 rebase_path("$objcopy_tool"), 154 "--input", 155 "{{source}}", 156 "--output", 157 rebase_path("$ace_resource_dir/") + "{{source_name_part}}.o", 158 "--arch", 159 current_cpu, 160 ] 161} 162 163action_foreach("objcopy_resource_mac_and_windows") { 164 # add resource file here 165 sources = [ 166 "binary/app_bar_back.svg", 167 "binary/app_bar_fa.svg", 168 "binary/close.svg", 169 "binary/container_modal_window_close.png", 170 "binary/container_modal_window_defocus_close.png", 171 "binary/container_modal_window_defocus_maximize.png", 172 "binary/container_modal_window_defocus_minimize.png", 173 "binary/container_modal_window_defocus_recover.png", 174 "binary/container_modal_window_defocus_split_left.png", 175 "binary/container_modal_window_maximize.png", 176 "binary/container_modal_window_minimize.png", 177 "binary/container_modal_window_recover.png", 178 "binary/container_modal_window_split_left.png", 179 "binary/correct.svg", 180 "binary/down_arrow.svg", 181 "binary/exit_full_screen.svg", 182 "binary/fa_black_clock_widget_hour.png", 183 "binary/fa_black_clock_widget_minute.png", 184 "binary/fa_black_clock_widget_second.png", 185 "binary/fa_clock_widget_hour.png", 186 "binary/fa_clock_widget_minute.png", 187 "binary/fa_clock_widget_second.png", 188 "binary/full_screen.svg", 189 "binary/hide_password.svg", 190 "binary/i18n/entry.json", 191 "binary/i18n/errorcode.json", 192 "binary/ic_back.svg", 193 "binary/ic_bottomsheet_close.svg", 194 "binary/ic_more.svg", 195 "binary/ic_more_dark.svg", 196 "binary/ic_more_transparent.svg", 197 "binary/ic_public_drawer.svg", 198 "binary/ic_public_input_search.svg", 199 "binary/ic_public_spinner.svg", 200 "binary/indexer_arrow.png", 201 "binary/indexletter_bar.json", 202 "binary/left_arrow.svg", 203 "binary/pause.svg", 204 "binary/piece_delete.svg", 205 "binary/play.svg", 206 "binary/rate_star_big_off.svg", 207 "binary/rate_star_big_on.svg", 208 "binary/rate_star_small_off.svg", 209 "binary/rate_star_small_on.svg", 210 "binary/right_arrow.svg", 211 "binary/search.svg", 212 "binary/select_arrow_disabled.png", 213 "binary/select_arrow_normal.png", 214 "binary/semi_modal_bar_down.svg", 215 "binary/semi_modal_bar_middle.svg", 216 "binary/share.svg", 217 "binary/show_password.svg", 218 "binary/stepper_back_arrow.svg", 219 "binary/stepper_next_arrow.svg", 220 "binary/translate_c2e.svg", 221 "binary/tv_rate_star_big_off.svg", 222 "binary/tv_rate_star_big_on.svg", 223 "binary/tv_rate_star_small_off.svg", 224 "binary/tv_rate_star_small_on.svg", 225 "binary/up_arrow.svg", 226 "binary/watch_down_arrow.svg", 227 "binary/watch_up_arrow.svg", 228 "binary/wrong.svg", 229 ] 230 231 ace_resource_dir = 232 get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 233 234 outputs = [ "$ace_resource_dir/{{source_name_part}}.c" ] 235 236 script = "$ace_root/build/tools/build_resource_to_bytecode.py" 237 out_target = rebase_path("$ace_resource_dir/") + "{{source_name_part}}.c" 238 239 args = [ 240 "--input", 241 "{{source}}", 242 "--output", 243 out_target, 244 ] 245} 246