Add parameter in tools settings to show error/warning as Link

Per default mbed compile prints errors/warnings on output not in a link format, therefore it is not possible to click, i.e. in an IDE, on the errors/warnings and jump to the position in the file.

The settings parameter lets you decide in witch format do you want to have it.
If it is enabled then the output will look like:
[Error/Warning] [absolute\path\to\file.ext]:[line]:[column]: [msg]

with this format nearly every common known IDE can deal with this link and lets you jump to the file
pull/6270/head
PHST 2018-03-05 15:44:49 +01:00
parent a6e27b1b86
commit 3e59bdcbf5
3 changed files with 15 additions and 4 deletions

View File

@ -43,3 +43,6 @@ from os.path import join, abspath, dirname
# mbed.org username
#MBED_ORG_USER = ""
# Print compiler warnings and errors as link format
#PRINT_COMPILER_OUTPUT_AS_LINK = False

View File

@ -54,6 +54,9 @@ BUILD_OPTIONS = []
# mbed.org username
MBED_ORG_USER = ""
# Print compiler warnings and errors as link format
PRINT_COMPILER_OUTPUT_AS_LINK = False
CLI_COLOR_MAP = {
"warning": "yellow",
"error" : "red"
@ -74,7 +77,7 @@ except ImportError:
# User Settings (env vars)
##############################################################################
_ENV_PATHS = ['ARM_PATH', 'GCC_ARM_PATH', 'GCC_CR_PATH', 'IAR_PATH',
'ARMC6_PATH']
'ARMC6_PATH', 'PRINT_COMPILER_OUTPUT_AS_LINK']
for _n in _ENV_PATHS:
if getenv('MBED_'+_n):

View File

@ -35,7 +35,7 @@ import fnmatch
from ..utils import (run_cmd, mkdir, rel_path, ToolException,
NotSupportedException, split_path, compile_worker)
from ..settings import MBED_ORG_USER
from ..settings import MBED_ORG_USER, PRINT_COMPILER_OUTPUT_AS_LINK
from .. import hooks
from ..memap import MemapParser
@ -460,8 +460,13 @@ class mbedToolchain:
elif event['type'] == 'cc':
event['severity'] = event['severity'].title()
event['file'] = basename(event['file'])
msg = '[%(severity)s] %(file)s@%(line)s,%(col)s: %(message)s' % event
if PRINT_COMPILER_OUTPUT_AS_LINK:
event['file'] = getcwd() + event['file'].strip('.')
msg = '[%(severity)s] %(file)s:%(line)s:%(col)s: %(message)s' % event
else:
event['file'] = basename(event['file'])
msg = '[%(severity)s] %(file)s@%(line)s,%(col)s: %(message)s' % event
elif event['type'] == 'progress':
if 'percent' in event: