Add option for listeners to filter compilation units#59
Open
jglrxavpok wants to merge 1 commit intoddovod:masterfrom
Open
Add option for listeners to filter compilation units#59jglrxavpok wants to merge 1 commit intoddovod:masterfrom
jglrxavpok wants to merge 1 commit intoddovod:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Allows applications to select which compilation units are monitored by jet-live.
If an application rejects a given compilation unit, this file will not be watched nor the object will be recompiled when changed. By default, all files are monitored (as it is before this PR)
Motivation
My project has different CMake targets when enabling AddressSanitizer, so my source files are the same between the ASAN and non-ASAN targets.
However, jet-live maps compilation arguments to the source filename. This creates an issue when trying to reload my source files because the ASAN compilation command is last inside my compile_commands.json file. Jet-live will override the non-ASAN version with the ASAN version of my compilation unit (in CompileCommandsCompilationUnitsParser.cpp), making jet-live compile the ASAN version, and failing to link it into the running non-ASAN executable.
Extract from my compile_commands.json file:
{ "directory": "/mnt/StockageSSD/Programming/Games/Carrot/cmake-build-debug-ninja", "command": "/usr/bin/c++ [...] -o engine/CMakeFiles/Engine-Base.dir/engine/render/RenderGraph.cpp.o -c /mnt/StockageSSD/Programming/Games/Carrot/engine/engine/render/RenderGraph.cpp", "file": "/mnt/StockageSSD/Programming/Games/Carrot/engine/engine/render/RenderGraph.cpp", "output": "engine/CMakeFiles/Engine-Base.dir/engine/render/RenderGraph.cpp.o" }, [...] { "directory": "/mnt/StockageSSD/Programming/Games/Carrot/cmake-build-debug-ninja", "command": "/usr/bin/c++ [...] -fsanitize=address [...] -o engine/CMakeFiles/Engine-ASAN.dir/engine/render/RenderGraph.cpp.o -c /mnt/StockageSSD/Programming/Games/Carrot/engine/engine/render/RenderGraph.cpp", "file": "/mnt/StockageSSD/Programming/Games/Carrot/engine/engine/render/RenderGraph.cpp", "output": "engine/CMakeFiles/Engine-ASAN.dir/engine/render/RenderGraph.cpp.o" },From what I have seen, it is not possible to know which .o files are used to build a given executable (without modifications to the toolchain). Therefore, to minimize required changes to the toolchain of applications using jet-live, I have decided to create a hook to let the application reject some files if need be.
Example usage here: https://codeberg.org/jglrxavpok/Carrot/commit/582e5c701f78bff4150113a6ad32cacb5734b43e