Browse Source

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.
mission-4.1.18
Gustavo Jose de Sousa 9 years ago committed by Lucas De Marchi
parent
commit
2448ea1611
  1. 14
      Tools/ardupilotwaf/ardupilotwaf.py

14
Tools/ardupilotwaf/ardupilotwaf.py

@ -2,7 +2,7 @@ @@ -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): @@ -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…
Cancel
Save