mirror of
https://gitee.com/openharmony/arkcompiler_toolchain
synced 2024-11-23 15:40:03 +00:00
!302 Remove ts2panda related content in Standalone build
Merge pull request !302 from 0621
This commit is contained in:
commit
ef0393becf
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@ -90,10 +90,6 @@ def _uncompress(args, src_file, code_dir, unzip_dir, unzip_filename, mark_file_p
|
||||
cmd = 'tar -xvf {} -C {};echo 0 > {}'.format(src_file, dest_dir, mark_file_path)
|
||||
_run_cmd(cmd)
|
||||
|
||||
# npm install
|
||||
if os.path.basename(unzip_dir) == 'nodejs':
|
||||
_npm_install(args, code_dir, unzip_dir, unzip_filename)
|
||||
|
||||
def _copy_url(args, task_id, url, local_file, code_dir, unzip_dir, unzip_filename, mark_file_path):
|
||||
# download files
|
||||
download_buffer_size = 32768
|
||||
@ -131,10 +127,6 @@ def _hwcloud_download(args, config, bin_dir, code_dir):
|
||||
os.makedirs(abs_unzip_dir)
|
||||
if _check_sha256_by_mark(args, huaweicloud_url, code_dir, unzip_dir, unzip_filename):
|
||||
progress.console.log('{}, Sha256 markword check OK.'.format(huaweicloud_url), style='green')
|
||||
if os.path.basename(abs_unzip_dir) == 'nodejs':
|
||||
for node_dir in args.npm_install_config:
|
||||
_run_cmd('rm -rf {}/{}/node_modules/'.format(code_dir, node_dir))
|
||||
_npm_install(args, code_dir, unzip_dir, unzip_filename)
|
||||
else:
|
||||
_run_cmd(''.join(['rm -rf ', code_dir, '/', unzip_dir, '/*.', unzip_filename, '.mark']))
|
||||
_run_cmd(''.join(['rm -rf ', code_dir, '/', unzip_dir, '/', unzip_filename]))
|
||||
@ -156,44 +148,6 @@ def _hwcloud_download(args, config, bin_dir, code_dir):
|
||||
for task in as_completed(tasks):
|
||||
progress.console.log('{}, download and decompress completed'.format(tasks.get(task)), style='green')
|
||||
|
||||
def _npm_install(args, code_dir, unzip_dir, unzip_filename):
|
||||
procs = []
|
||||
skip_ssl_cmd = ''
|
||||
unsafe_perm_cmd = ''
|
||||
os.environ['PATH'] = '{}/{}/{}/bin:{}'.format(code_dir, unzip_dir, unzip_filename, os.environ.get('PATH'))
|
||||
for install_info in args.npm_install_config:
|
||||
full_code_path = os.path.join(code_dir, install_info)
|
||||
full_code_path = os.path.join(install_info)
|
||||
if os.path.exists(full_code_path):
|
||||
npm = '{}/{}/{}/bin/npm'.format(code_dir, unzip_dir, unzip_filename)
|
||||
if args.skip_ssl:
|
||||
skip_ssl_cmd = '{} config set strict-ssl false;'.format(npm)
|
||||
if args.unsafe_perm:
|
||||
unsafe_perm_cmd = '--unsafe-perm;'
|
||||
cmd = 'cd {};{} config set registry {};{}{} cache clean -f;{} install {}'.format(
|
||||
full_code_path, npm, args.npm_registry, skip_ssl_cmd, npm, npm, unsafe_perm_cmd)
|
||||
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
procs.append(proc)
|
||||
else:
|
||||
raise Exception("{} not exist, it shouldn't happen, pls check...".format(full_code_path))
|
||||
for proc in procs:
|
||||
out, err = proc.communicate()
|
||||
if proc.returncode:
|
||||
raise Exception(err.decode())
|
||||
|
||||
def _node_modules_copy(config, code_dir):
|
||||
for config_info in config:
|
||||
src_dir = os.path.join(code_dir, config_info.get('src'))
|
||||
dest_dir = os.path.join(code_dir, config_info.get('dest'))
|
||||
use_symlink = config_info.get('use_symlink')
|
||||
if os.path.exists(os.path.dirname(dest_dir)):
|
||||
shutil.rmtree(os.path.dirname(dest_dir))
|
||||
if use_symlink == 'True':
|
||||
os.makedirs(os.path.dirname(dest_dir))
|
||||
os.symlink(src_dir, dest_dir)
|
||||
else:
|
||||
shutil.copytree(src_dir, dest_dir, symlinks=True)
|
||||
|
||||
def _file_handle(config, code_dir):
|
||||
for config_info in config:
|
||||
src_dir = ''.join([code_dir, config_info.get('src')])
|
||||
@ -221,10 +175,7 @@ def _file_handle(config, code_dir):
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--skip-ssl', action='store_true', help='skip ssl authentication')
|
||||
parser.add_argument('--unsafe-perm', action='store_true', help='add "--unsafe-perm" for npm install')
|
||||
parser.add_argument('--tool-repo', default='https://repo.huaweicloud.com', help='prebuilt file download source')
|
||||
parser.add_argument('--npm-registry', default='https://repo.huaweicloud.com/repository/npm/',
|
||||
help='npm download source')
|
||||
parser.add_argument('--host-cpu', help='host cpu', required=True)
|
||||
parser.add_argument('--host-platform', help='host platform', required=True)
|
||||
args = parser.parse_args()
|
||||
@ -238,16 +189,12 @@ def main():
|
||||
config_file = os.path.join(args.code_dir,
|
||||
'arkcompiler/toolchain/build/prebuilts_download/prebuilts_download_config.json')
|
||||
config_info = read_json_file(config_file)
|
||||
args.npm_install_config = config_info.get('npm_install_path')
|
||||
node_modules_copy_config = config_info.get('node_modules_copy')
|
||||
file_handle_config = config_info.get('file_handle_config')
|
||||
|
||||
args.bin_dir = os.path.join(args.code_dir, config_info.get('prebuilts_download_dir'))
|
||||
if not os.path.exists(args.bin_dir):
|
||||
os.makedirs(args.bin_dir)
|
||||
copy_config = config_info.get(host_platform).get(host_cpu).get('copy_config')
|
||||
node_config = config_info.get(host_platform).get('node_config')
|
||||
copy_config.extend(node_config)
|
||||
if host_platform == 'linux':
|
||||
linux_copy_config = config_info.get(host_platform).get(host_cpu).get('linux_copy_config')
|
||||
copy_config.extend(linux_copy_config)
|
||||
@ -256,7 +203,6 @@ def main():
|
||||
copy_config.extend(darwin_copy_config)
|
||||
_hwcloud_download(args, copy_config, args.bin_dir, args.code_dir)
|
||||
_file_handle(file_handle_config, args.code_dir)
|
||||
_node_modules_copy(node_modules_copy_config, args.code_dir)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@ -14,7 +14,7 @@
|
||||
set -e
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-skip-ssl|--skip-ssl) # wget、npm skip ssl check, which will allow
|
||||
-skip-ssl|--skip-ssl) # wget skip ssl check, which will allow
|
||||
# hacker to get and modify data stream between server and client!
|
||||
SKIP_SSL=YES
|
||||
;;
|
||||
@ -28,13 +28,6 @@ while [ $# -gt 0 ]; do
|
||||
--tool-repo=*)
|
||||
TOOL_REPO="${1#--tool-repo=}"
|
||||
;;
|
||||
--npm-registry)
|
||||
NPM_REGISTRY="$2"
|
||||
shift
|
||||
;;
|
||||
--npm-registry=*)
|
||||
NPM_REGISTRY="${1#--npm-registry=}"
|
||||
;;
|
||||
--trusted-host)
|
||||
TRUSTED_HOST="$2"
|
||||
shift
|
||||
@ -96,12 +89,6 @@ else
|
||||
tool_repo=''
|
||||
fi
|
||||
|
||||
if [ ! -z "$NPM_REGISTRY" ];then
|
||||
npm_registry="--npm-registry $NPM_REGISTRY"
|
||||
else
|
||||
npm_registry=''
|
||||
fi
|
||||
|
||||
if [ ! -z "$TRUSTED_HOST" ];then
|
||||
trusted_host=$TRUSTED_HOST
|
||||
elif [ ! -z "$PYPI_URL" ];then
|
||||
@ -117,12 +104,6 @@ else
|
||||
pypi_url='http://repo.huaweicloud.com/repository/pypi/simple'
|
||||
fi
|
||||
|
||||
if [ $UID -ne 0 ]; then
|
||||
npm_para=''
|
||||
else
|
||||
npm_para='--unsafe-perm'
|
||||
fi
|
||||
|
||||
cpu="--host-cpu $host_cpu"
|
||||
platform="--host-platform $host_platform"
|
||||
|
||||
@ -130,7 +111,7 @@ script_path=$(cd $(dirname $0);pwd)
|
||||
code_dir=$(dirname ${script_path})
|
||||
pip3 install --trusted-host $trusted_host -i $pypi_url rich
|
||||
echo "prebuilts_download start"
|
||||
python3 "arkcompiler/toolchain/build/prebuilts_download/prebuilts_download.py" $wget_ssl_check $tool_repo $npm_registry $help $cpu $platform $npm_para
|
||||
python3 "arkcompiler/toolchain/build/prebuilts_download/prebuilts_download.py" $wget_ssl_check $tool_repo $help $cpu $platform
|
||||
echo "prebuilts_download end"
|
||||
|
||||
echo -e "\n"
|
||||
|
@ -1,35 +1,14 @@
|
||||
{
|
||||
"prebuilts_download_dir": "../openharmony_prebuilts",
|
||||
"npm_install_path": ["arkcompiler/ets_frontend/ts2panda"],
|
||||
"node_modules_copy": [
|
||||
{
|
||||
"src": "arkcompiler/ets_frontend/ts2panda/node_modules",
|
||||
"dest": "prebuilts/build-tools/common/ts2abc/node_modules",
|
||||
"use_symlink": "True"
|
||||
}
|
||||
],
|
||||
"file_handle_config": [
|
||||
{
|
||||
"src": "/prebuilts/clang/ohos/linux-x86_64/clang_linux-x86_64-57fd63-0530_sp2",
|
||||
"dest": "/prebuilts/clang/ohos/linux-x86_64/llvm",
|
||||
"symlink_src": "/lib/clang/15.0.4",
|
||||
"symlink_dest": "/lib/clang/current"
|
||||
},
|
||||
{
|
||||
"src":"/prebuilts/build-tools/common/nodejs",
|
||||
"dest":"/prebuilts/build-tools/common/nodejs",
|
||||
"symlink_src":"/node-v14.21.1-linux-x64",
|
||||
"symlink_dest":"/current"
|
||||
}
|
||||
],
|
||||
"linux": {
|
||||
"node_config": [
|
||||
{
|
||||
"unzip_dir": "prebuilts/build-tools/common/nodejs",
|
||||
"file_path": "/nodejs/v14.21.1/node-v14.21.1-linux-x64.tar.gz",
|
||||
"unzip_filename": "node-v14.21.1-linux-x64"
|
||||
}
|
||||
],
|
||||
"x86_64": {
|
||||
"copy_config": [
|
||||
{
|
||||
|
@ -1,83 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("$build_root/ark.gni")
|
||||
|
||||
config("config_static") {
|
||||
cflags = [
|
||||
"-std=c++17",
|
||||
"-Wno-error=implicit-fallthrough",
|
||||
"-Wno-deprecated-declarations",
|
||||
]
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [ "//third_party/jsoncpp/include" ]
|
||||
}
|
||||
|
||||
config("jsoncpp_config") {
|
||||
cflags = [
|
||||
"-std=c++17",
|
||||
"-Wno-error=implicit-fallthrough",
|
||||
"-Wno-deprecated-declarations",
|
||||
]
|
||||
}
|
||||
|
||||
config("flag_config") {
|
||||
cflags_cc = [ "-fexceptions" ]
|
||||
}
|
||||
|
||||
config("jsoncpp_public_config") {
|
||||
include_dirs = [ "//third_party/jsoncpp/include/" ]
|
||||
}
|
||||
|
||||
ohos_shared_library("jsoncpp") {
|
||||
stack_protector_ret = false
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"//third_party/jsoncpp/src/lib_json/json_reader.cpp",
|
||||
"//third_party/jsoncpp/src/lib_json/json_value.cpp",
|
||||
"//third_party/jsoncpp/src/lib_json/json_writer.cpp",
|
||||
]
|
||||
use_exceptions = true
|
||||
configs = [ ":jsoncpp_config" ]
|
||||
include_dirs = [
|
||||
"//third_party/jsoncpp/include/json/",
|
||||
"//third_party/jsoncpp/include/",
|
||||
]
|
||||
public_configs = [ ":jsoncpp_public_config" ]
|
||||
part_name = "jsoncpp"
|
||||
subsystem_name = "thirdparty"
|
||||
}
|
||||
|
||||
ohos_static_library("jsoncpp_static") {
|
||||
stack_protector_ret = false
|
||||
sources = [
|
||||
"//third_party/jsoncpp/src/lib_json/json_reader.cpp",
|
||||
"//third_party/jsoncpp/src/lib_json/json_value.cpp",
|
||||
"//third_party/jsoncpp/src/lib_json/json_writer.cpp",
|
||||
]
|
||||
use_exceptions = true
|
||||
configs = [ ":config_static" ]
|
||||
public_configs = [ ":jsoncpp_public_config" ]
|
||||
include_dirs = [
|
||||
"//third_party/jsoncpp/include/json/",
|
||||
"//third_party/jsoncpp/include/",
|
||||
]
|
||||
cflags_cc = [
|
||||
"-DJSON_USE_EXCEPTION=0",
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wno-implicit-fallthrough",
|
||||
]
|
||||
part_name = "jsoncpp"
|
||||
subsystem_name = "thirdparty"
|
||||
}
|
Loading…
Reference in New Issue
Block a user