Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@

# mbed.org username
#MBED_ORG_USER = ""

# Print compiler warnings and errors as link format
#PRINT_COMPILER_OUTPUT_AS_LINK = False
5 changes: 4 additions & 1 deletion tools/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
# 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"
Expand All @@ -74,7 +77,7 @@
# 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):
Expand Down
11 changes: 8 additions & 3 deletions tools/toolchains/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

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

Expand Down Expand Up @@ -460,8 +460,13 @@ def print_notify(self, event, silent=False):

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:
Expand Down