• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) 2024 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15WORK_SPACE=$(cd `dirname $0`; pwd)
16
17OHOS_GLUE_DIR=${WORK_SPACE}/ohos_glue
18INTERFACE_DIR=${WORK_SPACE}/ohos_interface
19
20INTERFACE_INCLUDE_DIR=${INTERFACE_DIR}/include
21INTERFACE_OHOS_GLUE_DIR=${INTERFACE_DIR}/ohos_glue
22
23CLANG_FORMAT_DIR=${WORK_SPACE}/../../../prebuilts/clang/ohos/linux-x86_64/llvm/bin
24
25copy_files() {
26  echo "begin to copy ohos interface files"
27
28  cp ${INTERFACE_INCLUDE_DIR}/ohos_nweb/* ${WORK_SPACE}/ohos_nweb/include
29
30  rm -rf ${WORK_SPACE}/ohos_adapter/interfaces
31  cp -rf ${INTERFACE_INCLUDE_DIR}/ohos_adapter ${WORK_SPACE}/ohos_adapter/interfaces
32}
33
34translate_files() {
35  echo "begin to translate ohos glue code"
36
37  rm -rf ${OHOS_GLUE_DIR}/scripts
38  cp -rf ${INTERFACE_OHOS_GLUE_DIR}/scripts ${OHOS_GLUE_DIR}
39
40  python3 ${OHOS_GLUE_DIR}/scripts/translator.py webview
41}
42
43copy_files
44
45file_list=`find ${OHOS_GLUE_DIR} -type f \( -name "*.h" -o -name "*.cpp" \)`
46for file in $file_list
47do
48  ${CLANG_FORMAT_DIR}/clang-format -style=file -i $file
49done
50
51