forked from platformio/platformio-core
Isolate build environment for "BuildSources" nodes
This commit is contained in:
@@ -306,9 +306,6 @@ def ProcessTest(env):
|
|||||||
src_filter.append("+<%s%s>" % (env['PIOTEST'], sep))
|
src_filter.append("+<%s%s>" % (env['PIOTEST'], sep))
|
||||||
env.Replace(PIOTEST_SRC_FILTER=src_filter)
|
env.Replace(PIOTEST_SRC_FILTER=src_filter)
|
||||||
|
|
||||||
return env.CollectBuildFiles("$BUILDTEST_DIR", "$PROJECTTEST_DIR",
|
|
||||||
"$PIOTEST_SRC_FILTER")
|
|
||||||
|
|
||||||
|
|
||||||
def GetExtraScripts(env, scope):
|
def GetExtraScripts(env, scope):
|
||||||
items = []
|
items = []
|
||||||
|
@@ -43,33 +43,32 @@ def scons_patched_match_splitext(path, suffixes=None):
|
|||||||
|
|
||||||
def _build_project_deps(env):
|
def _build_project_deps(env):
|
||||||
deps = env.BuildProjectLibraries()
|
deps = env.BuildProjectLibraries()
|
||||||
srcnodes = None
|
# prepend dependent libs before built-in
|
||||||
if "__test" in COMMAND_LINE_TARGETS:
|
env.Prepend(LIBS=deps['LIBS'])
|
||||||
srcnodes = env.ProcessTest()
|
|
||||||
else:
|
|
||||||
srcnodes = env.CollectBuildFiles(
|
|
||||||
"$BUILDSRC_DIR",
|
|
||||||
"$PROJECTSRC_DIR",
|
|
||||||
src_filter=env.get("SRC_FILTER"))
|
|
||||||
|
|
||||||
projenv = env.Clone()
|
if "__test" in COMMAND_LINE_TARGETS:
|
||||||
Export("projenv")
|
env.ProcessTest()
|
||||||
|
projenv = env.Clone()
|
||||||
|
projenv.BuildSources("$BUILDTEST_DIR", "$PROJECTTEST_DIR",
|
||||||
|
"$PIOTEST_SRC_FILTER")
|
||||||
|
else:
|
||||||
|
projenv = env.Clone()
|
||||||
|
projenv.BuildSources("$BUILDSRC_DIR", "$PROJECTSRC_DIR",
|
||||||
|
env.get("SRC_FILTER"))
|
||||||
|
|
||||||
# CPPPATH from dependencies
|
# CPPPATH from dependencies
|
||||||
projenv.PrependUnique(CPPPATH=deps['CPPPATH'])
|
projenv.PrependUnique(CPPPATH=deps['CPPPATH'])
|
||||||
# extra build flags from `platformio.ini`
|
# extra build flags from `platformio.ini`
|
||||||
projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
|
projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
|
||||||
|
|
||||||
# prepend dependent libs before built-in
|
if not env.get("PIOBUILDFILES") and not COMMAND_LINE_TARGETS:
|
||||||
env.Prepend(
|
|
||||||
LIBS=deps['LIBS'], PIOBUILDFILES=[projenv.Object(n) for n in srcnodes])
|
|
||||||
|
|
||||||
if not env['PIOBUILDFILES'] and not COMMAND_LINE_TARGETS:
|
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
"Error: Nothing to build. Please put your source code files "
|
"Error: Nothing to build. Please put your source code files "
|
||||||
"to '%s' folder\n" % env.subst("$PROJECTSRC_DIR"))
|
"to '%s' folder\n" % env.subst("$PROJECTSRC_DIR"))
|
||||||
env.Exit(1)
|
env.Exit(1)
|
||||||
|
|
||||||
|
Export("projenv")
|
||||||
|
|
||||||
|
|
||||||
def BuildProgram(env):
|
def BuildProgram(env):
|
||||||
|
|
||||||
@@ -302,8 +301,9 @@ def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
|
|||||||
|
|
||||||
|
|
||||||
def BuildSources(env, variant_dir, src_dir, src_filter=None):
|
def BuildSources(env, variant_dir, src_dir, src_filter=None):
|
||||||
|
nodes = env.CollectBuildFiles(variant_dir, src_dir, src_filter)
|
||||||
DefaultEnvironment().Append(
|
DefaultEnvironment().Append(
|
||||||
PIOBUILDFILES=env.CollectBuildFiles(variant_dir, src_dir, src_filter))
|
PIOBUILDFILES=[env.Object(node) for node in nodes])
|
||||||
|
|
||||||
|
|
||||||
def exists(_):
|
def exists(_):
|
||||||
|
Reference in New Issue
Block a user