forked from platformio/platformio-core
New monitor target which allows to launch Serial Monitor automatically after successful “build” or “upload” operations // Resolve #788
This commit is contained in:
@ -23,6 +23,10 @@ PlatformIO 3.0
|
||||
* Custom ``test_transport`` for `PIO Unit Testing <http://docs.platformio.org/page/plus/unit-testing.html>`__ Engine
|
||||
* Configure Serial Port Monitor in `Project Configuration File "platformio.ini" <http://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #787 <https://github.com/platformio/platformio-core/issues/787>`_)
|
||||
* New `monitor <http://docs.platformio.org/page/userguide/cmd_run.html#cmdoption-platformio-run-t>`__
|
||||
target which allows to launch Serial Monitor automatically after successful
|
||||
"build" or "upload" operations
|
||||
(`issue #788 <https://github.com/platformio/platformio-core/issues/788>`_)
|
||||
* Project generator for `VIM <http://docs.platformio.org/page/ide/vim.html>`__
|
||||
* Multi-line support for the different options in `Project Configuration File "platformio.ini" <http://docs.platformio.org/page/projectconf.html>`__,
|
||||
such as: ``build_flags``, ``build_unflags``, etc.
|
||||
|
2
docs
2
docs
Submodule docs updated: 90756ec9f7...dd628f3e8e
@ -21,6 +21,7 @@ from time import time
|
||||
import click
|
||||
|
||||
from platformio import __version__, exception, telemetry, util
|
||||
from platformio.commands.device import device_monitor as cmd_device_monitor
|
||||
from platformio.commands.lib import lib_install as cmd_lib_install
|
||||
from platformio.commands.lib import get_builtin_libs
|
||||
from platformio.commands.platform import \
|
||||
@ -107,7 +108,11 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
||||
|
||||
ep = EnvironmentProcessor(ctx, envname, options, target,
|
||||
upload_port, silent, verbose)
|
||||
results.append((envname, ep.process()))
|
||||
result = (envname, ep.process())
|
||||
results.append(result)
|
||||
if result[1] and "monitor" in ep.get_build_targets() and \
|
||||
"nobuild" not in ep.get_build_targets():
|
||||
ctx.invoke(cmd_device_monitor)
|
||||
|
||||
found_error = any([status is False for (_, status) in results])
|
||||
|
||||
@ -226,7 +231,7 @@ class EnvironmentProcessor(object):
|
||||
result[k] = v
|
||||
return result
|
||||
|
||||
def _get_build_variables(self):
|
||||
def get_build_variables(self):
|
||||
variables = {"pioenv": self.name}
|
||||
if self.upload_port:
|
||||
variables['upload_port'] = self.upload_port
|
||||
@ -240,7 +245,7 @@ class EnvironmentProcessor(object):
|
||||
variables[k] = v
|
||||
return variables
|
||||
|
||||
def _get_build_targets(self):
|
||||
def get_build_targets(self):
|
||||
targets = []
|
||||
if self.targets:
|
||||
targets = [t for t in self.targets]
|
||||
@ -252,11 +257,14 @@ class EnvironmentProcessor(object):
|
||||
if "platform" not in self.options:
|
||||
raise exception.UndefinedEnvPlatform(self.name)
|
||||
|
||||
build_vars = self._get_build_variables()
|
||||
build_targets = self._get_build_targets()
|
||||
build_vars = self.get_build_variables()
|
||||
build_targets = self.get_build_targets()
|
||||
|
||||
telemetry.on_run_environment(self.options, build_targets)
|
||||
|
||||
# skip monitor target, we call it above
|
||||
if "monitor" in build_targets:
|
||||
build_targets.remove("monitor")
|
||||
if "nobuild" not in build_targets:
|
||||
# install dependent libraries
|
||||
if "lib_install" in self.options:
|
||||
|
Reference in New Issue
Block a user