vxSDK/vxsdk/cli/build/__init__.py

73 lines
2.0 KiB
Python

"""
cli.build - vxSDK build interface
"""
from core.logger import log
from cli.build.default import default_build_cli
from cli.build.doctor import doctor_build_cli
__all__ = [
'__VXSDK_MODULE_META__',
'cli_validate',
'cli_parse',
]
__VXSDK_MODULE_META__ = (
['build'],
"Build a project",
r"""vxsdk-build
Build System Abstraction
USAGE:
vxsdk build(-<target>) [OPTIONS]
DESCRIPTION:
Compile a Vhex project.
NOTES:
The Vhex build system is extremely powerful and polyvalent. It allows the
user to totally ignore the build part and the dependencies management of
the project.
All Vhex projects use a <vxsdk.toml> file which should be stored at the
root of the project directory (you can generate a project template using
the `vxsdk project new <project>`). This file uses the TOML language to
control the build behaviour.
This is an exemple of a project description. We recommand you to see the
vxKernel one because it uses a lot of advanced feature like target and
environement configuration. You can also check the wiki to have a complet
documentation about this file.
OPTIONS:
-v, --verbose Display more information during the build
-r, --rebuild Force rebuild the project
--extra-conf [ARG]... Add extra configuration flags
--extra-build [ARG]... Add extra build flags
-h, --help Display this help message
ACTIONS:
doctor Display all information about one package
"""
)
#---
# Public
#---
def cli_validate(name):
""" validate the module name """
return name.find('build') == 0
def cli_parse(argv):
""" Build subcommand entry """
if len(argv) > 2:
if '--help' in argv or '-h' in argv:
log.user(__VXSDK_MODULE_META__[2])
return 0
if argv[1] == 'doctor':
return doctor_build_cli(argv[2:])
return default_build_cli(argv)