hathach 5 лет назад
Родитель
Сommit
a0f6fa4e06
2 измененных файлов с 22 добавлено и 15 удалено
  1. 21 14
      tools/build_all.py
  2. 1 1
      tools/build_esp32s.py

+ 21 - 14
tools/build_all.py

@@ -14,26 +14,33 @@ total_time = time.monotonic()
 build_format = '| {:23} | {:30} | {:9} | {:7} | {:6} | {:6} |'
 build_separator = '-' * 100
 
-# 1st Argument is Example, build all examples if not existed
+# If examples are not specified in arguments, build all
 all_examples = []
+
+for entry in os.scandir("examples/device"):
+    if entry.is_dir():
+        all_examples.append(entry.name)
+
 if len(sys.argv) > 1:
-    all_examples.append(sys.argv[1])
-else:
-    for entry in os.scandir("examples/device"):
-        if entry.is_dir():
-            all_examples.append(entry.name)
+    input_examples = list(set(all_examples).intersection(sys.argv))
+    if len(input_examples) > 0:
+        all_examples = input_examples
+
 all_examples.sort()
 
-# 2nd Argument is Board, build all boards if not existed
+# If boards are not specified in arguments, build all
 all_boards = []
-if len(sys.argv) > 2:
-    all_boards.append(sys.argv[2])
-else:
-    for entry in os.scandir("hw/bsp"):
-        if entry.is_dir():
-            all_boards.append(entry.name)
-all_boards.sort()
 
+for entry in os.scandir("hw/bsp"):
+    if entry.is_dir():
+        all_boards.append(entry.name)
+
+if len(sys.argv) > 1:
+    input_boards = list(set(all_boards).intersection(sys.argv))
+    if len(input_boards) > 0:
+        all_boards = input_boards
+
+all_boards.sort()
 
 def build_example(example, board):
     subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True,

+ 1 - 1
tools/build_esp32s.py

@@ -42,7 +42,7 @@ all_boards.sort()
 def build_example(example, board):
     subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True,
                    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    return subprocess.run("make -j 4 -C examples/device/{} BOARD={} all".format(example, board), shell=True,
+    return subprocess.run("make -C examples/device/{} BOARD={} all".format(example, board), shell=True,
                           stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 
 def build_size(example, board):