joro75 / pre-commit-hooks Goto Github PK
View Code? Open in Web Editor NEWA pre-commit hook to check if the Microsoft C/C++ project has been successfully built.
License: MIT License
A pre-commit hook to check if the Microsoft C/C++ project has been successfully built.
License: MIT License
Windows specific directory seperators are still used in test-code
It can happen that for different files, it is found that the same project is not successfully build. It should then only be reported once!
I have a C++ project that also includes another data file (or a related .py script file). It is only included in the project for easy access, and to ensure that it is copied to the output directory (which is common for unittest projects).
If that related file is updated, it can be newer than the compiled .DLL/.EXE. The 'check_successful_c_msbuild' than requires that a new build of the .DLL/.EXE is created. However visual studio is not building a new .DLL/.EXE because the related file is not an actual dependency for the output executable.
It would thus be better to exclude the <None Include="relatedFile.py">
to determine if the changed file is included in the project.
For example if the .gitignore or the .pre-commit-config.yaml is changed, and wants to be committed, then there is a high change that the build of all the projects is older, and thus not allowed to be committed.
The check should thus not be performed for files that are not related to the project itself.
Relevant files are: c/cpp/cxx/h/hpp/hxx/rc/vcxproj
The pre-commit hook, does check if the build is outdated, or if the build was unsuccessful.
However if the source code was checked-out, and never been build yet, the hook doesn't detect that no build at all is present.
Wouldn't it be better if an error is raised if no 'build' was present yet at all?
Once the output file is known from the project file, it shouldn't matter which compiler is being used. It should thus be possible to also use the hook on C# and VB.NET projects.
When only a few (but not all) of the changed files are added in a commit, the other files are temporarily stashed. When the commit is finished, the stashed files are pop-ed from the stash again, however that changes the file change time.
When those files are then committed in a second commit, the check_successful_c_msbuild hook, is raising an error that the build is outdated, because of the newer source files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.