SCons: do not include backup files in build (#2221)
* SCons: do not include backup files in build * fbt: now GlobRecursive by default excludes backup files * fbt: added backup file exclusion to plain libs Signed-off-by: Michal Suchanek <msuchanek@suse.de> Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: hedger <hedger@nanode.su> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
23ecc186c2
commit
00076deece
@ -78,7 +78,9 @@ if assetsenv["IS_BASE_FIRMWARE"]:
|
||||
resources = assetsenv.Command(
|
||||
"#/assets/resources/Manifest",
|
||||
assetsenv.GlobRecursive(
|
||||
"*", assetsenv.Dir("resources").srcnode(), exclude="Manifest"
|
||||
"*",
|
||||
assetsenv.Dir("resources").srcnode(),
|
||||
exclude=["Manifest"],
|
||||
),
|
||||
action=Action(
|
||||
'${PYTHON3} "${ASSETS_COMPILER}" manifest "${TARGET.dir.posix}" --timestamp=${GIT_UNIX_TIMESTAMP}',
|
||||
|
@ -2,6 +2,7 @@ Import("ENV", "fw_build_meta")
|
||||
|
||||
from SCons.Errors import UserError
|
||||
from SCons.Node import FS
|
||||
|
||||
import itertools
|
||||
|
||||
from fbt_extra.util import (
|
||||
@ -171,7 +172,7 @@ sources = [apps_c]
|
||||
# Gather sources only from app folders in current configuration
|
||||
sources.extend(
|
||||
itertools.chain.from_iterable(
|
||||
fwenv.GlobRecursive(source_type, appdir.relpath, exclude="lib")
|
||||
fwenv.GlobRecursive(source_type, appdir.relpath, exclude=["lib"])
|
||||
for appdir, source_type in fwenv["APPBUILD"].get_builtin_app_folders()
|
||||
)
|
||||
)
|
||||
|
@ -1,5 +1,7 @@
|
||||
Import("env")
|
||||
|
||||
from fbt.util import GLOB_FILE_EXCLUSION
|
||||
|
||||
env.Append(
|
||||
CPPPATH=[
|
||||
"#/lib/digital_signal",
|
||||
@ -39,7 +41,11 @@ libs_plain = [
|
||||
]
|
||||
|
||||
for lib in libs_plain:
|
||||
sources += Glob(lib + "/*.c*", source=True)
|
||||
sources += Glob(
|
||||
lib + "/*.c*",
|
||||
exclude=GLOB_FILE_EXCLUSION,
|
||||
source=True,
|
||||
)
|
||||
|
||||
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
|
||||
libenv.Install("${LIB_DIST_DIR}", lib)
|
||||
|
@ -8,6 +8,10 @@ import os
|
||||
|
||||
WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)")
|
||||
|
||||
# Used by default when globbing for files with GlobRecursive
|
||||
# Excludes all files ending with ~, usually created by editors as backup files
|
||||
GLOB_FILE_EXCLUSION = ["*~"]
|
||||
|
||||
|
||||
def tempfile_arg_esc_func(arg):
|
||||
arg = quote_spaces(arg)
|
||||
|
@ -27,9 +27,7 @@ def proto_emitter(target, source, env):
|
||||
def dolphin_emitter(target, source, env):
|
||||
res_root_dir = source[0].Dir(env["DOLPHIN_RES_TYPE"])
|
||||
source = [res_root_dir]
|
||||
source.extend(
|
||||
env.GlobRecursive("*.*", res_root_dir.srcnode()),
|
||||
)
|
||||
source.extend(env.GlobRecursive("*.*", res_root_dir.srcnode()))
|
||||
|
||||
target_base_dir = target[0]
|
||||
env.Replace(_DOLPHIN_OUT_DIR=target[0])
|
||||
|
@ -1,7 +1,11 @@
|
||||
import SCons
|
||||
from SCons.Script import Flatten
|
||||
from fbt.util import GLOB_FILE_EXCLUSION
|
||||
|
||||
|
||||
def GlobRecursive(env, pattern, node=".", exclude=None):
|
||||
def GlobRecursive(env, pattern, node=".", exclude=[]):
|
||||
exclude = list(set(Flatten(exclude) + GLOB_FILE_EXCLUSION))
|
||||
# print(f"Starting glob for {pattern} from {node} (exclude: {exclude})")
|
||||
results = []
|
||||
if isinstance(node, str):
|
||||
node = env.Dir(node)
|
||||
@ -13,7 +17,7 @@ def GlobRecursive(env, pattern, node=".", exclude=None):
|
||||
source=True,
|
||||
exclude=exclude,
|
||||
)
|
||||
# print(f"Glob for {pattern} from {node}: {results}")
|
||||
# print(f"Glob result for {pattern} from {node}: {results}")
|
||||
return results
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user