SparkBuild: A Free Build Avoidance Tool
Join the DZone community and get the full member experience.Join For Free
just a few weeks ago, electric cloud launched the first ga version of
, a free
-based build tool that offers true build avoidance. windows and open source linux developers writing software in c/c++ will find that sprarkbuild can add significant agility to their build process, says scott castle, the product manager for the electricaccelerator product line. dzone spoke with castle about what sparkbuild can do and where it came from. "we're really directing ourselves at individual developers who want to improve how they write software," said castle. sparkbuild uses build avoidance technology for c/c++, which is similar to what ant does for java.
sparkbuild is a package containing two components: sparkbuild emake for build automation and sparkbuild insight for build analysis. the package contains several benefits offered in electric cloud's commercial tools, such as annotation and build analysis it even offers some techniques that haven't been implemented yet in electric cloud's proprietary software, such as subbuild compiling. sparkbuild emake and insight are derived from electricaccelerator and electricinsight - two electric cloud commercial tools.
electric cloud's parallel build tool, electricaccelerator, was the inspiration for sparkbuild, said castle. "over the years, we had to solve a number of build problems for ourselves. we had implemented agile just like many companies had and we needed to get faster builds for developers." castle said they had the fast, 'full build' problem solved with electricaccelerator, but the electric cloud developers, like many programmers, do small incremental changes up to fifty times a day just running "make all" and recycling the build over and over. "so we came up with some interesting technology to make that faster and more reliable, and we decided to productize that, make it free, and provide it to the community," said castle.
true build avoidance
the key feature of spark build is build avoidance. build avoidance has been around for some time as a way to reduce build times by rebuilding only the pieces that need to be rebuilt, and not the whole code base. castle says it's lighter, and usually smarater, than the brute force approach, which involves throwing more hardware at the problem. castle says build avoidance solves the daily dilemma of whether a developer should build software slow and safe, rebuilding the whole source code frequently, or build fast and dangerous by skipping parts of the build. tools like ccache and clearcase winkins have co-opted the term build avoidance , but they are actually doing object reuse . castle said object reuse is when you use objects that other people have compiled in order to skip compiling those yourself. object reuse only works in narrow scenarios he says, and it can be a headache to manage. castle also mentioned a more traditional build avoidance tactic - an incremental build from the top of the build tree. "it basically means, 'look at my source base, find all the sources that have been modified since the last time i built the source code, and just recompile those,'" said castle. that works pretty well for simple builds, he said, but for more complex codebases in apache and mozilla projects, an incremental build is slow, wasteful, and unreliable.
to build only what needs rebuilding, sparkbuild uses subbuilds. using subbuilds allows developers to skip entire swaths of the build tree by building only the parts of the tree that are relevant to what they're working on at the moment. the build avoidance method makes the edit-build-test cycle a lot faster, and developers don't have to deal with incremental builds that can easily break.
the dependency graph below shows the agent component (util, xml, http libraries, and the agent application code) as solid. sparkbuild can recognize that only this component needs to be rebuilt.
"what sparkbuild does, is it can calculate exactly what's relevant to just the piece that you're trying to build," said castle. for example, castle says if you want to build just the mysql back end database and not the front end user interface or utilities, sparkbuild can rebuild just that part. this can make the build run up to ten times faster with the same quality as any other build, and with more accurate runtimes.
sparkbuild emake can also emit xml-annotated build logs or annotation. the additional information includes:
- the environment and working directory used to run each command.
- the exact, expanded command-line of each command — even those that were run in “silent” mode with the @ prefix.
- the runtime of each command.
- the relationship between submakes in the build.
- the build dependency graph.
developers who didn't get this information sometimes had to put date commands into makefiles for performance measurement. sparkbuild provides sophisticated build analysis using standard xml processing tools.
spark build insight fulfills most developers' build analysis needs. the analysis tools calculate the amount of time spent on different types of work, including compiling and links. developers can see the specific targets associated with each type of work and drill down into targets to see the commands executed and the output from those commands. sparkbuild insight also searches for targets using numerous criteria like runtime, commands, name, and type of work.
to communicate what sparkbuild can do and to show people how to use it, electric cloud built a community website where forum moderators are especially responsive. the site's been up for only a month and it includes detailed blogs and videos telling you how to best leverage sparkbuild. castle said the sparkbuild project is not part of any product strategy, but instead, it's about giving some of the benefits of electric cloud's innovations to individual developers. he says sparkbuild is aimed at individual programmers who are trying to embrace a lighter, more agile development strategy.
there are more features and integrations planned for sparkbuild. "we're heading in two main directions," said castle. "because sparkbuild is based on technology for our commercial products, we're dragging more of that commercial technology into the free product." alongside that, they're also considering support for ant or scons , but castle says feedback from the sparkbuild community will be a key factor for the direction of the product.
here is a 10-minute 'self-pilot' for sparkbuild.
Opinions expressed by DZone contributors are their own.