8000 Implement forced clean builds for boards so designated. · rsbohn/circuitpython@4e85c1e · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e85c1e

Browse files
committed
Implement forced clean builds for boards so designated.
Mark boards that set CFLAGS_INLINE_LIMIT for particular langauges as needing clean builds. Fixes adafruit#1910.
1 parent e84f3b1 commit 4e85c1e

File tree

9 files changed

+43
-6
lines changed

9 files changed

+43
-6
lines changed

ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
2828
# Tweak inlining depending on language.
2929
ifeq ($(TRANSLATION), zh_Latn_pinyin)
3030
CFLAGS_INLINE_LIMIT = 25
31+
RELEASE_NEEDS_CLEAN_BUILD = 1
3132
else
3233
CFLAGS_INLINE_LIMIT = 55
3334
endif

ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CHIP_FAMILY = samd21
2121
# Tweak inlining depending on language.
2222
ifeq ($(TRANSLATION), zh_Latn_pinyin)
2323
CFLAGS_INLINE_LIMIT = 23
24+
RELEASE_NEEDS_CLEAN_BUILD = 1
2425
else
2526
CFLAGS_INLINE_LIMIT = 55
2627
endif

ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ CHIP_FAMILY = samd21
1515
# Tweak inlining depending on language.
1616
ifeq ($(TRANSLATION), zh_Latn_pinyin)
1717
CFLAGS_INLINE_LIMIT = 60
18+
RELEASE_NEEDS_CLEAN_BUILD = 1
1819
endif

ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CHIP_FAMILY = samd21
1515
# Tweak inlining depending on language.
1616
ifeq ($(TRANSLATION), zh_Latn_pinyin)
1717
CFLAGS_INLINE_LIMIT = 45
18+
RELEASE_NEEDS_CLEAN_BUILD = 1
1819
else
1920
CFLAGS_INLINE_LIMIT = 70
2021
endif

ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ CHIP_FAMILY = samd21
1616
# Tweak inlining depending on language.
1717
ifeq ($(TRANSLATION), zh_Latn_pinyin)
1818
CFLAGS_INLINE_LIMIT = 50
19+
RELEASE_NEEDS_CLEAN_BUILD = 1
1920
endif

ports/atmel-samd/boards/pewpew10/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ CIRCUITPY_SMALL_BUILD = 1
2525
# Tweak inlining depending on language.
2626
ifeq ($(TRANSLATION), zh_Latn_pinyin)
2727
CFLAGS_INLINE_LIMIT = 40
28+
RELEASE_NEEDS_CLEAN_BUILD = 1
2829
endif

ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ EXTERNAL_FLASH_DEVICES = "W25Q32FV"
1616
# Tweak inlining depending on language.
1717
ifeq ($(TRANSLATION), zh_Latn_pinyin)
1818
CFLAGS_INLINE_LIMIT = 50
19+
RELEASE_NEEDS_CLEAN_BUILD = 1
1920
endif

py/circuitpy_defns.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,8 @@ $(addprefix lib/,\
361361
libm/atan2f.c \
362362
)
363363
endif
364+
365+
.PHONY: check-release-needs-clean-build
366+
367+
check-release-needs-clean-build:
368+
@echo "RELEASE_NEEDS_CLEAN_BUILD = $(RELEASE_NEEDS_CLEAN_BUILD)"

tools/build_release_files.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! /usr/bin/env python3
2+
13
import os
24
import sys
35
import subprocess
@@ -6,7 +8,7 @@
68
import time
79

810
for port in build_info.SUPPORTED_PORTS:
9-
result = subprocess.run("rm -rf ../ports/{}/build*".format(port), shell=True)
11+
result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True)
1012

1113
ROSIE_SETUPS = ["rosie-ci"]
1214
rosie_ok = {}
@@ -37,7 +39,25 @@
3739
bin_directory = "../bin/{board}/{language}".format(board=board, language=language)
3840
os.makedirs(bin_directory, exist_ok=True)
3941
start_time = time.monotonic()
40-
make_result = subprocess.run("make -C ../ports/" + board_info["port"] + " TRANSLATION=" + language + " BOARD=" + board, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
42+
43+
# Normally different language builds are all done based on the same set of compiled sources.
44+
# But sometimes a particular language needs to be built from scratch, if, for instance,
45+
# CFLAGS_INLINE_LIMIT is set for a particular language to make it fit.
46+
clean_build_check_result = subprocess.run(
47+
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format(
48+
port = board_info["port"], language=language, board=board),
49+
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
50+
clean_build = clean_build_check_result.returncode == 0
51+
52+
build_dir = "build-{board}".format(board=board)
53+
if clean_build:
54+
build_dir += "-{language}".format(language=language)
55+
56+
make_result = subprocess.run(
57+
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build}".format(
58+
port = board_info["port"], language=language, board=board, build=build_dir),
59+
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
60+
4161
build_duration = time.monotonic() - start_time
4262
success = "\033[32msucceeded\033[0m"
4363
if make_result.returncode != 0:
@@ -47,11 +67,14 @@
4767
other_output = ""
4868

4969
for extension in board_info["extensions"]:
50-
temp_filename = "../ports/{port}/build-{board}/firmware.{extension}".format(port=board_info["port"], board=board, extension=extension)
70+
temp_filename = "../ports/{port}/{build}/firmware.{extension}".format(
71+
port=board_info["port"], build=build_dir, extension=extension)
5172
for alias in board_info["aliases"] + [board]:
52-
bin_directory = "../bin/{alias}/{language}".format(alias=alias, language=language)
73+
bin_directory = "../bin/{alias}/{language}".format(
74+
alias=alias, language=language)
5375
os.makedirs(bin_directory, exist_ok=True)
54-
final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(alias=alias, language=language, version=version, extension=extension)
76+
final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(
77+
alias=alias, language=language, version=version, extension=extension)
5578
final_filename = os.path.join(bin_directory, final_filename)
5679
try:
5780
shutil.copyfile(temp_filename, final_filename)
@@ -62,7 +85,9 @@
6285

6386
if travis:
6487
print('travis_fold:start:adafruit-bins-{}-{}\\r'.format(language, board))
65-
print("Build {} for {} took {:.2f}s and {}".format(board, language, build_duration, success))
88+
print("Build {board} for {language}{clean_build} took {build_duration:.2f}s and {success}".format(
89+
board=board, language=language, clean_build=(" (clean_build)" if clean_build else ""),
90+
build_duration=build_duration, success=success))
6691
if make_result.returncode != 0:
6792
print(make_result.stdout.decode("utf-8"))
6893
print(other_output)

0 commit comments

Comments
 (0)
0