mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-03 15:04:17 +01:00
Multiple ways to specify version string through environment variables:
- `ESPURNA_BUILD_FULL_VERSION` to set full version string
By default it is empty, and the version is combined using the values specified below
- `ESPURNA_BUILD_VERSION` to modify the first part of the version string (1.15.0-dev)
By default, uses espurna/config/version.h APP_VERSION value
- `ESPURNA_BUILD_REVISION` to specify revision part of the version string
For example 12345678, which is expanded as either .git12345678 or -git12345678
(depending on whether the version string contains hyphen)
By default, use git to retrieve the first 8 characters of the current HEAD SHA value
- `ESPURNA_BUILD_VERSION_SUFFIX` to specify build metadata part of the string
For example nightly20210607, which is added to the full version as 1.15.0-dev+nightly20210607
Empty by defauld
Adds -t build-and-copy which uses the values above to copy firmware.bin, configurable with:
- `ESPURNA_BUILD_NAME` to set the suffix of the filename.
By default, uses the $PIOENV (aka the string after the env: in the .ini file)
- `ESPURNA_BUILD_DESTINATION` to specify where to copy the .bin files
By default, uses $PROJECT_DIR
Resulting file is stored at:
${ESPURNA_BUILD_DESTINATION}/${ESPURNA_BUILD_FULL_VERSION}/espurna-${ESPURNA_BUILD_FULL_VERSION}-${ESPURNA_BUILD_NAME}.bin
In addition, modify generate_release_sh.py to use the new environment variables.
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
# coding=utf-8
|
|
# pylint: dummy-variables-rgx='(_+[a-zA-Z0-9]*?$)|dummy|env|projenv'
|
|
#
|
|
# Original extra_scripts.py
|
|
# Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
|
|
#
|
|
# ldscripts, lwip patching, updated postmortem flags and git support
|
|
# Copyright (C) 2019-2020 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
|
|
|
|
# Run this script every time building an env AFTER platform-specific code is loaded
|
|
|
|
from espurna_utils import (
|
|
check_printsize,
|
|
remove_float_support,
|
|
ldscripts_inject_libpath,
|
|
app_inject_version,
|
|
dummy_ets_printf,
|
|
app_inject_flags,
|
|
app_add_target_build_and_copy
|
|
)
|
|
|
|
|
|
Import("env", "projenv")
|
|
|
|
import os
|
|
|
|
CI = "true" == os.environ.get("CI")
|
|
|
|
env.ProcessFlags("-Wl,-Map -Wl,\\\"${BUILD_DIR}/${PROGNAME}.map\\\"")
|
|
|
|
# Always show warnings for project code
|
|
projenv.ProcessUnFlags("-w")
|
|
|
|
# XXX: note that this will also break %d format with floats and print raw memory contents as int
|
|
# Cores after 2.3.0 can disable %f in the printf / scanf to reduce .bin size
|
|
remove_float_support(env)
|
|
ldscripts_inject_libpath(env)
|
|
|
|
# two-step update hint when using 1MB boards
|
|
if not CI:
|
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_printsize)
|
|
|
|
# disable postmortem printing to the uart. another one is in eboot, but this is what causes the most harm
|
|
if "DISABLE_POSTMORTEM_STACKDUMP" in env["CPPFLAGS"]:
|
|
env.AddPostAction(
|
|
"$BUILD_DIR/FrameworkArduino/core_esp8266_postmortem.cpp.o", dummy_ets_printf
|
|
)
|
|
|
|
# handle add -DAPP_VERSION=... that was set and / or detected
|
|
app_inject_version(projenv)
|
|
|
|
# handle OTA board and flags here, since projenv is not available in pre-scripts
|
|
app_inject_flags(projenv)
|
|
|
|
# handle when CI does a tagged build or user explicitly asked to store the firmware.bin
|
|
app_add_target_build_and_copy(projenv)
|