From 8718f5be4fafb061c9e1aec7a764824297536fb7 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Wed, 27 Jan 2016 16:16:37 +0000 Subject: [PATCH] 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. --- Tools/ardupilotwaf/ardupilotwaf.py | 14 +++++++------- wscript | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tools/ardupilotwaf/ardupilotwaf.py b/Tools/ardupilotwaf/ardupilotwaf.py index 611beca4d9..dc427c4f2e 100644 --- a/Tools/ardupilotwaf/ardupilotwaf.py +++ b/Tools/ardupilotwaf/ardupilotwaf.py @@ -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) diff --git a/wscript b/wscript index 0e3a4f3d89..ee84dae28e 100644 --- a/wscript +++ b/wscript @@ -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, )