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("//build/ohos/ace/ace.gni")
16import("../../../../../../arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
17import("../../../filemanagement_aafwk.gni")
18
19# compile .js to .abc.
20action("gen_picker_abc") {
21  visibility = [ ":*" ]
22  script = "../../../../../../arkcompiler/ets_frontend/es2panda/scripts/generate_js_bytecode.py"
23
24  args = [
25    "--src-js",
26    rebase_path("picker.js"),
27    "--dst-file",
28    rebase_path(target_out_dir + "/picker.abc"),
29    "--frontend-tool-path",
30    rebase_path("${es2abc_build_path}"),
31    "--module",
32  ]
33  deps =
34      [ "../../../../../../arkcompiler/ets_frontend/es2panda:es2panda_build" ]
35  inputs = [ "picker.js" ]
36  outputs = [ target_out_dir + "/picker.abc" ]
37}
38
39base_output_path = get_label_info(":picker_js", "target_out_dir")
40picker_obj_path = base_output_path + "/picker.o"
41gen_js_obj("picker_js") {
42  input = "picker.js"
43  output = picker_obj_path
44  dep = ":gen_picker_abc"
45}
46
47abc_output_path = get_label_info(":picker_abc", "target_out_dir")
48picker_abc_obj_path = abc_output_path + "/picker_abc.o"
49gen_js_obj("picker_abc") {
50  input = "$target_out_dir/picker.abc"
51  output = picker_abc_obj_path
52  dep = ":gen_picker_abc"
53}
54
55ohos_shared_library("picker") {
56  branch_protector_ret = "pac_ret"
57  ldflags = [ "-Wl" ]
58
59  include_dirs = [ "include" ]
60
61  sources = [
62    "native_module_ohos_picker.cpp",
63    "src/modal_ui_callback.cpp",
64    "src/picker_n_exporter.cpp",
65    "src/picker_napi_utils.cpp",
66  ]
67
68  deps = [
69    ":picker_abc",
70    ":picker_js",
71  ]
72
73  external_deps = [
74    "ability_base:want",
75    "ability_base:zuri",
76    "ability_runtime:ability_context_native",
77    "ability_runtime:ability_manager",
78    "ability_runtime:abilitykit_native",
79    "ability_runtime:abilitykit_native",
80    "ability_runtime:app_context",
81    "ability_runtime:dataobs_manager",
82    "ability_runtime:napi_base_context",
83    "ability_runtime:runtime",
84    "ability_runtime:service_extension",
85    "ability_runtime:ui_extension",
86    "ace_engine:ace_uicontent",
87    "file_api:filemgmt_libhilog",
88    "file_api:filemgmt_libn",
89    "hilog:libhilog",
90    "napi:ace_napi",
91  ]
92
93  sanitize = {
94    integer_overflow = true
95    ubsan = true
96    boundary_sanitize = true
97    cfi = true
98    cfi_cross_dso = true
99    debug = false
100  }
101
102  relative_install_dir = "module/file"
103  subsystem_name = "filemanagement"
104  part_name = "user_file_service"
105}
106