mirror of https://github.com/ArduPilot/ardupilot
waf: ardupilotwaf: add function build_shortcut
That enable the easy creation of custom build commands with the purpose of creating "shortcuts" for execution from command line. For example, consider the following code fragment from a wscript: ``` copter = ardupilotwaf.build_shortcut(targets='ArduCopter') ``` With that, one can just issue `waf copter` instead of `waf --target ArduCopter`. The parameter target is made optional because more parameters might be added to this function in the future.
This commit is contained in:
parent
0b8eff79af
commit
2448ea1611
|
@ -2,7 +2,7 @@
|
|||
# encoding: utf-8
|
||||
|
||||
from __future__ import print_function
|
||||
from waflib import Logs, Utils
|
||||
from waflib import Logs, Options, Utils
|
||||
|
||||
SOURCE_EXTS = [
|
||||
'*.S',
|
||||
|
@ -236,3 +236,15 @@ def test_summary(bld):
|
|||
|
||||
for filename in fails:
|
||||
Logs.error(' %s' % filename)
|
||||
|
||||
def build_shortcut(targets=None):
|
||||
def build_fn(bld):
|
||||
if targets:
|
||||
if Options.options.targets:
|
||||
Options.options.targets += ',' + targets
|
||||
else:
|
||||
Options.options.targets = targets
|
||||
|
||||
Options.commands = ['build'] + Options.commands
|
||||
|
||||
return build_fn
|
||||
|
|
Loading…
Reference in New Issue