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. 13import("//ark/ts2abc/ts2panda/ts2abc_config.gni") 14import("//build/ohos.gni") 15import("//build/ohos/ace/ace.gni") 16import("//foundation/ace/ace_engine/ace_config.gni") 17 18js_declaration("medialibrary_js") { 19 part_name = "multimedia_media_library_standard" 20 sources = [ "./@ohos.multimedia.mediaLibrary.d.ts" ] 21} 22 23ohos_copy("medialibrary_declaration") { 24 sources = [ "./@ohos.multimedia.mediaLibrary.d.ts" ] 25 outputs = [ target_out_dir + "/$target_name/" ] 26 module_source_dir = target_out_dir + "/$target_name" 27 module_install_name = "" 28} 29 30# compile .js to .abc. 31action("gen_medialibraryinf_abc") { 32 visibility = [ ":*" ] 33 script = "//ark/ts2abc/ts2panda/scripts/generate_js_bytecode.py" 34 35 args = [ 36 "--src-js", 37 rebase_path( 38 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/medialibraryinf.js"), 39 "--dst-file", 40 rebase_path(target_out_dir + "/medialibraryinf.abc"), 41 "--node", 42 rebase_path("${node_path}"), 43 "--frontend-tool-path", 44 rebase_path("${ts2abc_build_path}"), 45 "--node-modules", 46 rebase_path("${node_modules}"), 47 "--module", 48 ] 49 deps = [ "//ark/ts2abc/ts2panda:ark_ts2abc_build" ] 50 51 inputs = [ "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/medialibraryinf.js" ] 52 outputs = [ target_out_dir + "/medialibraryinf.abc" ] 53} 54 55base_output_path = get_label_info(":medialibraryinf_js", "target_out_dir") 56medialibraryinf_obj_path = base_output_path + "/medialibraryinf.o" 57gen_js_obj("medialibraryinf_js") { 58 input = "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/medialibraryinf.js" 59 output = medialibraryinf_obj_path 60 dep = ":gen_medialibraryinf_abc" 61} 62 63abc_output_path = get_label_info(":medialibraryinf_abc", "target_out_dir") 64medialibraryinf_abc_obj_path = abc_output_path + "/medialibraryinf_abc.o" 65gen_js_obj("medialibraryinf_abc") { 66 input = "$target_out_dir/medialibraryinf.abc" 67 output = medialibraryinf_abc_obj_path 68 dep = ":gen_medialibraryinf_abc" 69} 70 71ohos_shared_library("medialibrary") { 72 include_dirs = [ 73 "//drivers/peripheral/display/interfaces/include", 74 "//drivers/peripheral/base", 75 "//foundation/multimedia/media_standard/interfaces/innerkits/native/media/include", 76 "//foundation/multimedia/medialibrary_standard/interfaces/kits/js/medialibrary/include", 77 "//third_party/node/src", 78 "//foundation/ace/napi/interfaces/kits", 79 "//foundation/multimedia/medialibrary_standard/interfaces/innerkits/native/include", 80 "//foundation/multimedia/medialibrary_standard/services/media_library_service/include/client", 81 "//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb/include", 82 "//foundation/aafwk/standard/frameworks/kits/ability/native/include", 83 "//foundation/multimedia/medialibrary_standard/frameworks/innerkitsimpl/medialibrary_data_ability/include", 84 "//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager/include", 85 "//foundation/multimedia/image_standard/interfaces/innerkits/include", 86 "//foundation/multimedia/image_standard/interfaces/kits/js/common/include", 87 "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include", 88 ] 89 90 sources = [ 91 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/album_asset_napi.cpp", 92 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/album_napi.cpp", 93 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/audio_asset_napi.cpp", 94 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/avmetadatahelper_napi.cpp", 95 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/fetch_file_result_napi.cpp", 96 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/file_asset_napi.cpp", 97 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/image_asset_napi.cpp", 98 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/media_asset_napi.cpp", 99 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/media_library_napi.cpp", 100 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/media_scanner_napi.cpp", 101 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/native_module_ohos_medialibrary.cpp", 102 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/smart_album_napi.cpp", 103 "//foundation/multimedia/medialibrary_standard/frameworks/kitsimpl/medialibrary/src/video_asset_napi.cpp", 104 ] 105 if (target_cpu == "arm") { 106 ldflags = [ "-Wl" ] 107 } else if (target_cpu == "arm64") { 108 ldflags = [ "-Wl" ] 109 } 110 111 deps = [ 112 ":medialibraryinf_abc", 113 ":medialibraryinf_js", 114 "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", 115 "//foundation/aafwk/standard/frameworks/kits/appkit:appkit_native", 116 "//foundation/aafwk/standard/interfaces/innerkits/base:base", 117 "//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager:dataobs_manager", 118 "//foundation/aafwk/standard/interfaces/innerkits/want:want", 119 "//foundation/ace/napi:ace_napi", 120 "//foundation/multimedia/image_standard/interfaces/innerkits:image", 121 "//foundation/multimedia/media_standard/interfaces/innerkits/native/media:media_client", 122 "//foundation/multimedia/medialibrary_standard/frameworks/innerkitsimpl/media_library:media_library", 123 "//foundation/multimedia/medialibrary_standard/frameworks/innerkitsimpl/medialibrary_data_ability:medialibrary_data_ability", 124 "//foundation/multimedia/medialibrary_standard/services/media_library_service:medialibrary_proxy", 125 "//foundation/multimedia/medialibrary_standard/services/media_scanner_service/client:media_scanner_client", 126 "//utils/native/base:utils", 127 ] 128 129 external_deps = [ 130 "ability_base:zuri", 131 "ability_runtime:ability_manager", 132 "ability_runtime:napi_base_context", 133 "bytrace_standard:bytrace_core", 134 "hiviewdfx_hilog_native:libhilog", 135 "native_appdatamgr:native_appdatafwk", 136 "native_appdatamgr:native_dataability", 137 "native_appdatamgr:native_rdb", 138 "permission_standard:libpermissionsdk_standard", 139 ] 140 141 relative_install_dir = "module/multimedia" 142 subsystem_name = "multimedia" 143 part_name = "multimedia_media_library_standard" 144} 145