Implement forced clean builds for boards so designated.

Mark boards that set CFLAGS_INLINE_LIMIT for particular langauges as needing clean builds.

Fixes #1910.
This commit is contained in:
Dan Halbert 2019-05-24 15:32:24 -04:00
parent e84f3b1c6a
commit 4e85c1ef91
9 changed files with 43 additions and 6 deletions

View File

@ -28,6 +28,7 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 25
RELEASE_NEEDS_CLEAN_BUILD = 1
else
CFLAGS_INLINE_LIMIT = 55
endif

View File

@ -21,6 +21,7 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 23
RELEASE_NEEDS_CLEAN_BUILD = 1
else
CFLAGS_INLINE_LIMIT = 55
endif

View File

@ -15,4 +15,5 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 60
RELEASE_NEEDS_CLEAN_BUILD = 1
endif

View File

@ -15,6 +15,7 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 45
RELEASE_NEEDS_CLEAN_BUILD = 1
else
CFLAGS_INLINE_LIMIT = 70
endif

View File

@ -16,4 +16,5 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 50
RELEASE_NEEDS_CLEAN_BUILD = 1
endif

View File

@ -25,4 +25,5 @@ CIRCUITPY_SMALL_BUILD = 1
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 40
RELEASE_NEEDS_CLEAN_BUILD = 1
endif

View File

@ -16,4 +16,5 @@ EXTERNAL_FLASH_DEVICES = "W25Q32FV"
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 50
RELEASE_NEEDS_CLEAN_BUILD = 1
endif

View File

@ -361,3 +361,8 @@ $(addprefix lib/,\
libm/atan2f.c \
)
endif
.PHONY: check-release-needs-clean-build
check-release-needs-clean-build:
@echo "RELEASE_NEEDS_CLEAN_BUILD = $(RELEASE_NEEDS_CLEAN_BUILD)"

View File

@ -1,3 +1,5 @@
#! /usr/bin/env python3
import os
import sys
import subprocess
@ -6,7 +8,7 @@ import build_board_info as build_info
import time
for port in build_info.SUPPORTED_PORTS:
result = subprocess.run("rm -rf ../ports/{}/build*".format(port), shell=True)
result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True)
ROSIE_SETUPS = ["rosie-ci"]
rosie_ok = {}
@ -37,7 +39,25 @@ for board in build_boards:
bin_directory = "../bin/{board}/{language}".format(board=board, language=language)
os.makedirs(bin_directory, exist_ok=True)
start_time = time.monotonic()
make_result = subprocess.run("make -C ../ports/" + board_info["port"] + " TRANSLATION=" + language + " BOARD=" + board, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# Normally different language builds are all done based on the same set of compiled sources.
# But sometimes a particular language needs to be built from scratch, if, for instance,
# CFLAGS_INLINE_LIMIT is set for a particular language to make it fit.
clean_build_check_result = subprocess.run(
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format(
port = board_info["port"], language=language, board=board),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
clean_build = clean_build_check_result.returncode == 0
build_dir = "build-{board}".format(board=board)
if clean_build:
build_dir += "-{language}".format(language=language)
make_result = subprocess.run(
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build}".format(
port = board_info["port"], language=language, board=board, build=build_dir),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
build_duration = time.monotonic() - start_time
success = "\033[32msucceeded\033[0m"
if make_result.returncode != 0:
@ -47,11 +67,14 @@ for board in build_boards:
other_output = ""
for extension in board_info["extensions"]:
temp_filename = "../ports/{port}/build-{board}/firmware.{extension}".format(port=board_info["port"], board=board, extension=extension)
temp_filename = "../ports/{port}/{build}/firmware.{extension}".format(
port=board_info["port"], build=build_dir, extension=extension)
for alias in board_info["aliases"] + [board]:
bin_directory = "../bin/{alias}/{language}".format(alias=alias, language=language)
bin_directory = "../bin/{alias}/{language}".format(
alias=alias, language=language)
os.makedirs(bin_directory, exist_ok=True)
final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(alias=alias, language=language, version=version, extension=extension)
final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(
alias=alias, language=language, version=version, extension=extension)
final_filename = os.path.join(bin_directory, final_filename)
try:
shutil.copyfile(temp_filename, final_filename)
@ -62,7 +85,9 @@ for board in build_boards:
if travis:
print('travis_fold:start:adafruit-bins-{}-{}\\r'.format(language, board))
print("Build {} for {} took {:.2f}s and {}".format(board, language, build_duration, success))
print("Build {board} for {language}{clean_build} took {build_duration:.2f}s and {success}".format(
board=board, language=language, clean_build=(" (clean_build)" if clean_build else ""),
build_duration=build_duration, success=success))
if make_result.returncode != 0:
print(make_result.stdout.decode("utf-8"))
print(other_output)