Skip to content

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

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

Merged
merged 1 commit into from
Mar 15, 2018
Merged
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']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theotherjimmy Is this the right location for this new variable to be defined?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_ENV_PATHS should be named _ENV_PARAMETERS or similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat. We'll save that renaming for a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wondered at typing this specific line of code, if this would be the right location :-) I also thought about it to rename the variable right away, but come to the conclusion that this should be a separate PR.


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