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(
|
resources = assetsenv.Command(
|
||||||
"#/assets/resources/Manifest",
|
"#/assets/resources/Manifest",
|
||||||
assetsenv.GlobRecursive(
|
assetsenv.GlobRecursive(
|
||||||
"*", assetsenv.Dir("resources").srcnode(), exclude="Manifest"
|
"*",
|
||||||
|
assetsenv.Dir("resources").srcnode(),
|
||||||
|
exclude=["Manifest"],
|
||||||
),
|
),
|
||||||
action=Action(
|
action=Action(
|
||||||
'${PYTHON3} "${ASSETS_COMPILER}" manifest "${TARGET.dir.posix}" --timestamp=${GIT_UNIX_TIMESTAMP}',
|
'${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.Errors import UserError
|
||||||
from SCons.Node import FS
|
from SCons.Node import FS
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from fbt_extra.util import (
|
from fbt_extra.util import (
|
||||||
@ -171,7 +172,7 @@ sources = [apps_c]
|
|||||||
# Gather sources only from app folders in current configuration
|
# Gather sources only from app folders in current configuration
|
||||||
sources.extend(
|
sources.extend(
|
||||||
itertools.chain.from_iterable(
|
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()
|
for appdir, source_type in fwenv["APPBUILD"].get_builtin_app_folders()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
|
from fbt.util import GLOB_FILE_EXCLUSION
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
CPPPATH=[
|
CPPPATH=[
|
||||||
"#/lib/digital_signal",
|
"#/lib/digital_signal",
|
||||||
@ -39,7 +41,11 @@ libs_plain = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
for lib in 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)
|
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
|
||||||
libenv.Install("${LIB_DIST_DIR}", lib)
|
libenv.Install("${LIB_DIST_DIR}", lib)
|
||||||
|
@ -8,6 +8,10 @@ import os
|
|||||||
|
|
||||||
WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)")
|
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):
|
def tempfile_arg_esc_func(arg):
|
||||||
arg = quote_spaces(arg)
|
arg = quote_spaces(arg)
|
||||||
|
@ -27,9 +27,7 @@ def proto_emitter(target, source, env):
|
|||||||
def dolphin_emitter(target, source, env):
|
def dolphin_emitter(target, source, env):
|
||||||
res_root_dir = source[0].Dir(env["DOLPHIN_RES_TYPE"])
|
res_root_dir = source[0].Dir(env["DOLPHIN_RES_TYPE"])
|
||||||
source = [res_root_dir]
|
source = [res_root_dir]
|
||||||
source.extend(
|
source.extend(env.GlobRecursive("*.*", res_root_dir.srcnode()))
|
||||||
env.GlobRecursive("*.*", res_root_dir.srcnode()),
|
|
||||||
)
|
|
||||||
|
|
||||||
target_base_dir = target[0]
|
target_base_dir = target[0]
|
||||||
env.Replace(_DOLPHIN_OUT_DIR=target[0])
|
env.Replace(_DOLPHIN_OUT_DIR=target[0])
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
import SCons
|
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 = []
|
results = []
|
||||||
if isinstance(node, str):
|
if isinstance(node, str):
|
||||||
node = env.Dir(node)
|
node = env.Dir(node)
|
||||||
@ -13,7 +17,7 @@ def GlobRecursive(env, pattern, node=".", exclude=None):
|
|||||||
source=True,
|
source=True,
|
||||||
exclude=exclude,
|
exclude=exclude,
|
||||||
)
|
)
|
||||||
# print(f"Glob for {pattern} from {node}: {results}")
|
# print(f"Glob result for {pattern} from {node}: {results}")
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user