diff --git a/HISTORY.rst b/HISTORY.rst index 3b63d7a5..8d0e1d88 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,8 +4,9 @@ Release History 2.0.1 (2015-??-??) ------------------ -* Handle new environment variable +* Handle new environment variables `PLATFORMIO_BUILD_FLAGS `_ + and `PLATFORMIO_LDF_CYCLIC `_ * Pass to API requests information about Continuous Integration system. This information will be used by PlatformIO-API. * Use ``include`` directories from toolchain when initialising project for IDE diff --git a/docs/envvars.rst b/docs/envvars.rst index 1b6aa2e4..25414e27 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -77,6 +77,13 @@ PLATFORMIO_SRCBUILD_FLAGS Allows to set :ref:`projectconf` option :ref:`projectconf_srcbuild_flags`. +.. _envvar_PLATFORMIO_LDF_CYCLIC: + +PLATFORMIO_LDF_CYCLIC +~~~~~~~~~~~~~~~~~~~~~ + +Allows to set :ref:`projectconf` option :ref:`projectconf_ldf_cyclic`. + Settings -------- diff --git a/docs/projectconf.rst b/docs/projectconf.rst index 23f93c8b..8aba9efe 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -331,7 +331,7 @@ Example: ``use_libs`` ^^^^^^^^^^^^ -Specify libraries which should be used by ``Library Dependency Finder`` with +Specify libraries which should be used by ``Library Dependency Finder (LDF)`` with the highest priority. Example: @@ -344,7 +344,7 @@ Example: ``ignore_libs`` ^^^^^^^^^^^^^^^ -Specify libraries which should be ignored by ``Library Dependency Finder`` +Specify libraries which should be ignored by ``Library Dependency Finder (LDF)`` Example: @@ -353,6 +353,30 @@ Example: [env:ignore_some_libs] ignore_libs = SPI,EngduinoV3_ID123 +.. _projectconf_ldf_cyclic: + +``ldf_cyclic`` +^^^^^^^^^^^^^^ + +Control cyclic (recursive) behaviour for ``Library Dependency Finder (LDF)``. +By default, this option is turned OFF (``ldf_cyclic=False``) and means, that +``LDF`` will find only libraries which are included in source files from the +project :ref:`projectconf_pio_src_dir`. + +If you want to enable cyclic (recursive, nested) search, please set this option +to ``True``. Founded library will be treated like a new source files and +``LDF`` will search dependencies for it. + +This option can be set by global environment variable +:ref:`envvar_PLATFORMIO_LDF_CYCLIC`. + +Example: + +.. code-block:: ini + + [env:libs_with_enabled_ldf_cyclic] + ldf_cyclic = True + .. _projectconf_examples: diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 45ec63d6..4b07953e 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -38,6 +38,7 @@ commonvars.AddVariables( ("SRCBUILD_FLAGS",), ("IGNORE_LIBS",), ("USE_LIBS",), + ("LDF_CYCLIC",), # board options ("BOARD",), diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 7abd8b75..7eae3b34 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -278,7 +278,10 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914 len(state['ordered']) + 1, finder.getLibName(), _lib_dir)) state['libs'].add(_lib_dir) - state = _process_src_dir(state, _lib_dir) + + if getenv("PLATFORMIO_LDF_CYCLIC", + env.subst("$LDF_CYCLIC")).lower() == "true": + state = _process_src_dir(state, _lib_dir) return state # end internal prototypes