Build Tools Comparison
"A 'Build tool' is a single term that refers to anything that is needed to get a piece of software set up, but isn't needed after that". There are numerous number of build tools each having a different set of tradeoffs associated with them. Book titled "Managing projects with make" helped in creation of this comparison.Here are some of the major build tools and their features:
Make was first created in 1976, but the variants of this build tool are still going strong in today’s world of system development. In make we have to specify dependency followed by a rule to resolve those dependencies. It is a powerful product oriented tool which is highly capable of tracking dependencies within a build and building only those parts/components that have been updated/changed. Thus helping in optimizing performance whereby compilation time is crucial in development cycles. The drawback of this tool is that with increase in the rise of complexity, the number of dependency between their component also increases causing the rules even more complex making it really hard to debug. To make things better for this drawback we regularly see teams making a MakeFile in each sub-directory and a top level MakeFile. The top level MakeFile recursively runs the subdirectories resulting in the build information and processes to spread over many files. The other drawbacks of this tool is that due to significant amount of whitespaces it makes it susceptible to hard-to-find class of bugs. Make is also OS specific since it relies on shell scripting. Many developers have started using SCons instead of Make.
Ant is a task oriented build tool which was first released in 2000. The limitations found in Make tool led to the Java Community to experiment different solutions such as porting Make to Java. At this same time XML was coming up into prominence as a build tool. Combining the power of both these approaches led to the Apache Ant build tool. Being fully cross platform , a set of instructions are writted in Java to basic operations like compilation and file manipulation. Besides being cross-platform it is also an extremely flexible and powerful system, with Ant Tasks for most things we want to do. Despite of being powerful, it comes with certain drawbacks namely the build scripts have to be written in XML (not quite pleasant for human readability), a lot of time has to be spent in performing tasks (writing boiler plate to compile, create jars, run tests etc) due to lack of a real domain concept. Ant files are poorly factored and tend to get really long, it wont be surprising if we see thousands of lines long.
Maven is another build tool that was released in 2004. Maven was built to overcome the problems that were faced in the Ant tool. Maven still has use of XML but relatively less when compared to the Ant tool. Maven guaranties that it will perform any kind of build, deploy, test and release task with a single command as long as we conform to the structure dictated by Maven. The disadavntage lies in the fact that we have to conform to the Maven structure, if we dont follow the Maven structure then it is almost impossible to make Maven do what we want. Another disadvantage lies in the fact that it uses an external DSL (Domain Specific Language) written in XML, which means that if we want to extend it then we have to spend a lot of time learning something extra and making it work. Maven might also end up creating issues since it continuously tries to automatically upgrade itself every time it runs, this means some plugins might end up failing and we wont be able to reproduce our builds.
Build tools are usually used to perform pre-checks in the code before they are sent out for testing and deployments. Consider a scenario where there are hundreds of developers working on the single project. Each developers have certain unique coding style. If each developer commits their changes according to their style or ideology, there would be hundreds of different styles leading to inconsistencies all over code base. This is where build tools come into picture. As seen in our class the use of html checker allowed developers to deploy only after the checks were successful. There are other aspects and uses of build tools too. The build tools performs dependencies check, improve compile and link time and reduces the bad builds. PyBuild is one of the build tools which is largely based for Python Projects. PyBuild supports all the standard features of a typical build tools. There are tons of plugins created by Python developers to support easy building of Python Projects. The plugins are present for the following areas in Build:
- Unit Testing
- Measuring Unit Test Coverage
- Linting Python Source
- Python Checker
What is SonarQube?
SonarQube is open source tool written in Java that helps to analyze the quality of the source code. It has the ability to analyze the source code in 20+ language. Code analysis step can be used manually by executing sonar runner but however the best use of SonarQube is during the build process. If SonarQube integrated with Jenkins server it can provide continuous Integration and reports based on the analyzis of the code. SonarQube is known for the integration of the various technologies to analyze the code in a single version.