Add flag to clean up temporary results after building iOS Framework or static lib
The --purify flag can now be passed to remove the temporary files and directories created while building the iOS Framework or static library. That way, only the final result(s) are taking up space in the output folder. BUG=None NOTRY=True Review-Url: https://codereview.webrtc.org/2740923003 Cr-Commit-Position: refs/heads/master@{#17224}
This commit is contained in:
committed by
Commit bot
parent
c7daea8d6a
commit
7b188e8fbb
@ -50,6 +50,9 @@ def _ParseArgs():
|
||||
help='Architectures to build. Defaults to %(default)s.')
|
||||
parser.add_argument('-c', '--clean', action='store_true', default=False,
|
||||
help='Removes the previously generated build output, if any.')
|
||||
parser.add_argument('-p', '--purify', action='store_true', default=False,
|
||||
help='Purifies the previously generated build output by '
|
||||
'removing the temporary results used when (re)building.')
|
||||
parser.add_argument('-o', '--output-dir', default=SDK_OUTPUT_DIR,
|
||||
help='Specifies a directory to output the build artifacts to. '
|
||||
'If specified together with -c, deletes the dir.')
|
||||
@ -78,6 +81,15 @@ def _CleanArtifacts(output_dir):
|
||||
shutil.rmtree(output_dir)
|
||||
|
||||
|
||||
def _CleanTemporary(output_dir, architectures):
|
||||
if os.path.isdir(output_dir):
|
||||
logging.info('Removing temporary build files.')
|
||||
for arch in architectures:
|
||||
arch_lib_path = os.path.join(output_dir, arch + '_libs')
|
||||
if os.path.isdir(arch_lib_path):
|
||||
shutil.rmtree(arch_lib_path)
|
||||
|
||||
|
||||
def BuildWebRTC(output_dir, target_arch, flavor, build_type,
|
||||
ios_deployment_target, libvpx_build_vp9, use_bitcode,
|
||||
use_goma, extra_gn_args):
|
||||
@ -146,6 +158,11 @@ def main():
|
||||
return 0
|
||||
|
||||
architectures = list(args.arch)
|
||||
|
||||
if args.purify:
|
||||
_CleanTemporary(args.output_dir, architectures)
|
||||
return 0
|
||||
|
||||
# Ignoring x86 except for static libraries for now because of a GN build issue
|
||||
# where the generated dynamic framework has the wrong architectures.
|
||||
if 'x86' in architectures and args.build_type != 'static_only':
|
||||
|
||||
Reference in New Issue
Block a user