diff --git a/HISTORY.rst b/HISTORY.rst index b5fc4dc75c..ae20dadf0b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,6 +19,7 @@ PlatformIO 4.0 * Fixed an issue with incorrect escaping of Windows slashes when using `PIO Unified Debugger `__ 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 `_) +* Fixed an issue when `library.json `__ had priority over project configuration for `LDF `__ (`issue #2867 `_) 4.0.0 (2019-07-10) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index b0fd9470d8..1848cbf7fc 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -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 @@ -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): @@ -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): @@ -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")