forked from platformio/platformio-core
Implement "lib_extra_dirs" option for project environment // Resolve #537
This commit is contained in:
@ -17,6 +17,9 @@ PlatformIO 3.0
|
||||
C Preprocessor conditional macros, `library deep search <http://docs.platformio.org/en/latest/projectconf.html#lib-deep-search>`__, support for the 3rd party
|
||||
manifests (Arduino IDE ``library.properties``, ARM mbed ``module.json``)
|
||||
(`issue #432 <https://github.com/platformio/platformio/issues/432>`_)
|
||||
* New `lib_extra_dirs <http://docs.platformio.org/en/latest/projectconf.html#lib-extra-dirs>`__ option for project environment.
|
||||
Multiple custom library locations!
|
||||
(`issue #537 <https://github.com/platformio/platformio/issues/537>`_)
|
||||
* Handle extra build flags and build script from
|
||||
`library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
||||
(`issue #289 <https://github.com/platformio/platformio/issues/289>`_)
|
||||
|
@ -107,6 +107,10 @@ Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`.
|
||||
|
||||
Allows to set :ref:`projectconf` option :ref:`projectconf_extra_script`.
|
||||
|
||||
.. envvar:: PLATFORMIO_LIB_EXTRA_DIRS
|
||||
|
||||
Allows to set :ref:`projectconf` option :ref:`projectconf_lib_extra_dirs`.
|
||||
|
||||
|
||||
Uploading
|
||||
---------
|
||||
|
@ -681,6 +681,30 @@ For example, there are 2 libraries:
|
||||
Secondly, it will parse all sources from "Bar" library and this operation
|
||||
continues until all dependent libraries will not be parsed.
|
||||
|
||||
.. _projectconf_lib_extra_dirs:
|
||||
|
||||
``lib_extra_dirs``
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A list with extra directories where ``Library Dependency Finder (LDF)`` will
|
||||
look for dependencies. Multiple paths are allowed. Please separate them using
|
||||
comma ``,`` symbol.
|
||||
|
||||
This option can be set by global environment variable
|
||||
:envvar:`PLATFORMIO_LIB_EXTRA_DIRS`.
|
||||
|
||||
.. warning::
|
||||
This is a not direct path to library with source code. It should be the path
|
||||
to directory that contains libraries grouped by folders. For example,
|
||||
``/extra/lib/path/`` but not ``/extra/lib/path/MyLibrary``.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[env:custom_lib_dirs]
|
||||
lib_extra_dirs = /path/to/private/dir1,/path/to/private/dir2
|
||||
|
||||
-----------
|
||||
|
||||
.. _projectconf_examples:
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import sys
|
||||
|
||||
VERSION = (3, 0, "0.dev6")
|
||||
VERSION = (3, 0, "0.dev7")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -34,16 +34,19 @@ commonvars.AddVariables(
|
||||
("PIOENV",),
|
||||
("PIOTEST",),
|
||||
("PLATFORM",),
|
||||
|
||||
# options
|
||||
("FRAMEWORK",),
|
||||
|
||||
# build options
|
||||
("BUILD_FLAGS",),
|
||||
("SRC_BUILD_FLAGS",),
|
||||
("BUILD_UNFLAGS",),
|
||||
("SRC_FILTER",),
|
||||
|
||||
# library options
|
||||
("LIB_DEEP_SEARCH",),
|
||||
("LIB_IGNORE",),
|
||||
("LIB_FORCE",),
|
||||
("LIB_EXTRA_DIRS",),
|
||||
|
||||
# board options
|
||||
("BOARD",),
|
||||
@ -101,21 +104,20 @@ for k in commonvars.keys():
|
||||
if k in env:
|
||||
env[k] = base64.b64decode(env[k])
|
||||
|
||||
env.LoadDevPlatform(commonvars)
|
||||
|
||||
# Parse library names
|
||||
for opt in ("LIB_IGNORE", "LIB_FORCE"):
|
||||
if opt not in env:
|
||||
continue
|
||||
env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()]
|
||||
|
||||
# Handle custom variables from system environment
|
||||
for var in ("BUILD_FLAGS", "SRC_BUILD_FLAGS", "SRC_FILTER", "EXTRA_SCRIPT",
|
||||
"UPLOAD_PORT", "UPLOAD_FLAGS"):
|
||||
"UPLOAD_PORT", "UPLOAD_FLAGS", "LIB_EXTRA_DIRS"):
|
||||
k = "PLATFORMIO_%s" % var
|
||||
if environ.get(k):
|
||||
env[var] = environ.get(k)
|
||||
|
||||
# Parse comma separated items
|
||||
for opt in ("LIB_IGNORE", "LIB_FORCE", "LIB_EXTRA_DIRS"):
|
||||
if opt not in env:
|
||||
continue
|
||||
env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()]
|
||||
|
||||
env.LoadDevPlatform(commonvars)
|
||||
|
||||
env.SConscriptChdir(0)
|
||||
env.SConsignFile(join("$PIOENVS_DIR", ".sconsign.dblite"))
|
||||
|
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=no-member
|
||||
# pylint: disable=no-member, no-self-use, unused-argument
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
@ -130,7 +130,7 @@ class LibBuilderBase(object):
|
||||
def is_framework_compatible(self, framework):
|
||||
return True
|
||||
|
||||
def load_manifest(self): # pylint: disable=no-self-use
|
||||
def load_manifest(self):
|
||||
return {}
|
||||
|
||||
def get_path_dirs(self, use_build_dir=False):
|
||||
@ -326,10 +326,16 @@ def find_and_build_deps(env, lib_builders, scanner,
|
||||
|
||||
def GetLibBuilders(env):
|
||||
items = []
|
||||
libs_dirs = []
|
||||
env_frameworks = [
|
||||
f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")]
|
||||
libs_dirs = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])
|
||||
if isdir(env.subst(d))]
|
||||
|
||||
for key in ("LIB_EXTRA_DIRS", "LIBSOURCE_DIRS"):
|
||||
for d in env.get(key, []):
|
||||
d = env.subst(d)
|
||||
if isdir(d):
|
||||
libs_dirs.append(d)
|
||||
|
||||
for libs_dir in libs_dirs:
|
||||
for item in sorted(os.listdir(libs_dir)):
|
||||
if item == "__cores__" or not isdir(join(libs_dir, item)):
|
||||
|
Reference in New Issue
Block a user