From 94e580bf4ecd8b3019aa86987526e893d5b82c2f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 4 May 2019 13:36:27 +0300 Subject: [PATCH] Override default source and include directories for a library via "library.json" manifest using "includeDir" and "srcDir" fields --- HISTORY.rst | 5 +++-- docs | 2 +- platformio/builder/tools/piolib.py | 12 ++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index bd899a08..0ce2bb74 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,8 +9,9 @@ PlatformIO 4.0 * Python 3 support (`issue #895 `_) -* Include external configuration files with "extra_configs" option +* Include external configuration files with `extra_configs `__ option (`issue #1590 `_) +* Override default source and include directories for a library via `library.json `__ manifest using ``includeDir`` and ``srcDir`` fields PlatformIO 3.0 -------------- @@ -18,7 +19,7 @@ PlatformIO 3.0 3.6.8 (2019-??-??) ~~~~~~~~~~~~~~~~~~ -* Fixed "systemd-udevd" warnings in `99-platformio-udev.rules `__ +* Fixed "systemd-udevd" warnings in `99-platformio-udev.rules `__ (`issue #2442 `_) 3.6.7 (2019-04-23) diff --git a/docs b/docs index 9a51b847..570187b4 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9a51b847424c85444f4b9c38efad9d83f72353be +Subproject commit 570187b4afdf8295880cd37177596e023df4d117 diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 221df7e8..54961eb0 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -719,6 +719,18 @@ class PlatformIOLibBuilder(LibBuilderBase): def _is_arduino_manifest(self): return isfile(join(self.path, "library.properties")) + @property + def include_dir(self): + if "includeDir" in self._manifest.get("build", {}): + return self._manifest.get("build").get("includeDir") + return LibBuilderBase.include_dir.fget(self) + + @property + def src_dir(self): + if "srcDir" in self._manifest.get("build", {}): + return self._manifest.get("build").get("srcDir") + return LibBuilderBase.src_dir.fget(self) + @property def src_filter(self): if "srcFilter" in self._manifest.get("build", {}):