mirror of https://github.com/ArduPilot/ardupilot
wscript: add generate tasklist for use by vscode extension
This commit is contained in:
parent
2e2e34d784
commit
3ae76fa64b
39
wscript
39
wscript
|
@ -7,12 +7,15 @@ import os.path
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import json
|
||||||
|
import fnmatch
|
||||||
sys.path.insert(0, 'Tools/ardupilotwaf/')
|
sys.path.insert(0, 'Tools/ardupilotwaf/')
|
||||||
|
|
||||||
import ardupilotwaf
|
import ardupilotwaf
|
||||||
import boards
|
import boards
|
||||||
|
|
||||||
from waflib import Build, ConfigSet, Configure, Context, Utils
|
from waflib import Build, ConfigSet, Configure, Context, Utils
|
||||||
|
from waflib.Configure import conf
|
||||||
|
|
||||||
# TODO: implement a command 'waf help' that shows the basic tasks a
|
# TODO: implement a command 'waf help' that shows the basic tasks a
|
||||||
# developer might want to do: e.g. how to configure a board, compile a
|
# developer might want to do: e.g. how to configure a board, compile a
|
||||||
|
@ -40,6 +43,9 @@ def _set_build_context_variant(board):
|
||||||
c.variant = board
|
c.variant = board
|
||||||
|
|
||||||
def init(ctx):
|
def init(ctx):
|
||||||
|
# Generate Task List, so that VS Code extension can keep track
|
||||||
|
# of changes to possible build targets
|
||||||
|
generate_tasklist(ctx, False)
|
||||||
env = ConfigSet.ConfigSet()
|
env = ConfigSet.ConfigSet()
|
||||||
try:
|
try:
|
||||||
p = os.path.join(Context.out_dir, Build.CACHE_DIR, Build.CACHE_SUFFIX)
|
p = os.path.join(Context.out_dir, Build.CACHE_DIR, Build.CACHE_SUFFIX)
|
||||||
|
@ -399,6 +405,39 @@ def collect_dirs_to_recurse(bld, globs, **kw):
|
||||||
def list_boards(ctx):
|
def list_boards(ctx):
|
||||||
print(*boards.get_boards_names())
|
print(*boards.get_boards_names())
|
||||||
|
|
||||||
|
@conf
|
||||||
|
def ap_periph_boards(ctx):
|
||||||
|
return boards.get_ap_periph_boards()
|
||||||
|
|
||||||
|
def generate_tasklist(ctx, do_print=True):
|
||||||
|
boardlist = boards.get_boards_names()
|
||||||
|
ap_periph_targets = boards.get_ap_periph_boards()
|
||||||
|
tasks = []
|
||||||
|
with open(os.path.join(Context.top_dir, "tasklist.json"), "w") as tlist:
|
||||||
|
for board in boardlist:
|
||||||
|
task = {}
|
||||||
|
task['configure'] = board
|
||||||
|
if board in ap_periph_targets:
|
||||||
|
if 'sitl' not in board:
|
||||||
|
# we only support AP_Periph and bootloader builds
|
||||||
|
task['targets'] = ['AP_Periph', 'bootloader']
|
||||||
|
else:
|
||||||
|
task['targets'] = ['AP_Periph']
|
||||||
|
elif 'iofirmware' in board:
|
||||||
|
task['targets'] = ['iofirmware', 'bootloader']
|
||||||
|
else:
|
||||||
|
if 'sitl' in board or 'SITL' in board:
|
||||||
|
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'replay']
|
||||||
|
elif 'linux' in board:
|
||||||
|
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub']
|
||||||
|
else:
|
||||||
|
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'bootloader']
|
||||||
|
task['buildOptions'] = '--upload'
|
||||||
|
tasks.append(task)
|
||||||
|
tlist.write(json.dumps(tasks))
|
||||||
|
if do_print:
|
||||||
|
print(json.dumps(tasks))
|
||||||
|
|
||||||
def board(ctx):
|
def board(ctx):
|
||||||
env = ConfigSet.ConfigSet()
|
env = ConfigSet.ConfigSet()
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue