waf: ardupilotwaf: rename build_shortcut() to build_command()

Rationale:
 1. That function creates a separate build context class instead of just
    creating a wrapper for calling build (previous approach).
 2. The check command isn't a build shortcut since there's no way of calling it
    without using 'check' explicitly.
This commit is contained in:
Gustavo Jose de Sousa 2016-01-27 16:16:37 +00:00 committed by Lucas De Marchi
parent 6901a2cdf6
commit 8718f5be4f
2 changed files with 12 additions and 12 deletions

View File

@ -251,13 +251,13 @@ def test_summary(bld):
bld.fatal('check: some tests failed')
_build_shortcuts = {}
_build_commands = {}
def _process_build_shortcut(bld):
if bld.cmd not in _build_shortcuts:
def _process_build_command(bld):
if bld.cmd not in _build_commands:
return
params = _build_shortcuts[bld.cmd]
params = _build_commands[bld.cmd]
targets = params['targets']
if targets:
@ -269,11 +269,11 @@ def _process_build_shortcut(bld):
program_group_list = Utils.to_list(params['program_group_list'])
bld.options.program_group.extend(program_group_list)
def build_shortcut(name,
def build_command(name,
targets=None,
program_group_list=[],
doc='build shortcut'):
_build_shortcuts[name] = dict(
_build_commands[name] = dict(
targets=targets,
program_group_list=program_group_list,
)
@ -317,5 +317,5 @@ def options(opt):
)
def build(bld):
bld.add_pre_fun(_process_build_shortcut)
bld.add_pre_fun(_process_build_command)
bld.add_pre_fun(_select_programs_from_group)

10
wscript
View File

@ -187,26 +187,26 @@ def build(bld):
bld.fatal('check: gtest library is required')
bld.add_post_fun(ardupilotwaf.test_summary)
ardupilotwaf.build_shortcut('check',
ardupilotwaf.build_command('check',
program_group_list='all',
doc='builds all programs and run tests',
)
ardupilotwaf.build_shortcut('copter',
ardupilotwaf.build_command('copter',
targets='bin/arducopter',
doc='builds arducopter',
)
ardupilotwaf.build_shortcut('plane',
ardupilotwaf.build_command('plane',
targets='bin/arduplane',
doc='builds arduplane',
)
ardupilotwaf.build_shortcut('rover',
ardupilotwaf.build_command('rover',
targets='bin/ardurover',
doc='builds ardurover',
)
for program_group in ('all', 'bin', 'tools', 'examples', 'tests', 'benchmarks'):
ardupilotwaf.build_shortcut(program_group,
ardupilotwaf.build_command(program_group,
program_group_list=program_group,
doc='builds all programs of %s group' % program_group,
)