提交 115d7e69 编写于 作者: P pilipala195 提交者: Gitee

ohos-build bugfix

上级 f57a682e
......@@ -20,6 +20,7 @@ from collections import defaultdict
from hb.build.build_process import Build
from hb.set.set import set_product
from hb.common.device import Device
def add_options(parser):
......@@ -57,9 +58,6 @@ def exec_command(args):
build.register_args('ohos_build_type', args.build_type[0])
if len(args.compiler):
build.compiler = args.compiler[0]
if args.test is not None:
build.test = args.test
......@@ -72,6 +70,8 @@ def exec_command(args):
product, company = args.product[0].split('@')
set_product(product_name=product, company=company)
build.compiler = Device.get_compiler(build.config.device_path)
if args.ndk:
build.register_args('ohos_build_ndk', 'true', quota=False)
......
......@@ -17,6 +17,7 @@
#
import os
import sys
from collections import defaultdict
from hb.common.utils import exec_command
......@@ -141,7 +142,7 @@ class Build():
self.config.out_path,
'--root={}'.format(self.config.root_path),
'--dotfile={}/.gn'.format(self.config.build_path),
'--script-executable=python3',
f'--script-executable={sys.executable}',
'--args={}'.format(" ".join(self._args_list))] + gn_args
exec_command(gn_cmd, log_path=self.config.log_path)
......
......@@ -109,3 +109,18 @@ class Device():
if os.path.isdir(path) or os.path.isfile(path):
return
raise Exception('invalid path: {}'.format(path))
@staticmethod
def get_compiler(config_path):
config = os.path.join(config_path, 'config.gni')
if not os.path.isfile(config):
return ''
compiler_pattern = r'board_toolchain_type ?= ?"(\w+)"'
with open(config, 'rt', encoding='utf-8') as config_file:
data = config_file.read()
compiler_list = re.findall(compiler_pattern, data)
if not len(compiler_list):
raise Exception('board_toolchain_type is None'
' in {}'.format(config))
return compiler_list[0]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册