mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Print human-readable information when processing environments without // Resolve #721
This commit is contained in:
@ -25,6 +25,9 @@ PlatformIO 3.0
|
|||||||
(`issue #289 <https://github.com/platformio/platformio/issues/289>`_)
|
(`issue #289 <https://github.com/platformio/platformio/issues/289>`_)
|
||||||
* Check library compatibility with project environment before building
|
* Check library compatibility with project environment before building
|
||||||
(`issue #415 <https://github.com/platformio/platformio/issues/415>`_)
|
(`issue #415 <https://github.com/platformio/platformio/issues/415>`_)
|
||||||
|
* Print human-readable information when processing environments without
|
||||||
|
``-v, --verbose`` option
|
||||||
|
(`issue #721 <https://github.com/platformio/platformio/issues/721>`_)
|
||||||
* Added ``license`` field to `library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
* Added ``license`` field to `library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
||||||
(`issue #522 <https://github.com/platformio/platformio/issues/522>`_)
|
(`issue #522 <https://github.com/platformio/platformio/issues/522>`_)
|
||||||
* Show detailed build information about dependent libraries
|
* Show detailed build information about dependent libraries
|
||||||
|
@ -157,3 +157,7 @@ Allows to override setting :ref:`setting_enable_prompts`.
|
|||||||
.. envvar:: PLATFORMIO_SETTING_ENABLE_TELEMETRY
|
.. envvar:: PLATFORMIO_SETTING_ENABLE_TELEMETRY
|
||||||
|
|
||||||
Allows to override setting :ref:`setting_enable_telemetry`.
|
Allows to override setting :ref:`setting_enable_telemetry`.
|
||||||
|
|
||||||
|
.. envvar:: PLATFORMIO_SETTING_FORCE_VERBOSE
|
||||||
|
|
||||||
|
Allows to override setting :ref:`setting_force_verbose`.
|
||||||
|
@ -112,8 +112,10 @@ Buid project using pre-configured :ref:`projectconf`.
|
|||||||
.. option::
|
.. option::
|
||||||
-v, --verbose
|
-v, --verbose
|
||||||
|
|
||||||
Shows details about the results of processing environments. More details
|
Shows detailed information when processing environments.
|
||||||
:option:`platformio run --verbose`
|
|
||||||
|
This option can be set globally using :ref:`setting_force_verbose` setting
|
||||||
|
or by environment variable :envvar:`PLATFORMIO_SETTING_FORCE_VERBOSE`.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
|
@ -77,17 +77,10 @@ to current working directory (``CWD``).
|
|||||||
.. option::
|
.. option::
|
||||||
-v, --verbose
|
-v, --verbose
|
||||||
|
|
||||||
Shows details about the results of processing environments. Each instance of
|
Shows detailed information when processing environments.
|
||||||
``--verbose`` on the command line increases the verbosity level by one, so if
|
|
||||||
you need more details on the output, specify it twice.
|
|
||||||
|
|
||||||
There 3 levels of verbosity:
|
This option can be set globally using :ref:`setting_force_verbose` setting
|
||||||
|
or by environment variable :envvar:`PLATFORMIO_SETTING_FORCE_VERBOSE`.
|
||||||
1. ``-v`` - output errors only
|
|
||||||
2. ``-vv`` - output errors and warnings
|
|
||||||
3. ``-vvv`` - output errors, warnings and additional information
|
|
||||||
|
|
||||||
By default, verbosity level is set to 3 (maximum information).
|
|
||||||
|
|
||||||
.. option::
|
.. option::
|
||||||
--disable-auto-clean
|
--disable-auto-clean
|
||||||
@ -103,17 +96,34 @@ Examples
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio run
|
$ platformio run
|
||||||
Processing arduino_pro5v environment:
|
[Sun Jul 17 00:09:16 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino)
|
||||||
scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date.
|
-----------------------------------------------------------------------------------------------
|
||||||
scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date.
|
Looking for dependencies...
|
||||||
|
Collecting 32 compatible libraries
|
||||||
|
Processing src/main.cpp
|
||||||
|
Processing .pioenvs/uno/libFrameworkArduinoVariant.a
|
||||||
|
Processing .platformio/packages/framework-arduinoavr/cores/arduino/CDC.cpp
|
||||||
|
Processing .platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial.cpp
|
||||||
|
Processing .platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial0.cpp
|
||||||
|
...
|
||||||
|
Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_analog.c
|
||||||
|
Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_digital.c
|
||||||
|
Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_pulse.c
|
||||||
|
Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_shift.c
|
||||||
|
Processing .pioenvs/uno/libFrameworkArduino.a
|
||||||
|
Processing .pioenvs/uno/firmware.elf
|
||||||
|
Processing .pioenvs/uno/firmware.hex
|
||||||
|
Processing size
|
||||||
|
AVR Memory Usage
|
||||||
|
----------------
|
||||||
|
Device: atmega328p
|
||||||
|
|
||||||
Processing launchpad_msp430g2 environment:
|
Program: 1034 bytes (3.2% Full)
|
||||||
scons: `.pioenvs/launchpad_msp430g2/firmware.elf' is up to date.
|
(.text + .data + .bootloader)
|
||||||
scons: `.pioenvs/launchpad_msp430g2/firmware.hex' is up to date.
|
|
||||||
|
Data: 9 bytes (0.4% Full)
|
||||||
|
(.data + .bss + .noinit)
|
||||||
|
|
||||||
Processing launchpad_lm4f120 environment:
|
|
||||||
scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date.
|
|
||||||
scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date
|
|
||||||
|
|
||||||
|
|
||||||
2. Process specific environment
|
2. Process specific environment
|
||||||
@ -121,13 +131,27 @@ Examples
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio run -e arduino_pro5v -e launchpad_lm4f120
|
$ platformio run -e arduino_pro5v -e launchpad_lm4f120
|
||||||
Processing arduino_pro5v environment:
|
[Sun Jul 17 00:10:14 2016] Processing nodemcu (platform: espressif, board: nodemcu, framework: arduino)
|
||||||
scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date.
|
--------------------------------------------------------------------------------------------------------
|
||||||
scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date.
|
Looking for dependencies...
|
||||||
|
Collecting 29 compatible libraries
|
||||||
Processing launchpad_lm4f120 environment:
|
Processing src/main.cpp
|
||||||
scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date.
|
Processing .pioenvs/nodemcu/libFrameworkArduinoVariant.a
|
||||||
scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date.
|
Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/Esp.cpp
|
||||||
|
...
|
||||||
|
Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/pgmspace.cpp
|
||||||
|
Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/setjmp.S
|
||||||
|
Processing .pioenvs/nodemcu/libFrameworkArduino.a
|
||||||
|
Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libmesh.a
|
||||||
|
...
|
||||||
|
Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libaxtls.a
|
||||||
|
Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libstdc++.a
|
||||||
|
Processing .pioenvs/nodemcu/firmware.elf
|
||||||
|
Processing .platformio/packages/tool-esptool/esptool
|
||||||
|
Processing .pioenvs/nodemcu/firmware.bin
|
||||||
|
Processing size
|
||||||
|
text data bss dec hex filename
|
||||||
|
221456 884 29496 251836 3d7bc .pioenvs/nodemcu/firmware.elf
|
||||||
|
|
||||||
|
|
||||||
3. Process specific target
|
3. Process specific target
|
||||||
@ -135,52 +159,49 @@ Examples
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio run -t clean
|
$ platformio run -t clean
|
||||||
Processing arduino_pro5v environment:
|
[Sun Jul 17 00:19:36 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino)
|
||||||
Removed .pioenvs/arduino_pro5v/src/main.o
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
Looking for dependencies...
|
||||||
|
Collecting 32 compatible libraries
|
||||||
|
Removed .pioenvs/uno/FrameworkArduino/CDC.o
|
||||||
|
Removed .pioenvs/uno/FrameworkArduino/HardwareSerial.o
|
||||||
...
|
...
|
||||||
Removed .pioenvs/arduino_pro5v/firmware.hex
|
Removed .pioenvs/uno/libFrameworkArduinoVariant.a
|
||||||
|
Removed .pioenvs/uno/src/main.o
|
||||||
Processing launchpad_msp430g2 environment:
|
Removed .pioenvs/uno/libFrameworkArduino.a
|
||||||
Removed .pioenvs/launchpad_msp430g2/src/main.o
|
Removed .pioenvs/uno/firmware.elf
|
||||||
...
|
Removed .pioenvs/uno/firmware.hex
|
||||||
Removed .pioenvs/launchpad_msp430g2/firmware.hex
|
|
||||||
|
|
||||||
Processing launchpad_lm4f120 environment:
|
|
||||||
Removed .pioenvs/launchpad_lm4f120/src/main.o
|
|
||||||
...
|
|
||||||
Removed .pioenvs/launchpad_lm4f120/firmware.hex
|
|
||||||
|
|
||||||
|
|
||||||
4. Mix environments and targets
|
4. Mix environments and targets
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio run -e launchpad_msp430g2 -t upload
|
$ platformio run -e teensy31 -t upload
|
||||||
Processing launchpad_msp430g2 environment:
|
[Sun Jul 17 00:27:14 2016] Processing teensy31 (platform: teensy, board: teensy31, framework: arduino)
|
||||||
/Users/ikravets/.platformio/timsp430/tools/mspdebug/mspdebug rf2500 --force-reset "prog .pioenvs/launchpad_msp430g2/firmware.hex"
|
-------------------------------------------------------------------------------------------------------
|
||||||
MSPDebug version 0.20 - debugging tool for MSP430 MCUs
|
Looking for dependencies...
|
||||||
Copyright (C) 2009-2012 Daniel Beer <dlbeer@gmail.com>
|
Collecting 25 compatible libraries
|
||||||
This is free software; see the source for copying conditions. There is NO
|
Processing src/main.cpp
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/AudioStream.cpp
|
||||||
|
Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/DMAChannel.cpp
|
||||||
Trying to open interface 1 on 009
|
Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/HardwareSerial1.cpp
|
||||||
Initializing FET...
|
...
|
||||||
FET protocol version is 30394216
|
Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/yield.cpp
|
||||||
Configured for Spy-Bi-Wire
|
Processing .platformio/packages/tool-teensy/teensy_loader_cli
|
||||||
Sending reset...
|
Processing .pioenvs/teensy31/libFrameworkArduino.a
|
||||||
Set Vcc: 3000 mV
|
Processing .pioenvs/teensy31/firmware.elf
|
||||||
Device ID: 0x2553
|
Check program size...
|
||||||
Code start address: 0xc000
|
text data bss dec hex filename
|
||||||
Code size : 16384 byte = 16 kb
|
11080 168 2288 13536 34e0 .pioenvs/teensy31/firmware.elf
|
||||||
RAM start address: 0x200
|
Processing .pioenvs/teensy31/firmware.hex
|
||||||
RAM end address: 0x3ff
|
Processing upload
|
||||||
RAM size : 512 byte = 0 kb
|
Teensy Loader, Command Line, Version 2.0
|
||||||
Device: MSP430G2553/G2403
|
Read ".pioenvs/teensy31/firmware.hex": 11248 bytes, 4.3% usage
|
||||||
Code memory starts at 0xc000
|
Soft reboot is not implemented for OSX
|
||||||
Number of breakpoints: 2
|
Waiting for Teensy device...
|
||||||
Chip ID data: 25 53
|
(hint: press the reset button)
|
||||||
Erasing...
|
Found HalfKay Bootloader
|
||||||
Programming...
|
Read ".pioenvs/teensy31/firmware.hex": 11248 bytes, 4.3% usage
|
||||||
Writing 646 bytes at c000...
|
Programming...........
|
||||||
Writing 32 bytes at ffe0...
|
Booting
|
||||||
Done, 678 bytes total
|
|
||||||
|
@ -87,6 +87,20 @@ Check for the new PlatformIO interval.
|
|||||||
|
|
||||||
Check for the platform updates interval.
|
Check for the platform updates interval.
|
||||||
|
|
||||||
|
.. _setting_force_verbose:
|
||||||
|
|
||||||
|
``force_verbose``
|
||||||
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
:Default: No
|
||||||
|
:Values: Yes/No
|
||||||
|
|
||||||
|
Force verbose output when processing environments. This setting overrides
|
||||||
|
|
||||||
|
* :option:`platformio run --verbose`
|
||||||
|
* :option:`platformio ci --verbose`
|
||||||
|
* :option:`platformio test --verbose`
|
||||||
|
|
||||||
.. _setting_enable_prompts:
|
.. _setting_enable_prompts:
|
||||||
|
|
||||||
``enable_prompts``
|
``enable_prompts``
|
||||||
|
@ -85,8 +85,10 @@ to current working directory (``CWD``).
|
|||||||
.. option::
|
.. option::
|
||||||
-v, --verbose
|
-v, --verbose
|
||||||
|
|
||||||
Shows details about the results of processing environments. More details
|
Shows detailed information when processing environments.
|
||||||
:option:`platformio run --verbose`
|
|
||||||
|
This option can be set globally using :ref:`setting_force_verbose` setting
|
||||||
|
or by environment variable :envvar:`PLATFORMIO_SETTING_FORCE_VERBOSE`.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (3, 0, "0.dev7")
|
VERSION = (3, 0, "0.dev8")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -44,6 +44,10 @@ DEFAULT_SETTINGS = {
|
|||||||
"description": "Automatically update libraries (Yes/No)",
|
"description": "Automatically update libraries (Yes/No)",
|
||||||
"value": False
|
"value": False
|
||||||
},
|
},
|
||||||
|
"force_verbose": {
|
||||||
|
"description": "Force verbose output when processing environments",
|
||||||
|
"value": False
|
||||||
|
},
|
||||||
"enable_telemetry": {
|
"enable_telemetry": {
|
||||||
"description": (
|
"description": (
|
||||||
"Telemetry service <http://docs.platformio.org/en/latest/"
|
"Telemetry service <http://docs.platformio.org/en/latest/"
|
||||||
|
@ -19,11 +19,12 @@ from os import environ
|
|||||||
from os.path import join, normpath
|
from os.path import join, normpath
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, Variables
|
from SCons.Script import (COMMAND_LINE_TARGETS, AllowSubstExceptions,
|
||||||
|
DefaultEnvironment, Progress, Variables)
|
||||||
|
|
||||||
from platformio import util
|
from platformio import util
|
||||||
|
|
||||||
# AllowSubstExceptions()
|
AllowSubstExceptions(NameError)
|
||||||
|
|
||||||
# allow common variables from INI file
|
# allow common variables from INI file
|
||||||
commonvars = Variables(None)
|
commonvars = Variables(None)
|
||||||
@ -65,7 +66,7 @@ commonvars.AddVariables(
|
|||||||
|
|
||||||
DefaultEnvironment(
|
DefaultEnvironment(
|
||||||
tools=[
|
tools=[
|
||||||
"gcc", "g++", "as", "ar", "gnulink",
|
"ar", "as", "gcc", "g++", "gnulink",
|
||||||
"platformio", "devplatform",
|
"platformio", "devplatform",
|
||||||
"piolib", "piotest", "pioupload", "pioar", "piomisc"
|
"piolib", "piotest", "pioupload", "pioar", "piomisc"
|
||||||
],
|
],
|
||||||
@ -99,6 +100,9 @@ DefaultEnvironment(
|
|||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
|
||||||
|
if env.GetOption("silent"):
|
||||||
|
Progress(env.ProgressHandler)
|
||||||
|
|
||||||
# decode common variables
|
# decode common variables
|
||||||
for k in commonvars.keys():
|
for k in commonvars.keys():
|
||||||
if k in env:
|
if k in env:
|
||||||
|
@ -264,6 +264,14 @@ def GetActualLDScript(env):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def ProgressHandler(env, node):
|
||||||
|
item = str(node)
|
||||||
|
if "toolchain-" in item or item.endswith((".o", ".h", ".hpp", ".ipp")):
|
||||||
|
return
|
||||||
|
item = item.replace(env['PIOHOME_DIR'], ".platformio")
|
||||||
|
print "Processing %s" % item
|
||||||
|
|
||||||
|
|
||||||
def exists(_):
|
def exists(_):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -273,4 +281,5 @@ def generate(env):
|
|||||||
env.AddMethod(DumpIDEData)
|
env.AddMethod(DumpIDEData)
|
||||||
env.AddMethod(GetCompilerType)
|
env.AddMethod(GetCompilerType)
|
||||||
env.AddMethod(GetActualLDScript)
|
env.AddMethod(GetActualLDScript)
|
||||||
|
env.AddMethod(ProgressHandler)
|
||||||
return env
|
return env
|
||||||
|
@ -205,13 +205,13 @@ def MatchSourceFiles(env, src_dir, src_filter=None):
|
|||||||
return sorted(list(matches))
|
return sorted(list(matches))
|
||||||
|
|
||||||
|
|
||||||
def VariantDirWrap(env, variant_dir, src_dir, duplicate=True):
|
def VariantDirWrap(env, variant_dir, src_dir, duplicate=None):
|
||||||
DefaultEnvironment().Append(VARIANT_DIRS=[(variant_dir, src_dir)])
|
DefaultEnvironment().Append(VARIANT_DIRS=[(variant_dir, src_dir)])
|
||||||
env.VariantDir(variant_dir, src_dir, duplicate)
|
env.VariantDir(variant_dir, src_dir, duplicate)
|
||||||
|
|
||||||
|
|
||||||
def CollectBuildFiles(env, variant_dir, src_dir,
|
def CollectBuildFiles(env, variant_dir, src_dir,
|
||||||
src_filter=None, duplicate=True):
|
src_filter=None, duplicate=None):
|
||||||
sources = []
|
sources = []
|
||||||
variants = []
|
variants = []
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ def validate_path(ctx, param, value): # pylint: disable=W0613
|
|||||||
@click.option("--project-conf",
|
@click.option("--project-conf",
|
||||||
type=click.Path(exists=True, file_okay=True, dir_okay=False,
|
type=click.Path(exists=True, file_okay=True, dir_okay=False,
|
||||||
readable=True, resolve_path=True))
|
readable=True, resolve_path=True))
|
||||||
@click.option("--verbose", "-v", count=True, default=3)
|
@click.option("--verbose", "-v", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913
|
def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913
|
||||||
build_dir, keep_build_dir, project_conf, verbose):
|
build_dir, keep_build_dir, project_conf, verbose):
|
||||||
|
@ -36,7 +36,7 @@ from platformio.managers.platform import PlatformFactory
|
|||||||
@click.option("--project-dir", "-d", default=getcwd,
|
@click.option("--project-dir", "-d", default=getcwd,
|
||||||
type=click.Path(exists=True, file_okay=False, dir_okay=True,
|
type=click.Path(exists=True, file_okay=False, dir_okay=True,
|
||||||
writable=True, resolve_path=True))
|
writable=True, resolve_path=True))
|
||||||
@click.option("--verbose", "-v", count=True, default=3)
|
@click.option("--verbose", "-v", is_flag=True)
|
||||||
@click.option("--disable-auto-clean", is_flag=True)
|
@click.option("--disable-auto-clean", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
|
def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
|
||||||
@ -111,7 +111,7 @@ class EnvironmentProcessor(object):
|
|||||||
self.options = self._validate_options(options)
|
self.options = self._validate_options(options)
|
||||||
self.targets = targets
|
self.targets = targets
|
||||||
self.upload_port = upload_port
|
self.upload_port = upload_port
|
||||||
self.verbose_level = int(verbose)
|
self.verbose = verbose
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
terminal_width, _ = click.get_terminal_size()
|
terminal_width, _ = click.get_terminal_size()
|
||||||
@ -197,7 +197,7 @@ class EnvironmentProcessor(object):
|
|||||||
cmd_platform_install, platforms=[self.options['platform']])
|
cmd_platform_install, platforms=[self.options['platform']])
|
||||||
p = PlatformFactory.newPlatform(platform, version)
|
p = PlatformFactory.newPlatform(platform, version)
|
||||||
|
|
||||||
return p.run(build_vars, build_targets, self.verbose_level)
|
return p.run(build_vars, build_targets, self.verbose)
|
||||||
|
|
||||||
|
|
||||||
def _autoinstall_libs(ctx, libids_list):
|
def _autoinstall_libs(ctx, libids_list):
|
||||||
|
@ -35,7 +35,7 @@ from platformio.managers.platform import PlatformFactory
|
|||||||
@click.option("--project-dir", "-d", default=getcwd,
|
@click.option("--project-dir", "-d", default=getcwd,
|
||||||
type=click.Path(exists=True, file_okay=False, dir_okay=True,
|
type=click.Path(exists=True, file_okay=False, dir_okay=True,
|
||||||
writable=True, resolve_path=True))
|
writable=True, resolve_path=True))
|
||||||
@click.option("--verbose", "-v", count=True, default=3)
|
@click.option("--verbose", "-v", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli(ctx, environment, skip, upload_port, project_dir, verbose):
|
def cli(ctx, environment, skip, upload_port, project_dir, verbose):
|
||||||
assert check_project_envs(project_dir, environment)
|
assert check_project_envs(project_dir, environment)
|
||||||
|
@ -23,7 +23,7 @@ from os.path import basename, dirname, isdir, isfile, join
|
|||||||
import click
|
import click
|
||||||
import semantic_version
|
import semantic_version
|
||||||
|
|
||||||
from platformio import exception, util
|
from platformio import app, exception, util
|
||||||
from platformio.managers.package import BasePkgManager, PackageManager
|
from platformio.managers.package import BasePkgManager, PackageManager
|
||||||
|
|
||||||
PACKAGE_DIR = join(util.get_home_dir(), "packages")
|
PACKAGE_DIR = join(util.get_home_dir(), "packages")
|
||||||
@ -224,11 +224,10 @@ class PlatformRunMixin(object):
|
|||||||
self.configure_default_packages(variables, targets)
|
self.configure_default_packages(variables, targets)
|
||||||
self.install_packages(silent=True)
|
self.install_packages(silent=True)
|
||||||
|
|
||||||
self._verbose_level = int(verbose)
|
self._verbose = verbose or app.get_setting("force_verbose")
|
||||||
|
|
||||||
if "clean" in targets:
|
if "clean" in targets:
|
||||||
targets.remove("clean")
|
targets = ["-c", "."]
|
||||||
targets.append("-c")
|
|
||||||
|
|
||||||
variables['platform_manifest'] = self.manifest_path
|
variables['platform_manifest'] = self.manifest_path
|
||||||
|
|
||||||
@ -237,14 +236,8 @@ class PlatformRunMixin(object):
|
|||||||
if not isfile(variables['build_script']):
|
if not isfile(variables['build_script']):
|
||||||
raise exception.BuildScriptNotFound(variables['build_script'])
|
raise exception.BuildScriptNotFound(variables['build_script'])
|
||||||
|
|
||||||
self._found_error = False
|
|
||||||
result = self._run_scons(variables, targets)
|
result = self._run_scons(variables, targets)
|
||||||
assert "returncode" in result
|
assert "returncode" in result
|
||||||
# if self._found_error:
|
|
||||||
# result['returncode'] = 1
|
|
||||||
|
|
||||||
if self._last_echo_line == ".":
|
|
||||||
click.echo("")
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -266,7 +259,10 @@ class PlatformRunMixin(object):
|
|||||||
"-j %d" % self.get_job_nums(),
|
"-j %d" % self.get_job_nums(),
|
||||||
"--warn=no-no-parallel-support",
|
"--warn=no-no-parallel-support",
|
||||||
"-f", join(util.get_source_dir(), "builder", "main.py")
|
"-f", join(util.get_source_dir(), "builder", "main.py")
|
||||||
] + targets
|
]
|
||||||
|
if not self._verbose and "-c" not in targets:
|
||||||
|
cmd.append("--silent")
|
||||||
|
cmd += targets
|
||||||
|
|
||||||
# encode and append variables
|
# encode and append variables
|
||||||
for key, value in variables.items():
|
for key, value in variables.items():
|
||||||
@ -280,31 +276,19 @@ class PlatformRunMixin(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def on_run_out(self, line):
|
def on_run_out(self, line):
|
||||||
self._echo_line(line, level=3)
|
self._echo_line(line, level=1)
|
||||||
|
|
||||||
def on_run_err(self, line):
|
def on_run_err(self, line):
|
||||||
is_error = self.LINE_ERROR_RE.search(line) is not None
|
is_error = self.LINE_ERROR_RE.search(line) is not None
|
||||||
if is_error:
|
self._echo_line(line, level=3 if is_error else 2)
|
||||||
self._found_error = True
|
|
||||||
self._echo_line(line, level=1 if is_error else 2)
|
|
||||||
|
|
||||||
def _echo_line(self, line, level):
|
@staticmethod
|
||||||
|
def _echo_line(line, level):
|
||||||
assert 1 <= level <= 3
|
assert 1 <= level <= 3
|
||||||
|
fg = (None, "yellow", "red")[level - 1]
|
||||||
fg = ("red", "yellow", None)[level - 1]
|
if level == 1 and "is up to date" in line:
|
||||||
if level == 3 and "is up to date" in line:
|
|
||||||
fg = "green"
|
fg = "green"
|
||||||
|
click.secho(line, fg=fg, err=level > 1)
|
||||||
if level > self._verbose_level:
|
|
||||||
click.secho(".", fg=fg, err=level < 3, nl=False)
|
|
||||||
self._last_echo_line = "."
|
|
||||||
return
|
|
||||||
|
|
||||||
if self._last_echo_line == ".":
|
|
||||||
click.echo("")
|
|
||||||
self._last_echo_line = line
|
|
||||||
|
|
||||||
click.secho(line, fg=fg, err=level < 3)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_job_nums():
|
def get_job_nums():
|
||||||
@ -326,13 +310,7 @@ class PlatformBase(PlatformPackagesMixin, PlatformRunMixin):
|
|||||||
self.pm = PackageManager(
|
self.pm = PackageManager(
|
||||||
PACKAGE_DIR, self._manifest.get("packageRepositories"))
|
PACKAGE_DIR, self._manifest.get("packageRepositories"))
|
||||||
|
|
||||||
self._found_error = False
|
self._verbose = False
|
||||||
self._last_echo_line = None
|
|
||||||
|
|
||||||
# 1 = errors
|
|
||||||
# 2 = 1 + warnings
|
|
||||||
# 3 = 2 + others
|
|
||||||
self._verbose_level = 3
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
Reference in New Issue
Block a user