I've blogged before about the NUKE build system, a great tool written by Matthias Koch that allows you to define all your build steps in a C# project, complete with full IDE integration and lots of helpers to get you started quickly. Since work on NUKE has begun almost three years ago, it's grown to be a fully featured build system with a great community. We're using it in all of our projects at DanglIT, and the experience so far has been great!
One thing, though, that's always bugged us was that when we invoked the build on Linux machines, we always had to explicitly prefix it with the shell command, like bash build.sh Test -Configuration Debug
We could never directly invoke the build scripts comfortably on Linux, no matter if we were using a project that has had NUKE added over 2 years ago or for a fresh install. First, we thought it might have been related to line ending differences, since all our development happens on Windows machines. That could quickly be checked, and it wasn't the case - checkout worked as expected on Linux.
After some digging to find out what we were doing wrong, it turned out that the culprit was the executable permissions of the scripts. If you're on Linux or Mac, git will recognize scripts as executable files and mark them as such. If you're on Windows, however, they're simply added as regular files. The answer from Antwane at StackOverflow explains it quite nice, but in short, you just set the chmod permission via git: git update-index --chmod=+x build.cmd
Before, we saw that the file permissions were 644, or read/write:
After updating the index, we get the correct permissions, including executable 755:
After you've done that, commit your changes. Now, your scripts should also work on Linux as expected. At least, it worked for us!
Happy building!