From f13e71a80c31788ae5352479b092d24ed6eb287c Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Wed, 3 Feb 2016 12:53:19 +0000 Subject: [PATCH] waf: explicitly distinct routines in build That enhances readability and defines a clear separation of responsibilities of build routines. --- wscript | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/wscript b/wscript index ed5b22988d..5bcd854d0e 100644 --- a/wscript +++ b/wscript @@ -119,15 +119,18 @@ def collect_dirs_to_recurse(bld, globs, **kw): def list_boards(ctx): print(*boards.get_boards_names()) -def build(bld): - bld.load('ardupilotwaf') - bld.load('gtest') - +def _build_cmd_tweaks(bld): if bld.cmd == 'check-all': bld.options.all_tests = True bld.cmd = 'check' - #generate mavlink headers + if bld.cmd == 'check': + bld.options.clear_failed_tests = True + if not bld.env.HAS_GTEST: + bld.fatal('check: gtest library is required') + bld.add_post_fun(ardupilotwaf.test_summary) + +def _create_common_taskgens(bld): bld( features='mavgen', source='modules/mavlink/message_definitions/v1.0/ardupilotmega.xml', @@ -152,6 +155,7 @@ def build(bld): use='mavlink', ) +def _build_recursion(bld): common_dirs_patterns = [ # TODO: Currently each vehicle also generate its own copy of the # libraries. Fix this, or at least reduce the amount of @@ -195,11 +199,13 @@ def build(bld): for d in dirs_to_recurse: bld.recurse(d) - if bld.cmd == 'check': - bld.options.clear_failed_tests = True - if not bld.env.HAS_GTEST: - bld.fatal('check: gtest library is required') - bld.add_post_fun(ardupilotwaf.test_summary) +def build(bld): + bld.load('ardupilotwaf') + bld.load('gtest') + + _build_cmd_tweaks(bld) + _create_common_taskgens(bld) + _build_recursion(bld) ardupilotwaf.build_command('check', program_group_list='all',