10e98b08fSopenharmony_ci# Copyright (c) 2020 Huawei Device Co., Ltd.
20e98b08fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
30e98b08fSopenharmony_ci# you may not use this file except in compliance with the License.
40e98b08fSopenharmony_ci# You may obtain a copy of the License at
50e98b08fSopenharmony_ci#
60e98b08fSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
70e98b08fSopenharmony_ci#
80e98b08fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
90e98b08fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
100e98b08fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110e98b08fSopenharmony_ci# See the License for the specific language governing permissions and
120e98b08fSopenharmony_ci# limitations under the License.
130e98b08fSopenharmony_ci
140e98b08fSopenharmony_ciimport("//build/lite/config/component/lite_component.gni")
150e98b08fSopenharmony_ci
160e98b08fSopenharmony_cistatic_library("native_file") {
170e98b08fSopenharmony_ci  sources = [ "src/file_impl_hal/file.c" ]
180e98b08fSopenharmony_ci  include_dirs = [
190e98b08fSopenharmony_ci    "//commonlibrary/utils_lite/include",
200e98b08fSopenharmony_ci    "//commonlibrary/utils_lite/hals/file",
210e98b08fSopenharmony_ci  ]
220e98b08fSopenharmony_ci  BOARD_DRIVER_HAL_FILE_PATH =
230e98b08fSopenharmony_ci      rebase_path("${ohos_board_adapter_dir}/hals/utils/file")
240e98b08fSopenharmony_ci  cmd = "if [ -f ${BOARD_DRIVER_HAL_FILE_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
250e98b08fSopenharmony_ci  BOARD_DRIVER_HAL_FILE_PATH_EXISTS =
260e98b08fSopenharmony_ci      exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
270e98b08fSopenharmony_ci  if (BOARD_DRIVER_HAL_FILE_PATH_EXISTS) {
280e98b08fSopenharmony_ci    deps = [ "$ohos_board_adapter_dir/hals/utils/file:hal_file_static" ]
290e98b08fSopenharmony_ci  } else {
300e98b08fSopenharmony_ci    deps = [ "//commonlibrary/utils_lite/hals/file:static_hal_file" ]
310e98b08fSopenharmony_ci  }
320e98b08fSopenharmony_ci}
330e98b08fSopenharmony_ci
340e98b08fSopenharmony_cilite_component("file") {
350e98b08fSopenharmony_ci  features = [ ":native_file" ]
360e98b08fSopenharmony_ci}
37