Allow to specify libraries which are compatible with build environment using use_libs option in platformio.ini

This commit is contained in:
Ivan Kravets
2015-05-05 15:47:21 +01:00
parent 125c7b2aba
commit f001c087ec
5 changed files with 37 additions and 10 deletions

View File

@ -11,11 +11,17 @@ Release History
(`issue #174 <https://github.com/platformio/platformio/issues/174>`_) (`issue #174 <https://github.com/platformio/platformio/issues/174>`_)
* Added global ``-f, --force`` option which will force to accept any * Added global ``-f, --force`` option which will force to accept any
confirmation prompts (`issue #152 <https://github.com/platformio/platformio/issues/152>`_) confirmation prompts (`issue #152 <https://github.com/platformio/platformio/issues/152>`_)
* Added library dependencies using ``install_libs`` option in * Allowed to add library dependencies for build environment using
`platformio.ini <http://docs.platformio.org/en/latest/projectconf.html#install-libs>`__ `install_libs <http://docs.platformio.org/en/latest/projectconf.html#install-libs>`_
option in ``platformio.ini``
(`issue #134 <https://github.com/platformio/platformio/issues/134>`_) (`issue #134 <https://github.com/platformio/platformio/issues/134>`_)
* Allowed to add more boards to existing * Allowed to specify libraries which are compatible with build environment using
`platformio.ini <http://docs.platformio.org/en/latest/projectconf.html>`__ `use_libs <http://docs.platformio.org/en/latest/projectconf.html#use-libs>`_
option in ``platformio.ini``
(`issue #148 <https://github.com/platformio/platformio/issues/148>`_)
* Allowed to add more boards to PlatformIO project with
`platformio init --board <http://docs.platformio.org/en/latest/userguide/cmd_init.html#cmdoption--board>`__
command
(`issue #167 <https://github.com/platformio/platformio/issues/167>`_) (`issue #167 <https://github.com/platformio/platformio/issues/167>`_)
* Allowed to choose which library to update * Allowed to choose which library to update
(`issue #168 <https://github.com/platformio/platformio/issues/168>`_) (`issue #168 <https://github.com/platformio/platformio/issues/168>`_)
@ -45,8 +51,9 @@ Release History
1.6.3 version (`issue #156 <https://github.com/platformio/platformio/issues/156>`_) 1.6.3 version (`issue #156 <https://github.com/platformio/platformio/issues/156>`_)
* Upgraded `Energia Framework <http://docs.platformio.org/en/latest/frameworks/energia.html>`__ to * Upgraded `Energia Framework <http://docs.platformio.org/en/latest/frameworks/energia.html>`__ to
0101E0015 version (`issue #146 <https://github.com/platformio/platformio/issues/146>`_) 0101E0015 version (`issue #146 <https://github.com/platformio/platformio/issues/146>`_)
* Upgraded `Arduino Framework with Teensy Core <http://docs.platformio.org/en/latest/frameworks/arduino.html>`_ to * Upgraded `Arduino Framework with Teensy Core <http://docs.platformio.org/en/latest/frameworks/arduino.html>`_
1.22 version (`issue #162 <https://github.com/platformio/platformio/issues/162>`_, to 1.22 version
(`issue #162 <https://github.com/platformio/platformio/issues/162>`_,
`issue #170 <https://github.com/platformio/platformio/issues/170>`_) `issue #170 <https://github.com/platformio/platformio/issues/170>`_)
* Fixed exceptions with PlatformIO auto-updates when Internet connection isn't * Fixed exceptions with PlatformIO auto-updates when Internet connection isn't
active active

View File

@ -325,6 +325,19 @@ Example:
[env:depends_on_some_libs] [env:depends_on_some_libs]
install_libs = 1,13,19 install_libs = 1,13,19
``use_libs``
^^^^^^^^^^^^
Specify libraries which should be used by ``Library Dependency Finder`` with
the highest priority.
Example:
.. code-block:: ini
[env:libs_with_highest_priority]
use_libs = OneWire_ID1
``ignore_libs`` ``ignore_libs``
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^

View File

@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com> # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details. # See LICENSE for details.
VERSION = (2, 0, "0.dev3") VERSION = (2, 0, "0.dev4")
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -37,6 +37,7 @@ commonvars.AddVariables(
("BUILD_FLAGS",), ("BUILD_FLAGS",),
("SRCBUILD_FLAGS",), ("SRCBUILD_FLAGS",),
("IGNORE_LIBS",), ("IGNORE_LIBS",),
("USE_LIBS",),
# board options # board options
("BOARD",), ("BOARD",),

View File

@ -131,9 +131,11 @@ def BuildLibrary(env, variant_dir, library_dir, ignore_files=None):
def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914 def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
INCLUDES_RE = re.compile(r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")", INCLUDES_RE = re.compile(
re.M) r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")", re.M)
LIBSOURCE_DIRS = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])] LIBSOURCE_DIRS = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])]
USE_LIBS = [l.strip() for l in env.get("USE_LIBS", "").split(",")
if l.strip()]
# start internal prototypes # start internal prototypes
@ -174,7 +176,10 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
if not isdir(lsd_dir): if not isdir(lsd_dir):
continue continue
for ld in listdir(lsd_dir): for ld in USE_LIBS + listdir(lsd_dir):
if not isdir(join(lsd_dir, ld)):
continue
inc_path = normpath(join(lsd_dir, ld, self.name)) inc_path = normpath(join(lsd_dir, ld, self.name))
try: try:
lib_dir = inc_path[:inc_path.index( lib_dir = inc_path[:inc_path.index(
@ -205,6 +210,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
"libs": set(), "libs": set(),
"ordered": set() "ordered": set()
} }
state = _process_src_dir(state, env.subst(src_dir)) state = _process_src_dir(state, env.subst(src_dir))
result = [] result = []