Fix an issue with incorrect order of project "include" and "src" paths in `CPPPATH` // Resolve #1914

This commit is contained in:
Ivan Kravets
2019-03-23 17:44:01 +02:00
parent e33b0fe291
commit 00b162608e
2 changed files with 8 additions and 3 deletions

View File

@ -13,6 +13,8 @@ PlatformIO 3.0
(`issue #2164 <https://github.com/platformio/platformio-core/issues/2164>`_)
* Fixed an error with conflicting declaration of a prototype (Arduino sketch preprocessor)
* Fixed "FileExistsError" when `platformio ci <https://docs.platformio.org/en/latest/userguide/cmd_ci.html>`__ command is used in pair with ``--keep-build-dir`` option
* Fixed an issue with incorrect order of project "include" and "src" paths in ``CPPPATH``
(`issue #1914 <https://github.com/platformio/platformio-core/issues/1914>`_)
3.6.5 (2019-03-07)
~~~~~~~~~~~~~~~~~~

View File

@ -177,10 +177,11 @@ class LibBuilderBase(object):
if isdir(join(self.path, "src")) else self.path)
def get_include_dirs(self):
items = [self.src_dir]
items = []
include_dir = self.include_dir
if include_dir and include_dir not in items:
items.append(include_dir)
items.append(self.src_dir)
return items
@property
@ -756,10 +757,11 @@ class ProjectAsLibBuilder(LibBuilderBase):
return self.env.subst("$PROJECTSRC_DIR")
def get_include_dirs(self):
include_dirs = LibBuilderBase.get_include_dirs(self)
include_dirs = []
project_include_dir = self.env.subst("$PROJECTINCLUDE_DIR")
if isdir(project_include_dir):
include_dirs.append(project_include_dir)
include_dirs.extend(LibBuilderBase.get_include_dirs(self))
return include_dirs
def get_search_files(self):
@ -827,8 +829,9 @@ class ProjectAsLibBuilder(LibBuilderBase):
def build(self):
self._is_built = True # do not build Project now
result = LibBuilderBase.build(self)
self.env.PrependUnique(CPPPATH=self.get_include_dirs())
return LibBuilderBase.build(self)
return result
def GetLibBuilders(env): # pylint: disable=too-many-branches