|
145 | 145 | board_options = {} # key: board name, value: options |
146 | 146 | sketch_options = {} # key: sketch pattern, value: options |
147 | 147 | na_sketch_pattern = {} # key: board name, value: sketch pattern list |
| 148 | +core_api_version = "10805" |
148 | 149 |
|
149 | 150 | # Counter |
150 | 151 | nb_build_passed = 0 |
@@ -193,6 +194,25 @@ def create_output_log_tree(): |
193 | 194 | createFolder(os.path.join(build_output_dir, board)) |
194 | 195 |
|
195 | 196 |
|
| 197 | +def get_ide_version(): |
| 198 | + global core_api_version |
| 199 | + try: |
| 200 | + output = subprocess.check_output( |
| 201 | + [os.path.join(arduino_path, "arduino"), "--version"], |
| 202 | + stderr=subprocess.DEVNULL, |
| 203 | + ) |
| 204 | + res = re.match("\D*(\d)\.(\d+)\.(\d+)", output.decode("utf-8")) |
| 205 | + if res: |
| 206 | + core_api_version = ( |
| 207 | + res.group(1) + res.group(2).zfill(2) + res.group(3).zfill(2) |
| 208 | + ) |
| 209 | + print("Arduino IDE version used: " + core_api_version) |
| 210 | + else: |
| 211 | + raise subprocess.CalledProcessError(1, "re") |
| 212 | + except subprocess.CalledProcessError as err: |
| 213 | + print("Unable to define Arduino IDE version, use default: " + core_api_version) |
| 214 | + |
| 215 | + |
196 | 216 | def load_core_config(): |
197 | 217 | global core_config |
198 | 218 | global maintainer |
@@ -482,6 +502,7 @@ def log_sketch_build_result(sketch, boardKo, boardSkipped): |
482 | 502 | f.write("Skipped boards :\n" + "\n".join(boardSkipped)) |
483 | 503 | f.write("\n") |
484 | 504 |
|
| 505 | + |
485 | 506 | # Log final result |
486 | 507 | def log_final_result(): |
487 | 508 | # Also equal to len(board_type) * len(sketch_list) |
@@ -569,7 +590,7 @@ def genBasicCommand(b_name, b_type): |
569 | 590 | cmd.append(arduino_lib_path) |
570 | 591 | cmd.append("-libraries") |
571 | 592 | cmd.append(arduino_user_lib_path) |
572 | | - cmd.append("-ide-version=10805") |
| 593 | + cmd.append("-core-api-version=" + core_api_version) |
573 | 594 | cmd.append("-warnings=all") |
574 | 595 | if args.verbose: |
575 | 596 | cmd.append("-verbose") |
@@ -766,6 +787,8 @@ def main(): |
766 | 787 | if args.clean: |
767 | 788 | deleteFolder(root_output_dir) |
768 | 789 |
|
| 790 | + get_ide_version() |
| 791 | + |
769 | 792 | load_core_config() |
770 | 793 |
|
771 | 794 | find_board() |
|
0 commit comments