From 5e6469596c8613c686e6d07eb9b3ac0c785e055b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 17 Sep 2016 23:46:53 +0300 Subject: [PATCH] Dynamic variables/templates for "platformio.ini" // Resolve #705 --- HISTORY.rst | 2 + docs/projectconf.rst | 80 ++++++++++++++++++++++++++++++++++++-- platformio/__init__.py | 2 +- platformio/commands/ci.py | 15 ++----- platformio/commands/run.py | 6 +-- platformio/exception.py | 5 --- platformio/util.py | 40 +++++++++++++++---- 7 files changed, 117 insertions(+), 33 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f3ba1727..73e959b2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 3.0 3.1.0 (2016-09-??) ~~~~~~~~~~~~~~~~~~ +* New! Dynamic variables/templates for `Project Configuration File "platformio.ini" `__ + (`issue #705 `_) * Implemented LocalCache system for API and improved a work in off-line mode * Improved Project Generator when custom ``--project-option`` is passed to `platformio init `__ diff --git a/docs/projectconf.rst b/docs/projectconf.rst index 7c31c9f5..14af3c7b 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -21,13 +21,73 @@ The Project configuration file is named ``platformio.ini``. This is a key / value pairs within the sections. Lines beginning with ``;`` are ignored and may be used to provide comments. -The sections and their allowable values are described below. +There are 2 system reserved sections: + +* Base PlatformIO settings: :ref:`projectconf_section_platformio` +* Build Environment settings: :ref:`projectconf_section_env` + +The other sections can be used by users, for example, for +:ref:`projectconf_dynamic_vars`. The sections and their allowable values are +described below. .. contents:: + :depth: 2 + +.. _projectconf_dynamic_vars: + +Dynamic variables +----------------- + +.. versionadded:: 3.1 + +Dynamic variables/templates are useful when you have common configuration data +between build environments. For examples, common :ref:`projectconf_build_flags` +or project dependencies :ref:`projectconf_lib_deps`. + +Each variable should have a next format: ``${
.