Git and Premake - Automate premake to run after branch switch/checkout with a git hook! #2221
danieldownes
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I started on helping out a friend on a C++ project game VS project. He just gone and saved his VS files directly in the repo of course, like anyone else might. We had some junior devs help out, and they had issues setting up the project, yes, as the project requirement some manual configuration to the project on a per machine basis of course Premake was a clear way forward.
However, as we have to checkout branches all the time to check each others work, and the fact that the project is in flux and has a lot of changes, people tend to forget to run Premake. Most VS devs don't exactly use the command line tbh, that's why we are using a heavy IDE. This would include the git functionalities in the IDE!
My idea was to automate running premake each time the branch is switched, in git terms this is a checkout. There is a way to hook into git events using git hooks. Git hooks are not versioned or shared by default when you commit changes to a repository.
Of course I wanted to share. This is not something people do on a daily basis, especially junior devs. I added a bat file to the repository to add the git hook so that every time a git checkout is successfully performed, then permake is run.
I created a setup-hooks.bat file. which is in the root of the repo:
This post-checkout file looks like this:
Finally the premake.bat file calls premake:
We use a bat file so that it can be manually run more easily, and also we add some of other project prep here, like copying in dlls to the bin folders, etc.
PS, the game is here, using SFML only and lots of code!
https://github.com/TheEmperorsArmoury/TheGreatWar/
Beta Was this translation helpful? Give feedback.
All reactions