Merge branch 'hotfix/v3.5.4' into develop

* hotfix/v3.5.4:
  Improve removing of default build flags using `build_unflags` option // Resolve #1712
  Export ``LIBS``, ``LIBPATH``, and ``LINKFLAGS`` data from project dependent libraries to the global build environment
  Replace "env" pattern by "sysenv" in "platformio.ini" // Resolve #1705
This commit is contained in:
Ivan Kravets
2018-06-30 19:36:02 +03:00
5 changed files with 42 additions and 12 deletions

View File

@ -18,10 +18,17 @@ PlatformIO 3.0
3.5.4 (2018-??-??)
~~~~~~~~~~~~~~~~~~
* Don't export ``CPPPATH`` of project dependent libraries to frameworks
* Improved removing of default build flags using `build_unflags <http://docs.platformio.org/page/projectconf/section_env_build.html#build-unflags>`__ option
(`issue #1712 <https://github.com/platformio/platformio-core/issues/1712>`_)
* Export ``LIBS``, ``LIBPATH``, and ``LINKFLAGS`` data from project dependent
libraries to the global build environment
* Don't export ``CPPPATH`` data of project dependent libraries to framework's
build environment
(`issue #1665 <https://github.com/platformio/platformio-core/issues/1665>`_)
* Handle "architectures" data from "library.properties" manifest in
`lib_compat_mode = strict <http://docs.platformio.org/en/page/librarymanager/ldf.html#compatibility-mode>`__
* Replaced conflicted "env" pattern by "sysenv" for `"platformio.ini" Dynamic Variables" <http://docs.platformio.org/page/projectconf/dynamic_variables.html>`__
(`issue #1705 <https://github.com/platformio/platformio-core/issues/1705>`_)
* Removed "date&time" when processing project with `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__ command
(`issue #1343 <https://github.com/platformio/platformio-core/issues/1343>`_)
* Fixed issue with invalid LD script if path contains space

2
docs

Submodule docs updated: 7b0030fc04...ae2968e52a

View File

@ -824,7 +824,7 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches
return items
def BuildProjectLibraries(env):
def ConfigureProjectLibBuilder(env):
def correct_found_libs(lib_builders):
# build full dependency graph
@ -879,8 +879,7 @@ def BuildProjectLibraries(env):
else:
print "No dependencies"
libs = project.build()
return dict(LIBS=libs, CPPPATH=project.env.get("CPPPATH"))
return project
def exists(_):
@ -889,5 +888,5 @@ def exists(_):
def generate(env):
env.AddMethod(GetLibBuilders)
env.AddMethod(BuildProjectLibraries)
env.AddMethod(ConfigureProjectLibBuilder)
return env

View File

@ -42,9 +42,16 @@ def scons_patched_match_splitext(path, suffixes=None):
def _build_project_deps(env):
deps = env.BuildProjectLibraries()
# prepend dependent libs before built-in
env.Prepend(LIBS=deps['LIBS'])
project_lib_builder = env.ConfigureProjectLibBuilder()
# append project libs to the beginning of list
env.Prepend(LIBS=project_lib_builder.build())
# append extra linker related options from libs
env.AppendUnique(
**{
key: project_lib_builder.env.get(key)
for key in ("LIBS", "LIBPATH", "LINKFLAGS")
})
if "__test" in COMMAND_LINE_TARGETS:
env.ProcessTest()
@ -57,7 +64,7 @@ def _build_project_deps(env):
env.get("SRC_FILTER"))
# CPPPATH from dependencies
projenv.PrependUnique(CPPPATH=deps['CPPPATH'])
projenv.PrependUnique(CPPPATH=project_lib_builder.env.get("CPPPATH"))
# extra build flags from `platformio.ini`
projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
@ -184,7 +191,18 @@ def ProcessFlags(env, flags): # pylint: disable=too-many-branches
def ProcessUnFlags(env, flags):
if not flags:
return
for key, unflags in env.ParseFlagsExtended(flags).items():
parsed = env.ParseFlagsExtended(flags)
# get all flags and copy them to each "*FLAGS" variable
all_flags = []
for key, unflags in parsed.items():
if key.endswith("FLAGS"):
all_flags.extend(unflags)
for key, unflags in parsed.items():
if key.endswith("FLAGS"):
parsed[key].extend(all_flags)
for key, unflags in parsed.items():
for unflag in unflags:
for current in env.get(key, []):
conditions = [

View File

@ -63,7 +63,13 @@ class ProjectConfig(ConfigParser.ConfigParser):
def _re_sub_handler(self, match):
section, option = match.group(1), match.group(2)
if section == "env" and not self.has_section(section):
if section in ("env", "sysenv") and not self.has_section(section):
if section == "env":
click.secho(
"Warning! Access to system environment variable via "
"`${{env.{0}}}` is deprecated. Please use "
"`${{sysenv.{0}}}` instead".format(option),
fg="yellow")
return os.getenv(option)
return self.get(section, option)