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
cc-wrapper: add hook #61553
base: staging
Are you sure you want to change the base?
cc-wrapper: add hook #61553
Conversation
This enables more detailed tracing of stdenv compile flags, for example generating a compile_commands.json database for a c/c++ project. $ NIX_CC_WRAPPER_HOOK=./cc-hook make jq '{arguments: $ARGS.positional, directory: $ARGS.named.pwd, file: $ARGS.positional[] | select(endswith(".cc"))}' \ -n --arg pwd "$PWD" --args -- "$@"
This might be okay, but I am still hoping for a more robust solution to this. These kind of hooks tend to get bit rotted very quickly (for example the nix-buffer stuff). Has anyone tried generating a compilation db with cmake? I was hoping something like this would just work:
|
${extraBefore+"${extraBefore[@]}"} \ | ||
${params+"${params[@]}"} \ | ||
${extraAfter+"${extraAfter[@]}"} | ||
fi |
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.
Should compilation still happen when you provide this hook?
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.
For my hook yes, make would probably fail if nothing is actually built. But maybe there's some other usecase.
I agree that it's a little bit out of place, but all the functionality I needed is already here. CMAKE_EXPORT_COMPILE_COMMANDS might work fine, but I have not found anything that works properly for make, etc. projects on all platforms. |
Thank you for your contributions.
|
I marked this as stale due to inactivity. → More info |
This enables more detailed tracing of stdenv compile flags, for example
generating a compile_commands.json database for a c/c++ project.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)