Skip to content

Commit

Permalink
Fixed an issue when library.json had priority over project configur…
Browse files Browse the repository at this point in the history
…ation for LDF // Resolve #2867
  • Loading branch information
ivankravets committed Aug 19, 2019
1 parent a33fd6d commit 42ee6fe
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 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)
~~~~~~~~~~~~~~~~~~
Expand Down
55 changes: 29 additions & 26 deletions platformio/builder/tools/piolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,6 @@ def build_unflags(self):
def extra_script(self):
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
def depbuilders(self):
return self._depbuilders
Expand All @@ -227,6 +212,14 @@ def dependent(self):
def is_built(self):
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
def validate_ldf_mode(mode):
if isinstance(mode, string_types):
Expand All @@ -239,6 +232,11 @@ def validate_ldf_mode(mode):
pass
return LibBuilderBase.LDF_MODE_DEFAULT

@property
def lib_compat_mode(self):
return self.env.GetProjectOption("lib_compat_mode",
self.COMPAT_MODE_DEFAULT)

@staticmethod
def validate_compat_mode(mode):
if isinstance(mode, string_types):
Expand Down Expand Up @@ -741,23 +739,28 @@ def extra_script(self):

@property
def lib_archive(self):
if "libArchive" in self._manifest.get("build", {}):
return self._manifest.get("build").get("libArchive")
return LibBuilderBase.lib_archive.fget(self)
global_value = self.env.GetProjectOption("lib_archive")
if global_value is not None:
return global_value
return self._manifest.get("build", {}).get(
"libArchive", LibBuilderBase.lib_archive.fget(self))

@property
def lib_ldf_mode(self):
if "libLDFMode" in self._manifest.get("build", {}):
return self.validate_ldf_mode(
self._manifest.get("build").get("libLDFMode"))
return LibBuilderBase.lib_ldf_mode.fget(self)
return self.validate_ldf_mode(
self.env.GetProjectOption(
"lib_ldf_mode",
self._manifest.get("build", {}).get(
"libLDFMode", LibBuilderBase.lib_ldf_mode.fget(self))))

@property
def lib_compat_mode(self):
if "libCompatMode" in self._manifest.get("build", {}):
return self.validate_compat_mode(
self._manifest.get("build").get("libCompatMode"))
return LibBuilderBase.lib_compat_mode.fget(self)
return self.validate_ldf_mode(
self.env.GetProjectOption(
"lib_compat_mode",
self._manifest.get("build", {}).get(
"libCompatMode",
LibBuilderBase.lib_compat_mode.fget(self))))

def is_platforms_compatible(self, platforms):
items = self._manifest.get("platforms")
Expand Down

0 comments on commit 42ee6fe

Please sign in to comment.