Skip to content

Commit e1339e9

Browse files
committed
update build script
1 parent 27218de commit e1339e9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tools/build_all.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
subprocess.run("rm -rf _build/", shell=True)
99
subprocess.run("rm -rf bin/", shell=True)
1010

11+
SUCCEEDED = "\033[32msucceeded\033[0m"
12+
FAILED = "\033[31mfailed\033[0m"
13+
1114
success_count = 0
1215
fail_count = 0
1316
exit_status = 0
1417

15-
build_format = '| {:32} | {:9} | {:5} | {:6} | {:6} |'
18+
build_format = '| {:32} | {:18} | {:5} | {:6} | {:6} |'
1619
build_separator = '-' * 74
1720

1821
# All supported boards
@@ -27,23 +30,22 @@
2730
total_time = time.monotonic()
2831

2932
print(build_separator)
30-
print(build_format.format('Board', 'Result', 'Time', 'Flash', 'SRAM'))
33+
print(build_format.format('Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
3134
print(build_separator)
3235

3336
for board in all_boards:
3437
bin_directory = "bin/{}/".format(board)
3538
os.makedirs(bin_directory, exist_ok=True)
3639

3740
start_time = time.monotonic()
38-
subprocess.run("make -j BOARD={} clean".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
3941
make_result = subprocess.run("make -j BOARD={} all".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
4042
build_duration = time.monotonic() - start_time
4143

4244
flash_size = "-"
4345
sram_size = "-"
4446

4547
if make_result.returncode == 0:
46-
success = "\033[32msucceeded\033[0m"
48+
success = SUCCEEDED
4749
success_count += 1
4850

4951
out_file = glob.glob('_build/build-{}/*.out'.format(board))[0]
@@ -53,7 +55,7 @@
5355
sram_size = int(size_list[1]) + int(size_list[2])
5456
else:
5557
exit_status = make_result.returncode
56-
success = "\033[31mfailed\033[0m "
58+
success = FAILED
5759
fail_count += 1
5860

5961
for entry in os.scandir("_build/build-{}".format(board)):
@@ -70,7 +72,7 @@
7072
# Build Summary
7173
total_time = time.monotonic() - total_time
7274
print(build_separator)
73-
print("Build Sumamary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m and took {:.2f}s".format(success_count, fail_count, total_time))
75+
print("Build Sumamary: {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, total_time))
7476
print(build_separator)
7577

7678
sys.exit(exit_status)

0 commit comments

Comments
 (0)