From ea30d94324504cb0e8a3a521fddc14624cf90a3a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 21 Jul 2020 12:41:38 +0300 Subject: [PATCH] =?UTF-8?q?Automatically=20enable=20LDF=20dependency=20cha?= =?UTF-8?q?in+=20mode=20(evaluates=20C/C++=20Preprocessor=20conditional=20?= =?UTF-8?q?syntax)=20for=20Arduino=20library=20when=20=E2=80=9Clibrary.pro?= =?UTF-8?q?perties=E2=80=9D=20has=20=E2=80=9Cdepends=E2=80=9D=20field=20//?= =?UTF-8?q?=20Resolve=20#3607?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 1 + docs | 2 +- platformio/builder/tools/piolib.py | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 43898869..8a2d423f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -35,6 +35,7 @@ PlatformIO Core 4 * Added a new ``-e, --environment`` option to `platformio project init `__ command that helps to update a PlatformIO project using existing environment * Dump data intended for IDE extensions/plugins using a new `platformio project idedata `__ command * Do not generate ".travis.yml" for a new project, let the user have a choice +* Automatically enable LDF dependency `chain+ mode (evaluates C/C++ Preprocessor conditional syntax) `__ for Arduino library when "library.property" has "depends" field (`issue #3607 `_) * Fixed an issue with PIO Unit Testing when running multiple environments (`issue #3523 `_) * Fixed an issue with improper processing of source files added via multiple Build Middlewares (`issue #3531 `_) * Fixed an issue with ``clean`` target on Windows when project and build directories are located on different logical drives (`issue #3542 `_) diff --git a/docs b/docs index 0ed8c2da..922f89a0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 0ed8c2da4db1952f027fb980045d37dc194614c4 +Subproject commit 922f89a0d4c8e18f5f67d745826953ce2193d6b8 diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 3aa6b36d..6f832382 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -507,6 +507,26 @@ class ArduinoLibBuilder(LibBuilderBase): src_filter.append("+" % (sep, ext)) return src_filter + @property + def dependencies(self): + # do not include automatically all libraries for build + # chain+ will decide later + return None + + @property + def lib_ldf_mode(self): + if not self._manifest.get("dependencies"): + return LibBuilderBase.lib_ldf_mode.fget(self) + missing = object() + global_value = self.env.GetProjectConfig().getraw( + "env:" + self.env["PIOENV"], "lib_ldf_mode", missing + ) + if global_value != missing: + return LibBuilderBase.lib_ldf_mode.fget(self) + # automatically enable C++ Preprocessing in runtime + # (Arduino IDE has this behavior) + return "chain+" + def is_frameworks_compatible(self, frameworks): return util.items_in_list(frameworks, ["arduino", "energia"])