93a4b9c4a9
* enable sparseCheckout, moving github actions from docker to raw shell * fix missing known_hosts while setting ssh priv key * fix build.yml * add ssh key to upload just in time * fixing rsync syntax * fix build.yml * try to fix build.yml again * testing rsync * test rsync again * add linters * add Black Python linter to submodules * add Black submodule * add working python linter target, dirty file list * up toolchain to version 4 * up toolchain to ver 5 * up toolchain version to 6 * fbt: using black 22.6.0 * remove Black submodule, up toolchain to ver 7 * fbt: added lint_py, format_py targets * add pvs_studio workflow * fix pvs_studio segfault * fix pvs_studio command * fix pvs_studio command 2 * show env before run pvs_studio * try to debug pvs_studio * try to strace pvs_studio.. * Add FBT_TOOLCHAIN_PATH, MacOS Rosseta check, and ignore non-x86_64 linux architectures * prevent redownloading toolchain on github-runners * fix toolchain download exitcode * add strace to debug pvs_studio segfault * disable strace to catch full code dump * Add './fbt cli' target to access Flipper CLI via PySerial * remove pvs_studio from this PR * removing clang-format from toolchain due errors * make source easy, and fix some mistakes found by @hedger * Add check_submodules workflow, some fixes * fixing mistakes Co-authored-by: hedger <hedger@nanode.su> Co-authored-by: hedger <hedger@users.noreply.github.com>
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
import posixpath
|
|
import os
|
|
from SCons.Errors import UserError
|
|
|
|
|
|
def BuildModule(env, module):
|
|
src_dir = str(env.Dir(".").srcdir or os.getcwd())
|
|
module_sconscript = posixpath.join(src_dir, module, "SConscript")
|
|
if not os.path.exists(module_sconscript):
|
|
module_sconscript = posixpath.join(src_dir, f"{module}.scons")
|
|
if not os.path.exists(module_sconscript):
|
|
raise UserError(f"Cannot build module {module}: scons file not found")
|
|
|
|
env.Append(PY_LINT_SOURCES=[module_sconscript])
|
|
return env.SConscript(
|
|
module_sconscript,
|
|
variant_dir=posixpath.join(env.subst("$BUILD_DIR"), module),
|
|
duplicate=0,
|
|
)
|
|
|
|
|
|
def BuildModules(env, modules):
|
|
result = []
|
|
for module in modules:
|
|
build_res = env.BuildModule(module)
|
|
# print("module ", module, build_res)
|
|
if build_res is None:
|
|
continue
|
|
result.append(build_res)
|
|
return result
|
|
|
|
|
|
def PhonyTarget(env, name, action, source=None, **kw):
|
|
if not source:
|
|
source = []
|
|
phony_name = "phony_" + name
|
|
env.Pseudo(phony_name)
|
|
command = env.Command(phony_name, source, action, **kw)
|
|
env.AlwaysBuild(env.Alias(name, command))
|
|
return command
|
|
|
|
|
|
def generate(env):
|
|
env.AddMethod(BuildModule)
|
|
env.AddMethod(BuildModules)
|
|
env.AddMethod(PhonyTarget)
|
|
|
|
|
|
def exists(env):
|
|
return True
|