59 Star 126 Fork 1.5K

OpenHarmony/build

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
prebuilts_config.py 3.35 KB
一键复制 编辑 原始数据 按行查看 历史
Mr.zhao 提交于 2025-05-30 16:51 +08:00 . 支持按部件配置所需下载工具
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2025 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 os
import argparse
import ssl
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "prebuilts_service"))
from prebuilts_service.operater import OperateHanlder
from prebuilts_service.pool_downloader import PoolDownloader
from prebuilts_service.config_parser import ConfigParser
import json
from prebuilts_service.common_utils import get_code_dir
global_args = None
def _parse_args():
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('--disable-rich', action='store_true', help='disable the rich module')
parser.add_argument('--enable-symlink', action='store_true', help='enable symlink while copying node_modules')
parser.add_argument('--build-arkuix', action='store_true', help='build ArkUI-X SDK')
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)
parser.add_argument('--glibc-version', help='glibc version', required=False)
parser.add_argument('--config-file', help='prebuilts download config file')
parser.add_argument('--type', help='prebuilts download type', default="indep")
parser.add_argument('--part-names', help='current building part', default=None, nargs='+')
return parser
def main():
parser = _parse_args()
global global_args
global_args = parser.parse_args()
if global_args.skip_ssl:
global_args._create_default_https_context = ssl._create_unverified_context
global_args.code_dir = get_code_dir()
config_file = os.path.join(global_args.code_dir,"build", "prebuilts_config.json")
if global_args.config_file:
config_file = global_args.config_file
config_parser = ConfigParser(config_file, global_args)
download_operate, other_operate = config_parser.get_operate(global_args.part_names)
prebuilts_path = os.path.join(global_args.code_dir, "prebuilts")
if not os.path.exists(prebuilts_path):
os.makedirs(prebuilts_path)
# 使用线程池下载
pool_downloader = PoolDownloader(download_operate, global_args)
unchanged = pool_downloader.start()
OperateHanlder.run(other_operate, global_args, unchanged)
if __name__ == "__main__":
sys.exit(main())
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/build.git
git@gitee.com:openharmony/build.git
openharmony
build
build
master

搜索帮助