49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
"""
|
|
cli.build.default - Vhex default build management
|
|
"""
|
|
import sys
|
|
|
|
from core.build.project import VxProject
|
|
from core.logger import log
|
|
|
|
__all__ = [
|
|
'default_build_cli'
|
|
]
|
|
|
|
#---
|
|
# Public
|
|
#---
|
|
|
|
def default_build_cli(argv):
|
|
"""Parse CLI arguments"""
|
|
target = argv[0][6:] if argv[0].find('build-') == 0 else ''
|
|
|
|
path = ''
|
|
verbose = False
|
|
extra_conf = {
|
|
'configure' : '',
|
|
'build' : '',
|
|
}
|
|
for arg in argv[1:]:
|
|
# if arg in ['-r', '--rebuild']:
|
|
# force_rebuild = True
|
|
# continue
|
|
# if arg in ['-u', '--update']:
|
|
# update_dependencies = True
|
|
# continue
|
|
if arg in ['-v', '--verbose']:
|
|
verbose = True
|
|
continue
|
|
if arg.find('--extra-conf=') == 0:
|
|
extra_conf['configure'] += ' ' + arg[13:]
|
|
continue
|
|
if arg.find('--extra-build=') == 0:
|
|
extra_conf['build'] += ' ' + arg[14:]
|
|
continue
|
|
if path:
|
|
log.error(f"argument '{arg}' not recognized")
|
|
sys.exit(85)
|
|
path = arg
|
|
|
|
return VxProject(path, target=target, extra_conf=extra_conf).build(verbose)
|