Fixed an issue with project generator when `src_build_flags` were not respected // Resolve #3137

This commit is contained in:
Ivan Kravets
2019-10-24 16:39:11 +03:00
parent 2388b2a62b
commit 234585dc97
4 changed files with 10 additions and 9 deletions

View File

@@ -27,6 +27,7 @@ PlatformIO Core 4.0
* Fixed an issue when installing a package using custom Git tag and submodules were not updated correctly (`issue #3060 <https://github.com/platformio/platformio-core/issues/3060>`_) * Fixed an issue when installing a package using custom Git tag and submodules were not updated correctly (`issue #3060 <https://github.com/platformio/platformio-core/issues/3060>`_)
* Fixed an issue with linking process when ``$LDSCRIPT`` contains a space in path * Fixed an issue with linking process when ``$LDSCRIPT`` contains a space in path
* Fixed security issue when extracting items from TAR archive (`issue #2995 <https://github.com/platformio/platformio-core/issues/2995>`_) * Fixed security issue when extracting items from TAR archive (`issue #2995 <https://github.com/platformio/platformio-core/issues/2995>`_)
* Fixed an issue with project generator when ``src_build_flags`` were not respected (`issue #3137 <https://github.com/platformio/platformio-core/issues/3137>`_)
4.0.3 (2019-08-30) 4.0.3 (2019-08-30)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@@ -189,7 +189,7 @@ if "idedata" in COMMAND_LINE_TARGETS:
print ( print (
"\n%s\n" "\n%s\n"
% dump_json_to_unicode( % dump_json_to_unicode(
env.DumpIDEData(projenv) # pylint: disable=undefined-variable projenv.DumpIDEData() # pylint: disable=undefined-variable
) )
) )
env.Exit(0) env.Exit(0)

View File

@@ -25,11 +25,11 @@ from platformio.managers.core import get_core_package_dir
from platformio.proc import exec_command, where_is_program from platformio.proc import exec_command, where_is_program
def _dump_includes(env, projenv): def _dump_includes(env):
includes = [] includes = []
for item in projenv.get("CPPPATH", []): for item in env.get("CPPPATH", []):
includes.append(projenv.subst(item)) includes.append(env.subst(item))
# installed libs # installed libs
for lb in env.GetLibBuilders(): for lb in env.GetLibBuilders():
@@ -138,7 +138,7 @@ def _get_svd_path(env):
return None return None
def DumpIDEData(env, projenv): def DumpIDEData(env):
LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS" LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS"
LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS" LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS"
@@ -146,7 +146,7 @@ def DumpIDEData(env, projenv):
"env_name": env["PIOENV"], "env_name": env["PIOENV"],
"libsource_dirs": [env.subst(l) for l in env.GetLibSourceDirs()], "libsource_dirs": [env.subst(l) for l in env.GetLibSourceDirs()],
"defines": _dump_defines(env), "defines": _dump_defines(env),
"includes": _dump_includes(env, projenv), "includes": _dump_includes(env),
"cc_flags": env.subst(LINTCCOM), "cc_flags": env.subst(LINTCCOM),
"cxx_flags": env.subst(LINTCXXCOM), "cxx_flags": env.subst(LINTCXXCOM),
"cc_path": where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")), "cc_path": where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),

View File

@@ -124,9 +124,6 @@ def BuildProgram(env):
if "__test" in COMMAND_LINE_TARGETS: if "__test" in COMMAND_LINE_TARGETS:
env.ConfigureTestTarget() env.ConfigureTestTarget()
# build project with dependencies
_build_project_deps(env)
# append into the beginning a main LD script # append into the beginning a main LD script
if env.get("LDSCRIPT_PATH") and not any("-Wl,-T" in f for f in env["LINKFLAGS"]): if env.get("LDSCRIPT_PATH") and not any("-Wl,-T" in f for f in env["LINKFLAGS"]):
env.Prepend(LINKFLAGS=["-T", env.subst("$LDSCRIPT_PATH")]) env.Prepend(LINKFLAGS=["-T", env.subst("$LDSCRIPT_PATH")])
@@ -136,6 +133,9 @@ def BuildProgram(env):
env.Prepend(_LIBFLAGS="-Wl,--start-group ") env.Prepend(_LIBFLAGS="-Wl,--start-group ")
env.Append(_LIBFLAGS=" -Wl,--end-group") env.Append(_LIBFLAGS=" -Wl,--end-group")
# build project with dependencies
_build_project_deps(env)
program = env.Program( program = env.Program(
os.path.join("$BUILD_DIR", env.subst("$PROGNAME")), env["PIOBUILDFILES"] os.path.join("$BUILD_DIR", env.subst("$PROGNAME")), env["PIOBUILDFILES"]
) )