Handle new environment variable PLATFORMIO_BUILD_FLAGS

This commit is contained in:
Ivan Kravets
2015-05-23 19:17:07 +03:00
parent 9560a665e5
commit 4f10047ba3
4 changed files with 26 additions and 15 deletions

View File

@ -4,6 +4,8 @@ Release History
2.0.1 (2015-??-??)
------------------
* Handle new environment variable
`PLATFORMIO_BUILD_FLAGS <http://docs.platformio.org/en/latest/envvars.html#platformio-build-flags>`_
* Pass to API requests information about Continuous Integration system. This
information will be used by PlatformIO-API.
* Fixed bug with converting ``*.ino`` to ``*.cpp``

View File

@ -36,44 +36,46 @@ In other words, ``CI=true`` automatically setup
PLATFORMIO_HOME_DIR
~~~~~~~~~~~~~~~~~~~
Allows to override :ref:`projectconf` option
:ref:`projectconf_pio_home_dir`.
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_home_dir`.
.. _envvar_PLATFORMIO_LIB_DIR:
PLATFORMIO_LIB_DIR
~~~~~~~~~~~~~~~~~~
Allows to override :ref:`projectconf` option
:ref:`projectconf_pio_lib_dir`.
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_lib_dir`.
.. _envvar_PLATFORMIO_SRC_DIR:
PLATFORMIO_SRC_DIR
~~~~~~~~~~~~~~~~~~
Allows to override :ref:`projectconf` option
:ref:`projectconf_pio_src_dir`.
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_src_dir`.
.. _envvar_PLATFORMIO_ENVS_DIR:
PLATFORMIO_ENVS_DIR
~~~~~~~~~~~~~~~~~~~
Allows to override :ref:`projectconf` option
:ref:`projectconf_pio_envs_dir`.
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`.
Builder
-------
.. _envvar_PLATFORMIO_BUILD_FLAGS:
PLATFORMIO_BUILD_FLAGS
~~~~~~~~~~~~~~~~~~~~~~
Allows to set :ref:`projectconf` option :ref:`projectconf_build_flags`.
.. _envvar_PLATFORMIO_SRCBUILD_FLAGS:
PLATFORMIO_SRCBUILD_FLAGS
~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to override :ref:`projectconf` option
:ref:`projectconf_srcbuild_flags`.
Allows to set :ref:`projectconf` option :ref:`projectconf_srcbuild_flags`.
Settings
--------

View File

@ -270,6 +270,9 @@ processes:
- Add the directory *dir* to the list of directories to be searched
for header files.
This option can be set by global environment variable
:ref:`envvar_PLATFORMIO_BUILD_FLAGS`.
Example:
.. code-block:: ini
@ -306,7 +309,7 @@ An option ``srcbuild_flags`` has the same behaviour like ``build_flags``
but will be applied only for the project source code from
:ref:`projectconf_pio_src_dir` directory.
This option can be overridden by global environment variable
This option can be set by global environment variable
:ref:`envvar_PLATFORMIO_SRCBUILD_FLAGS`.
``install_libs``

View File

@ -47,10 +47,11 @@ def BuildFirmware(env):
_LIBFLAGS=" -Wl,--end-group"
)
_srcbuild_flags = getenv("PLATFORMIO_SRCBUILD_FLAGS",
env.subst("$SRCBUILD_FLAGS"))
if _srcbuild_flags:
firmenv.MergeFlags(_srcbuild_flags)
# Handle SRCBUILD_FLAGS
if getenv("PLATFORMIO_SRCBUILD_FLAGS", None):
firmenv.MergeFlags(getenv("PLATFORMIO_SRCBUILD_FLAGS"))
if "SRCBUILD_FLAGS" in env:
firmenv.MergeFlags(env['SRCBUILD_FLAGS'])
firmenv.Append(
CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format(
@ -83,6 +84,9 @@ def ProcessFlags(env):
if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}"))
# Handle BUILD_FLAGS
if getenv("PLATFORMIO_BUILD_FLAGS", None):
env.MergeFlags(getenv("PLATFORMIO_BUILD_FLAGS"))
if "BUILD_FLAGS" in env:
env.MergeFlags(env['BUILD_FLAGS'])