Skip to content

Extend feature which displays errors/warnings as Link #6999

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

Conversation

DBS06
Copy link
Contributor

@DBS06 DBS06 commented May 24, 2018

Description

I already made a PR #6270 which offers a flag to displays errors/warnings as a Link to file and line.
I extended this feature to display, in case of an error, also the GCC output as a clickable link.
See here GCC Output.
The feature will be activated by setting PRINT_COMPILER_OUTPUT_AS_LINK = True in the application specific mbed_settings.py.

Pull request type

[ ] Fix
[ ] Refactor
[ ] New target
[x] Feature
[ ] Breaking change

PR ARMmbed#6270 added a parameter which allows the user to decide in case of an error or warning to print the output as a link.
This extension of this option also prints the ARM-GCC output in a link format.
@0xc0170 0xc0170 requested a review from a team May 24, 2018 07:40
@DBS06
Copy link
Contributor Author

DBS06 commented May 28, 2018

@ARMmbed/mbed-os-tool can you please review?

@DBS06
Copy link
Contributor Author

DBS06 commented May 29, 2018

@0xc0170 can you pls request a review from "ARMmbed/mbed-os-tools" again, because I don't know how to do that 😏

@theotherjimmy
Copy link
Contributor

@DBS06 Try adding an "s" to the end of @cmonr and my name.

@@ -988,6 +988,8 @@ def compile_command(self, source, object, includes):
_, ext = splitext(source)
ext = ext.lower()

source = abspath(source) if PRINT_COMPILER_OUTPUT_AS_LINK else source

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the GCC gives out what he gets, i.e. when you are passing relative paths the gcc prints out relative paths and vice versa.

@@ -433,7 +433,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
self.build_all = False

# Build output dir
self.build_dir = build_dir
self.build_dir = abspath(build_dir) if PRINT_COMPILER_OUTPUT_AS_LINK else build_dir
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the GCC gives out what he gets, i.e. when you are passing relative paths the gcc prints out relative paths and vice versa.

@theotherjimmy
Copy link
Contributor

theotherjimmy commented May 29, 2018

@DBS06 I'm not so sure about the abspathing of source and build_dir going no here. I'm very keen to avoid behavioral changes in the build that depend on environment variables. Is this something that could be handled in the TerminalNotifier only?

@DBS06
Copy link
Contributor Author

DBS06 commented May 30, 2018

@theotherjimmy I am also very keen to avoid behavioral changes. I did that because the GCC gives out what he gets, i.e. when you are passing relative paths the gcc prints out relative paths and vice versa (see GCC Output). The other option would be to search inside the gcc output for relative paths to a file and exchange them "manually" with absolute paths, but I think giving the gcc absolute paths is more robust and a faster solution.

@theotherjimmy
Copy link
Contributor

@DBS06 These paths should be relative to the project root, correct? Is that a problem?

@DBS06
Copy link
Contributor Author

DBS06 commented May 30, 2018

@theotherjimmy to see it as a link (like in the picture) they should be absolute. if they are absolute, nearly every IDE can interpret them as a link. As described the GCC gives out what he gets, I thought it would be a cleaner solution to give the GCC absolute paths (if you want the option PRINT_COMPILER_OUTPUT_AS_LINK enabled), rather then parsing through the GCC-Output and replace every relative path with an absolute path.

"GCC gives out what he gets" -> if you pass to the GCC an relative path, the GCC prints errors/warnings with a relative path and if you pass an absolute path, GCC prints errors/warnings with an absolute path.

@theotherjimmy
Copy link
Contributor

@DBS06 I'm a bit worried by bugs like #6335 Where path length is clearly an issue.

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

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

This is not as bad as I had initially thought: it only affects the source and destination dirs; not the include paths. This is a diff of < 100 bytes in command line length. I'm not super concerned about that.

@DBS06
Copy link
Contributor Author

DBS06 commented May 30, 2018

@theotherjimmy nice 👍
BTW: include paths would be indeed a bad idea 😏

@cmonr
Copy link
Contributor

cmonr commented May 30, 2018

Welp, let's see what the exporter CI says.

/morph build

@mbed-ci
Copy link

mbed-ci commented May 31, 2018

Build : SUCCESS

Build number : 2197
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6999/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented May 31, 2018

@mbed-ci
Copy link

mbed-ci commented May 31, 2018

@cmonr
Copy link
Contributor

cmonr commented May 31, 2018

/morph mbed2-build

@cmonr
Copy link
Contributor

cmonr commented May 31, 2018

/morph uvisor-test

1 similar comment
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 5, 2018

/morph uvisor-test

@cmonr cmonr merged commit a25b9f3 into ARMmbed:master Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants