-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepo.lb
76 lines (64 loc) · 2.63 KB
/
repo.lb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <[email protected]>
#
# This file is part of Taproot.
#
# Taproot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Taproot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Taproot. If not, see <https://www.gnu.org/licenses/>.
import subprocess
import sys
sys.path.append(repopath("lbuild-scripts"))
from hosted_platforms import ALL_HOSTED_TARGET_NAMES
from add_immutable_warning import add_immutable_warning
def init(repo):
repo.name = "taproot"
repo.description = "Robot-independent control system code generation for the RoboMaster robotics competition"
repo.add_option(
StringOption(
name="project_name",
default="mcb-project",
description="Project name"))
repo.add_option(
BooleanOption(
name="rebuild_modm",
default=True,
description="Whether or not to rebuild modm HALs"))
repo.add_option(
EnumerationOption(
name="dev_board",
description="Which development board to be used",
enumeration=["rm-dev-board-a", "rm-dev-board-c"]))
def prepare(repo, options):
repo.add_modules_recursive("./src", modulefile="*.lb")
repo.add_modules_recursive("./test", modulefile="*.lb")
repo.add_modules_recursive("./modm-project-files", modulefile="*.lb")
repo.add_modules_recursive("./docs", modulefile="*.lb")
repo.add_modules_recursive("./build-tools", modulefile="*.lb")
repo.add_modules_recursive("./ext", modulefile="*.lb")
def build(env):
env.outbasepath = "taproot"
env.copy("README.generation.md", "README.md")
add_immutable_warning(f"taproot")
if env[":rebuild_modm"]:
print("building modm")
try:
subprocess.run(["lbuild", "build"], check=True, cwd="taproot")
except subprocess.CalledProcessError as e:
print(e)
exit(1)
print("building sim-modm")
try:
for target in ALL_HOSTED_TARGET_NAMES:
subprocess.run(["lbuild", "build"], check=True, cwd=f"taproot/sim-modm/{target}")
except subprocess.CalledProcessError as e:
print(e)
exit(1)