-
Notifications
You must be signed in to change notification settings - Fork 101
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
Cleanup the backend output #622
Conversation
I've now implemented everything I'd envisaged for this. Apologies for the size of the PR! Handling the isatty check and collecting compiler output made it a bit more involved. In summary:
This PR bundles a small MIT licensed c code for properly checking isatty on Windows. I've tested on Ubuntu, Windows command prompt and MSYS2 (Mintty) on Windows. Will need a volunteer to test on Mac. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I left a couple of comments regarding the setup of the classes and the color attributes from a first sweep through the implementation.
I'll do some proper testing soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only reviewed from a "high level" perspective. I don't see any major issues. As long as @awvwgk is satisfied with the details, this is good to merge as far as I am concerned.
Everything has tested well. I was going to suggest using the attr_update(3f) function in M_attr(3f) to add clearline, upline, and downline and moving the call to detect if plain or color mode to the fpm_command_line module so all routines could use colors, so the messages set up with and could use color but it looks like you took M_attr out. As far as the interface goes, I would prefer that --verbose show all messages only when all targets are built, and only show messages from rebuilt files during an incremental build. On a large project a rebuild of a single file with --verbose mode shows 27 000, lines, which is actually more verbose than the original :>. The conditional --verbose mode output is of course not an issue with a project composed of one file, and really only gets horrible with the gfortran compiler and allocatable strings but to me that is a must-have. Still reviewing, and I think some other thoughts I have had (discussed in the previous canceled PRs) are not important enough to hold back this (IMO) major advancement (having messages in the associated log files). Some utilties use repeated use of --verbose or a --verbose level like --verbose [1,2,3...]. That would be easy to add transparently at the command line level. |
I tested on Apple M1. I rebuilt this PR, and then tried to run, it works, but "build" segfaults: $ build/gfortran_2A42023B310FA28D/app/fpm
Fortran Package Manager:
USAGE: fpm [ SUBCOMMAND [SUBCOMMAND_OPTIONS] ]|[--list|--help|--version]
where SUBCOMMAND is commonly new|build|run|test
subcommand may be one of
build Compile the package placing results in the "build" directory
help Display help
list Display this list of subcommand descriptions
new Create a new Fortran package directory with sample files
run Run the local package application programs
test Run the test programs
update Update and manage project dependencies
install Install project
Enter "fpm --list" for a brief list of subcommand options. Enter
"fpm --help" or "fpm SUBCOMMAND --help" for detailed descriptions.
$ build/gfortran_2A42023B310FA28D/app/fpm build
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x104bd76f7
#1 0x104bd671b
#2 0x18dfc6c43
#3 0x1048c2ac7
zsh: segmentation fault build/gfortran_2A42023B310FA28D/app/fpm build |
In lldb I get:
|
PS; I think ifort and gfortran always default to PAD='yes' but not sure, so might want to add that explicitly or getline(3f) will probably have a problem, as per the example in getline. |
For compiler_t and archive_t objects
fpm_environment::run is moved to fpm_filesystem so that it can use the getline function to retrieve redirected output from file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, the implementation looks fine to me. Just some minor nit-picks in the comments.
Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
somewhat ironically, I immediately miss being able to get all the messages on a built project. Is that something you were going to build back in? |
I agree we should build this in but I'm not sure what the user interface would be right now ( |
A minor issue I encountered is that the output is not correctly aligned, the
Another thing, building a deeply nested project like TOML Fortran leads to printout like this
Where files with different paths but identical basename look like they are appearing twice in the compilation step. |
First of all, thanks to this PR, this gives the user experience a big step up. And, is it possible to add output path information of the target binaries to the # `fpm build --verbose` info
<INFO> BUILD_NAME: build\gfortran
<INFO> COMPILER: gfortran
<INFO> C COMPILER: gcc
<INFO> COMPILER OPTIONS: -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -fcoarray=single
<INFO> C COMPILER OPTIONS:
<INFO> LINKER OPTIONS:
<INFO> INCLUDE DIRECTORIES: []
[100%] Project compiled successfully. For example, when I first used Project is up to date
build\gfortran_2A42023B310FA28D\app\fpm.exe: PE32+ executable (console) x86-64, for MS Windows |
Ah yes, I'll sort that out.
I'll have to have a think about what the best way to address this is. Including full paths by default may lead to a lot of redundant output noise. |
Thanks @zoziha - the output path hash was removed from the verbose summary information because it technically varies on a per-file basis (it can be different for different files with different flags). However, you can run |
@LKedward, any updates on this patch? |
Apologies, it has been an incredibly busy start to the year for me. I hope to get back on this soon.
Part of the delay is that I haven't come up with a simple and non-verbose solution to the identical file problem - suggestions would be welcome. |
How about:
|
Cheers, yes I was thinking along the same lines. Unfortunately this is a non-trivial addition to which I haven't been able to commit the time. Can that be left for a separate PR, or is someone able to help out with this? |
I'm fine with having a separate PR for this. Let's move this one forward. |
Thanks everyone for your feedback and patience. I think this is now ready to go. Let me know if you have any other suggestions. |
--verbose
allbuilt targets when--verbose
Feel free to test it out - feedback welcome.