Skip to content

[CI] Use real core-api-version if possible #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion CI/build/arduino-builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
board_options = {} # key: board name, value: options
sketch_options = {} # key: sketch pattern, value: options
na_sketch_pattern = {} # key: board name, value: sketch pattern list
core_api_version = "10805"

# Counter
nb_build_passed = 0
Expand Down Expand Up @@ -193,6 +194,25 @@ def create_output_log_tree():
createFolder(os.path.join(build_output_dir, board))


def get_ide_version():
global core_api_version
try:
output = subprocess.check_output(
[os.path.join(arduino_path, "arduino"), "--version"],
stderr=subprocess.DEVNULL,
)
res = re.match("\D*(\d)\.(\d+)\.(\d+)", output.decode("utf-8"))
if res:
core_api_version = (
res.group(1) + res.group(2).zfill(2) + res.group(3).zfill(2)
)
print("Arduino IDE version used: " + core_api_version)
else:
raise subprocess.CalledProcessError(1, "re")
except subprocess.CalledProcessError as err:
print("Unable to define Arduino IDE version, use default: " + core_api_version)


def load_core_config():
global core_config
global maintainer
Expand Down Expand Up @@ -482,6 +502,7 @@ def log_sketch_build_result(sketch, boardKo, boardSkipped):
f.write("Skipped boards :\n" + "\n".join(boardSkipped))
f.write("\n")


# Log final result
def log_final_result():
# Also equal to len(board_type) * len(sketch_list)
Expand Down Expand Up @@ -569,7 +590,7 @@ def genBasicCommand(b_name, b_type):
cmd.append(arduino_lib_path)
cmd.append("-libraries")
cmd.append(arduino_user_lib_path)
cmd.append("-ide-version=10805")
cmd.append("-core-api-version=" + core_api_version)
cmd.append("-warnings=all")
if args.verbose:
cmd.append("-verbose")
Expand Down Expand Up @@ -766,6 +787,8 @@ def main():
if args.clean:
deleteFolder(root_output_dir)

get_ide_version()

load_core_config()

find_board()
Expand Down