Override default development platform upload command with a custom // Resolve #2599

This commit is contained in:
Ivan Kravets
2019-06-01 14:36:07 +03:00
parent d25f1ddc21
commit c038074489
5 changed files with 8 additions and 1 deletions

View File

@ -18,6 +18,7 @@ PlatformIO 4.0
- Custom project ``***_dir`` options declared in `platformio <http://docs.platformio.org/page/projectconf/section_platformio.html>`__ section have higher priority than `Environment variables <http://docs.platformio.org/page/envvars.html>`__
- Added support for Unix shell-style wildcards for `monitor_port <http://docs.platformio.org/page/projectconf/section_env_monitor.html#monitor-port>`__ option (`issue #2541 <https://github.com/platformio/platformio-core/issues/2541>`_)
- Added new `monitor_flags <http://docs.platformio.org/page/projectconf/section_env_monitor.html#monitor-flags>`__ option which allows passing extra flags and options to `platformio device monitor <http://docs.platformio.org/page/userguide/cmd_device.html#cmd-device-monitor>`__ command (`issue #2165 <https://github.com/platformio/platformio-core/issues/2165>`_)
- Override default development platform upload command with a custom `upload_command <http://docs.platformio.org/page/projectconf/section_env_upload.html#upload-command>`__ (`issue #2599 <https://github.com/platformio/platformio-core/issues/2599>`_)
- Fixed an issue when ``-U`` in ``build_flags`` does not remove macro previously defined via ``-D`` flag (`issue #2508 <https://github.com/platformio/platformio-core/issues/2508>`_)
* **Library Management**

2
docs

Submodule docs updated: c9023fb4dc...c030b967a5

View File

@ -60,6 +60,7 @@ DEFAULT_ENV_OPTIONS = dict(
UNIX_TIME=int(time()),
PROJECT_DIR=project_helpers.get_project_dir(),
PROJECTCORE_DIR=project_helpers.get_project_core_dir(),
PROJECTPACKAGES_DIR=project_helpers.get_project_packages_dir(),
PROJECTWORKSPACE_DIR=project_helpers.get_project_workspace_dir(),
PROJECTLIBDEPS_DIR=project_helpers.get_project_libdeps_dir(),
PROJECTINCLUDE_DIR=project_helpers.get_project_include_dir(),
@ -118,6 +119,8 @@ env.SConscript("$BUILD_SCRIPT")
if "UPLOAD_FLAGS" in env:
env.Prepend(UPLOADERFLAGS=["$UPLOAD_FLAGS"])
if env.GetProjectOption("upload_command"):
env.Replace(UPLOADCMD=env.GetProjectOption("upload_command"))
for item in env.GetExtraScripts("post"):
env.SConscript(item, exports="env")

View File

@ -278,6 +278,8 @@ class ProjectConfig(object):
for name in option.oldnames})
for section in self._parser.sections():
if not section.startswith("env:") or section != "platformio":
continue
for option in self._parser.options(section):
# obsolete
if option in renamed_options:

View File

@ -140,6 +140,7 @@ ProjectOptions = OrderedDict([
buildenvvar="UPLOAD_FLAGS"),
ConfigEnvOption(name="upload_resetmethod",
buildenvvar="UPLOAD_RESETMETHOD"),
ConfigEnvOption(name="upload_command", buildenvvar="UPLOADCMD"),
# Monitor
ConfigEnvOption(name="monitor_port"),