1# Copyright (C) 2023 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("../../../../../../arkcompiler/ets_frontend/es2panda/es2abc_config.gni") 16import("../../../filemanagement_aafwk.gni") 17 18# compile .js to .abc. 19action("gen_picker_abc") { 20 visibility = [ ":*" ] 21 script = "../../../../../../arkcompiler/ets_frontend/es2panda/scripts/generate_js_bytecode.py" 22 23 args = [ 24 "--src-js", 25 rebase_path("picker.js"), 26 "--dst-file", 27 rebase_path(target_out_dir + "/picker.abc"), 28 "--frontend-tool-path", 29 rebase_path("${es2abc_build_path}"), 30 "--module", 31 ] 32 deps = 33 [ "../../../../../../arkcompiler/ets_frontend/es2panda:es2panda_build" ] 34 inputs = [ "picker.js" ] 35 outputs = [ target_out_dir + "/picker.abc" ] 36} 37 38base_output_path = get_label_info(":picker_js", "target_out_dir") 39picker_obj_path = base_output_path + "/picker.o" 40gen_js_obj("picker_js") { 41 input = "picker.js" 42 output = picker_obj_path 43 dep = ":gen_picker_abc" 44} 45 46abc_output_path = get_label_info(":picker_abc", "target_out_dir") 47picker_abc_obj_path = abc_output_path + "/picker_abc.o" 48gen_js_obj("picker_abc") { 49 input = "$target_out_dir/picker.abc" 50 output = picker_abc_obj_path 51 dep = ":gen_picker_abc" 52} 53 54ohos_shared_library("picker") { 55 branch_protector_ret = "pac_ret" 56 ldflags = [ "-Wl" ] 57 sources = [ "native_module_ohos_picker.cpp" ] 58 59 deps = [ 60 ":picker_abc", 61 ":picker_js", 62 ] 63 64 external_deps = [ 65 "ability_runtime:abilitykit_native", 66 "napi:ace_napi", 67 ] 68 69 sanitize = { 70 integer_overflow = true 71 ubsan = true 72 boundary_sanitize = true 73 cfi = true 74 cfi_cross_dso = true 75 debug = false 76 } 77 78 relative_install_dir = "module/file" 79 subsystem_name = "filemanagement" 80 part_name = "user_file_service" 81} 82