flipperzero-firmware/site_scons/environ.scons
hedger ebc2b66372
fbt fixes for mfbt pt2 (#1951)
* fbt: split sdk management code
* scripts: fixed import handling
* fbt: sdk: reformatted paths
* scrips: dist: bundling libs as a build artifact
* fbt: sdk: better path management
* typo fix
* fbt: sdk: minor path handling fixes
* toolchain: fixed windows toolchain download
* fbt: minor refactorin
* fbt: moved sdk management code to extapps.scons
* fbt: fixed sdk symbols header path; disabled -fstack-usage
* fbt: changed pathing for .py scripts
* fbt: changed SDK_HEADERS pathing; added libusb to SDK; added icon_i.h to SDK; added hw target to SDK meta
* fbt: added libusb headers to SDK
* picopass: include cleanup; api: added subghz/registry.h; api: added mbedtls to exported headers
* picopass: fixed formatting
* fbt: fixed COPRO_ASSETS_SCRIPT
* sdk: added basic infrared apis
* toolchain: added ufbt to list of legal fbtenv callers; updated error messages
* fbt: changed manifest collection & icon processing code
* fbt: simpler srcdir lookup
* toolchain: path management fixes; fbt: fixes for fap private libs paths
* scripts: toolchain: reworked download on Windows
* toolchain: v17
* scripts: added colorlog for logging
* Github: fix unit tests

Co-authored-by: あく <alleteam@gmail.com>
2022-11-03 00:15:40 +09:00

90 lines
2.3 KiB
Plaintext

from SCons.Platform import TempFileMunge
from fbt.util import (
tempfile_arg_esc_func,
single_quote,
wrap_tempfile,
extract_abs_dir_path,
)
import os
import multiprocessing
Import("VAR_ENV")
forward_os_env = {
# Import PATH from OS env - scons doesn't do that by default
"PATH": os.environ["PATH"],
}
# Proxying CI environment to child processes & scripts
variables_to_forward = [
# CI/CD variables
"WORKFLOW_BRANCH_OR_TAG",
"DIST_SUFFIX",
# Python & other tools
"HOME",
"APPDATA",
"PYTHONHOME",
"PYTHONNOUSERSITE",
"TMP",
"TEMP",
# Colors for tools
"TERM",
]
if proxy_env := GetOption("proxy_env"):
variables_to_forward.extend(proxy_env.split(","))
for env_value_name in variables_to_forward:
if environ_value := os.environ.get(env_value_name, None):
forward_os_env[env_value_name] = environ_value
coreenv = VAR_ENV.Clone(
tools=[
"fbt_tweaks",
(
"crosscc",
{
"toolchain_prefix": "arm-none-eabi-",
"versions": VAR_ENV["FBT_TOOLCHAIN_VERSIONS"],
},
),
"python3",
"sconsmodular",
"sconsrecursiveglob",
"ccache",
],
TEMPFILE=TempFileMunge,
MAXLINELENGTH=2048,
PROGSUFFIX=".elf",
ENV=forward_os_env,
SINGLEQUOTEFUNC=single_quote,
ABSPATHGETTERFUNC=extract_abs_dir_path,
# Setting up temp file parameters - to overcome command line length limits
TEMPFILEARGESCFUNC=tempfile_arg_esc_func,
FBT_SCRIPT_DIR=Dir("#/scripts"),
ROOT_DIR=Dir("#"),
)
# If DIST_SUFFIX is set in environment, is has precedence (set by CI)
if os_suffix := os.environ.get("DIST_SUFFIX", None):
coreenv.Replace(
DIST_SUFFIX=os_suffix,
)
# Default value for commandline options
SetOption("num_jobs", multiprocessing.cpu_count())
## NB - disabled both caches since they seem to do more harm then good in our case
# Avoiding re-scan of all sources on every startup
# SetOption("implicit_cache", True)
# SetOption("implicit_deps_unchanged", True)
# More aggressive caching
SetOption("max_drift", 1)
# Random task queue - to discover isses with build logic faster
# SetOption("random", 1)
wrap_tempfile(coreenv, "LINKCOM")
wrap_tempfile(coreenv, "ARCOM")
Return("coreenv")