Skip to content

Update frozen libs; implement clean builds for translations which need it #1909

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 4 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile for Sphinx documentation
# Top-level Makefile for documentation builds and miscellaneous tasks.
#

# You can set these variables from the command line.
Expand Down Expand Up @@ -203,3 +203,7 @@ translate: locale/circuitpython.pot

check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
$(PYTHON) tools/check_translations.py $^

update-frozen-libraries:
@echo "Updating all frozen libraries to latest tagged version."
cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ CHIP_FAMILY = samd21

# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 35
CFLAGS_INLINE_LIMIT = 23
RELEASE_NEEDS_CLEAN_BUILD = 1
else
CFLAGS_INLINE_LIMIT = 55
endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions ports/atmel-samd/boards/pewpew10/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
37 changes: 31 additions & 6 deletions tools/build_release_files.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#! /usr/bin/env python3

import os
import sys
import subprocess
Expand All @@ -6,7 +8,7 @@
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 = {}
Expand Down Expand Up @@ -37,7 +39,25 @@
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:
Expand All @@ -47,11 +67,14 @@
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)
Expand All @@ -62,7 +85,9 @@

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)
Expand Down