未验证 提交 bf350c4f 编写于 作者: O openharmony_ci 提交者: Gitee

!565 skip some post build process

Merge pull request !565 from lubinglun/skip_some_post_build_process
......@@ -118,6 +118,12 @@ def add_options(parser):
default=False,
help='it will skip post build process, '
'you can enable it if you do not need post build')
parser.add_argument('--disable-part-of-post-build',
default=[],
nargs='*',
help='it will skip part of post build process, which includes output_part_rom_status, stat_ccache, generate_ninja_trace, get_warning_list, compute_overlap_rate. '
'you can choose which subprocess to skip by passing in parameters. '
'eg:--disable-part-of-post-build output_part_rom_status --disable-part-of-post-build stat_ccache')
parser.add_argument('--device-type',
help='specifies device type',
default='default')
......@@ -211,6 +217,8 @@ def exec_command(args):
cmd_args['disable_package_image'] = args.disable_package_image
if args.disable_post_build:
cmd_args['disable_post_build'] = args.disable_post_build
if args.disable_part_of_post_build:
cmd_args['disable_part_of_post_build'] = args.disable_part_of_post_build
if hasattr(args, 'device_type') and args.device_type:
cmd_args['device_type'] = args.device_type
if hasattr(args, 'build_variant') and args.build_variant:
......
......@@ -144,6 +144,11 @@ class Build():
if cmd_args is None:
cmd_args = defaultdict(list)
if cmd_args.get('disable_part_of_post_build'):
disable_post_build_args = cmd_args['disable_part_of_post_build']
else:
disable_post_build_args = []
try:
for exec_cmd in cmd_list:
exec_cmd(cmd_args)
......@@ -157,12 +162,13 @@ class Build():
post_build.patch_ohos_para(cmd_args)
if not cmd_args.get('disable_package_image'):
post_build.package_image()
output_part_rom_status(self.config.root_path)
if not disable_post_build_args or 'output_part_rom_status' not in disable_post_build_args:
output_part_rom_status(self.config.root_path)
finally:
if not cmd_args.get('disable_post_build'):
if 'post_build' not in locals():
post_build = PostBuild(self.config)
post_build.clean(self.start_time)
post_build.clean(self.start_time, disable_post_build_args)
hb_info(f'{os.path.basename(self.config.out_path)} build success')
hb_info(f'cost time: {self.build_time}')
......
......@@ -99,11 +99,15 @@ class PostBuild:
self._out_path = config.out_path
self._log_path = config.log_path
def clean(self, start_time):
self.stat_ccache()
self.generate_ninja_trace(start_time)
self.get_warning_list()
self.compute_overlap_rate()
def clean(self, start_time, disable_post_build_args):
if not disable_post_build_args or 'stat_ccache' not in disable_post_build_args:
self.stat_ccache()
if not disable_post_build_args or 'generate_ninja_trace' not in disable_post_build_args:
self.generate_ninja_trace(start_time)
if not disable_post_build_args or 'get_warning_list' not in disable_post_build_args:
self.get_warning_list()
if not disable_post_build_args or 'compute_overlap_rate' not in disable_post_build_args:
self.compute_overlap_rate()
def patch_ohos_para(self, cmd_args):
ohos_para_data = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册