Skip to content

Commit 0828727

Browse files
authored
Merge pull request #6270 from evva-sfw/error_warning_msg_as_link
Add parameter in tools settings to show error/warning as Link
2 parents 92bbdbb + 3e59bdc commit 0828727

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

tools/default_settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@
4343

4444
# mbed.org username
4545
#MBED_ORG_USER = ""
46+
47+
# Print compiler warnings and errors as link format
48+
#PRINT_COMPILER_OUTPUT_AS_LINK = False

tools/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
# mbed.org username
5555
MBED_ORG_USER = ""
5656

57+
# Print compiler warnings and errors as link format
58+
PRINT_COMPILER_OUTPUT_AS_LINK = False
59+
5760
CLI_COLOR_MAP = {
5861
"warning": "yellow",
5962
"error" : "red"
@@ -74,7 +77,7 @@
7477
# User Settings (env vars)
7578
##############################################################################
7679
_ENV_PATHS = ['ARM_PATH', 'GCC_ARM_PATH', 'GCC_CR_PATH', 'IAR_PATH',
77-
'ARMC6_PATH']
80+
'ARMC6_PATH', 'PRINT_COMPILER_OUTPUT_AS_LINK']
7881

7982
for _n in _ENV_PATHS:
8083
if getenv('MBED_'+_n):

tools/toolchains/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
from ..utils import (run_cmd, mkdir, rel_path, ToolException,
3737
NotSupportedException, split_path, compile_worker)
38-
from ..settings import MBED_ORG_USER
38+
from ..settings import MBED_ORG_USER, PRINT_COMPILER_OUTPUT_AS_LINK
3939
from .. import hooks
4040
from ..memap import MemapParser
4141

@@ -462,8 +462,13 @@ def print_notify(self, event, silent=False):
462462

463463
elif event['type'] == 'cc':
464464
event['severity'] = event['severity'].title()
465-
event['file'] = basename(event['file'])
466-
msg = '[%(severity)s] %(file)s@%(line)s,%(col)s: %(message)s' % event
465+
466+
if PRINT_COMPILER_OUTPUT_AS_LINK:
467+
event['file'] = getcwd() + event['file'].strip('.')
468+
msg = '[%(severity)s] %(file)s:%(line)s:%(col)s: %(message)s' % event
469+
else:
470+
event['file'] = basename(event['file'])
471+
msg = '[%(severity)s] %(file)s@%(line)s,%(col)s: %(message)s' % event
467472

468473
elif event['type'] == 'progress':
469474
if 'percent' in event:

0 commit comments

Comments
 (0)