Fixed an issue when library.json had priority over project configuration for LDF // Resolve #2867

This commit is contained in:
Ivan Kravets
2019-08-19 15:54:07 +03:00
parent a33fd6de27
commit 42ee6fe96e
2 changed files with 30 additions and 26 deletions

View File

@ -19,6 +19,7 @@ PlatformIO 4.0
* Fixed an issue with incorrect escaping of Windows slashes when using `PIO Unified Debugger <http://docs.platformio.org/page/plus/debugging.html>`__ and "piped" openOCD * Fixed an issue with incorrect escaping of Windows slashes when using `PIO Unified Debugger <http://docs.platformio.org/page/plus/debugging.html>`__ and "piped" openOCD
* Fixed an issue when "debug", "home", "run", and "test" commands were not shown in "platformio --help" CLI * Fixed an issue when "debug", "home", "run", and "test" commands were not shown in "platformio --help" CLI
* Fixed an issue with PIO Home's "No JSON object could be decoded" (`issue #2823 <https://github.com/platformio/platformio-core/issues/2823>`_) * Fixed an issue with PIO Home's "No JSON object could be decoded" (`issue #2823 <https://github.com/platformio/platformio-core/issues/2823>`_)
* Fixed an issue when `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__ had priority over project configuration for `LDF <http://docs.platformio.org/page/librarymanager/ldf.html>`__ (`issue #2867 <https://github.com/platformio/platformio-core/issues/2867>`_)
4.0.0 (2019-07-10) 4.0.0 (2019-07-10)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -200,21 +200,6 @@ class LibBuilderBase(object):
def extra_script(self): def extra_script(self):
return None return None
@property
def lib_archive(self):
return self.env.GetProjectOption("lib_archive", True)
@property
def lib_ldf_mode(self):
return self.validate_ldf_mode(
self.env.GetProjectOption("lib_ldf_mode", self.LDF_MODE_DEFAULT))
@property
def lib_compat_mode(self):
return self.validate_compat_mode(
self.env.GetProjectOption("lib_compat_mode",
self.COMPAT_MODE_DEFAULT))
@property @property
def depbuilders(self): def depbuilders(self):
return self._depbuilders return self._depbuilders
@ -227,6 +212,14 @@ class LibBuilderBase(object):
def is_built(self): def is_built(self):
return self._is_built return self._is_built
@property
def lib_archive(self):
return self.env.GetProjectOption("lib_archive", True)
@property
def lib_ldf_mode(self):
return self.env.GetProjectOption("lib_ldf_mode", self.LDF_MODE_DEFAULT)
@staticmethod @staticmethod
def validate_ldf_mode(mode): def validate_ldf_mode(mode):
if isinstance(mode, string_types): if isinstance(mode, string_types):
@ -239,6 +232,11 @@ class LibBuilderBase(object):
pass pass
return LibBuilderBase.LDF_MODE_DEFAULT return LibBuilderBase.LDF_MODE_DEFAULT
@property
def lib_compat_mode(self):
return self.env.GetProjectOption("lib_compat_mode",
self.COMPAT_MODE_DEFAULT)
@staticmethod @staticmethod
def validate_compat_mode(mode): def validate_compat_mode(mode):
if isinstance(mode, string_types): if isinstance(mode, string_types):
@ -741,23 +739,28 @@ class PlatformIOLibBuilder(LibBuilderBase):
@property @property
def lib_archive(self): def lib_archive(self):
if "libArchive" in self._manifest.get("build", {}): global_value = self.env.GetProjectOption("lib_archive")
return self._manifest.get("build").get("libArchive") if global_value is not None:
return LibBuilderBase.lib_archive.fget(self) return global_value
return self._manifest.get("build", {}).get(
"libArchive", LibBuilderBase.lib_archive.fget(self))
@property @property
def lib_ldf_mode(self): def lib_ldf_mode(self):
if "libLDFMode" in self._manifest.get("build", {}): return self.validate_ldf_mode(
return self.validate_ldf_mode( self.env.GetProjectOption(
self._manifest.get("build").get("libLDFMode")) "lib_ldf_mode",
return LibBuilderBase.lib_ldf_mode.fget(self) self._manifest.get("build", {}).get(
"libLDFMode", LibBuilderBase.lib_ldf_mode.fget(self))))
@property @property
def lib_compat_mode(self): def lib_compat_mode(self):
if "libCompatMode" in self._manifest.get("build", {}): return self.validate_ldf_mode(
return self.validate_compat_mode( self.env.GetProjectOption(
self._manifest.get("build").get("libCompatMode")) "lib_compat_mode",
return LibBuilderBase.lib_compat_mode.fget(self) self._manifest.get("build", {}).get(
"libCompatMode",
LibBuilderBase.lib_compat_mode.fget(self))))
def is_platforms_compatible(self, platforms): def is_platforms_compatible(self, platforms):
items = self._manifest.get("platforms") items = self._manifest.get("platforms")