Whenever you are working on a programming project, chances are that there is some sort of tedious manual thing you are going to be doing in order to compile it or prep it for release. Compiling the project is usually not a huge pain in the ass, as it might have been the case a decade or two ago because these days we have smart IDE’s that will actually do most of the work for you. However, you are not always going to use an IDE, and the IDE you use can’t necessarily cover all the common use cases. In my experience, every project eventually requires a task that can’t be easily handled by the built in tools in your IDE. These use cases are commonly things like:
- Running a test suite the IDE authors did not like or approve of
- Deploying the code to a test server (which may involve cleaning up previous environment, copying files into specific directories, creating symlinks, etc…
- Creating custom installers with bundled third party dependencies.
- Running your code through custom quality insurance tools such as linters, optimizers, code signing tools and etc..
- Posting released binaries online, updating online release notes and etc…
A lot of this kind of stuff is finicky and weird and thus people will often do it manually just to make sure it is done right. In my opinion this is not the correct approach. If you want it done right once, then yes – maybe manual labor is warranted. If you want correctness on a consistent basis, the only way to ensure it is to automate the process. Human element introduces a lot of errors to a complex build process – it is far to easy for humans to forget things or miss tiny details. Automated process does everything the same way every time you run it, and it either produces valid results or fails in a predictable way.
I would argue that even simple weekend projects you might be hacking away at right now, would greatly benefit from a build tool. Especially if you plan releasing them on GitHub or some other place. If nothing else, providing a build script allows people who are interested in your tool/utility to reliably compile it on their machines even if they do not have much experience with the language and/or framework you used to create it.
I figured it would be interesting to see what do you guys use to build your projects? What is your go-to build tool? Is it Make? Ant? Rake? Something else?
There are two main compensating paradigms/philosophies in the build tool world. One states that build tools should provide the users with a minimum framework for running build tasks, handling dependencies and helper functions and then let them script their own tasks manually. Tools like Make and Rake use this approach by simply giving you a structured way to write your own build scripts. The other camp prefers to offer comprehensible collection of pre-made tasks that the user can just declare in their build file. So the argument is scripting vs. configuration. That’s the approach taken by tools like Ant or Maven.
Personally I’m in the scripting camp, because every project eventually needs a custom-made build task that will be a massive pain to implement in a declarative, config based build tool. I really like Rake for example, because I’d much rather write ruby scripts than fiddle around with XML config files. It is very powerful because of how flexible it is, and how easy it makes it to jump out into the shell in order to run external commands. It really is Make, but with the beautiful Ruby syntax and a library of helper classes that let you rapidly develop your build scripts.
Things like Ant, Phing and Maven have limited appeal to me because I just don’t think XML is the right language for this work. The terrible thing about XML as compared to say JSON is that it is needlessly complex. I always like to joke around that it is the configuration file standard that is neither human or machine readable. JSON and YAML files tend to be much easier to grok at a glance, and much easier to consume in your program. To parse XML config files you need a full-blown DOM parser which is non trivial.
That said, I do understand why it is used. I am aware of it’s complexity and robustness and the ability to audit and validate per existing spec are an important features that a lot of people want in their config files. I just don’t think config files are a way to go.
So which build tool is your favorite and why?