Executing a Command Line Utility
When developing software, it is common to incorporate external command-line
tools as a part of the build and deployment process. In this example, we will
see how to automatically execute a command line utility on a remote build server.
Let's assume we're building a website. Developers enjoy a fully commented and
nicely spaced JavaScript file to work with in their project. On the web server
however, you may wish to use the smallest possible file size to save bandwidth.
With BuildMaster, you can have the best of both worlds by performing the
minification process during an automated build. Using an Execute Command Line
action during the deployment, we can take advantage of the
Microsoft Ajax Minifier tool
and minify the JavaScript.
For this example, I have the ajaxmin executable and a website with the script to
be minified already on the remote server (usually previous actions in your BuildMaster
deployment plan would have put them there):

All I need to do is add the Execute Command Line action to the deployment plan
filling in the appropriate arguments for the ajaxmin executable, in this case:
/s /hc example.js /o example.min.js. Notice that the "Server" is listed
as "Build Server", which means that when the build execution occurs, BuildMaster will
run this action on that server.

Now, every time I execute a build, my example.js file will be minified into example.min.js.

In my example, I used two separate file names to compare them, but you may wish
to use the same file name for the output file so that you do not have to modify
any script tags in your web site. Here is a comparison of the files:

It's worth mentioning that BuildMaster will log all stdout and stderr messages
(and consequently fail the build if stderr is written to). When the build
execution is complete you can see an overview of all the actions executed on
the Build Details page:

Once you are able to get one Execute Command Line action up and running, it's
trivial to use your imagination to automate virtually anything as part of your
deployment process. Some other examples include:
-
A Code Signing tool that digitally signs your executables before they are published
-
A utility that builds an installer
-
Any source control system, unit testing framework, or build tool that we do not
already integrate with directly
-
A custom tool you have already written
Related Content
Haven't found what you're looking for? Try some of the content below.
Documentation
Tutorials
Support Questions