Channels ▼
RSS

Design

A Build System for Complex Projects: Part 3


Testing the NetBeans Generated Build System

Bob was pleased with ibs and he decided to put it to the test. His plan to make sure it works on Mac OS X and on Linux (Kubuntu 9.04). For each target OS Bob generated all the build files using ibs and then built all the projects both from the command line using make and from the NetBeans IDE itself. Then he proceeded to run various tests and programs.

Generate all the build files

Generating the build files is as simple as launching the build system generator. The program displays some simple progress information as it goes through the different stages.


{root dir}/ibs >  py build_system_generator.py 
--------------------
generate_build_files 
--------------------
----------------------
_populate_project_list 
----------------------
----
test 
----
----
dlls 
----
----
apps 
----
--
hw 
--
-----------------
generate_projects 
-----------------
----------------------
_generate_project world
----------------------
--------------------------
_generate_project testWorld
--------------------------
----------------------
_generate_project utils
----------------------
----------------------
_generate_project hello
----------------------
---------------------------
_generate_project punctuator
---------------------------
----------------------
_generate_project utils
----------------------
-------------------------------
_generate_project testPunctuator
-------------------------------
----------------------------
_generate_project hello_world
----------------------------
--------------------------
_generate_project testHello
--------------------------
-------------
save_projects 
-------------
------------------------
generate_workspace_files 
------------------------

Bob did a quick sanity check to verify that the nbproject directory was indeed created for each project under the src directory:


{root dir} > find src -name nbproject
src/apps/hello_world/nbproject
src/dlls/punctuator/nbproject
src/hw/hello/nbproject
src/hw/utils/nbproject
src/hw/world/nbproject
src/test/testHello/nbproject
src/test/testPunctuator/nbproject
src/test/testWorld/nbproject

At that point Isaac (the sage) heard the good news and came into the room. He wanted to personally supervise on the testing of ibs, which will soon be responsible for building the entire "Hello World - Enterprise Edition" system.

The next stage was to actually build the system using the ibs-generated build files. For starters Bob fired up NetBeans on Mac OS X, built and ran the hello_world application. This caused all its dependencies to be built and finally the application ran in its little terminal window and indeed printed the vaunted "hello, world!" message (see Figure 2).

Figure 2

Isaac was duly impressed, but not fully convinced yet. He asked Bob how ibs can handle automated tests and running outside of the NetBeans IDE. Bob was more than happy to comply and demonstrated how the test_world program can be built using the standard 'make' command from a terminal window and then executed (see Figure 3).

Figure 3

Isaac commended Bob on a job well done, but Bob wasn't done. He knew that Isaac was an old Unix hand and he proceeded to demonstrate the ibs-generated build files on Kubuntu 9.04 (in a VM). First he built the libPunctuator project in the NetBeans IDe and then the testPunctuator project (see Figure 4).

Figure 4

Bob was careful to copy the "libpunctuator.so" shared library to the directory of the testpunctuator program because the test always tries to load the shared library from the current working directory. They both noted with interest that on Kubuntu 9.04 programs run in an external terminal window (see Figure 5) as opposed to the internal NetBeans window on the Mac OS X.

Figure 5

Then, Bob demonstrated building from Kubuntu's terminal (see Figure 6).

Figure 6

Isaac felt his concerns melting away. He was now convinced that ibs is the way to go to make "Hello World - Enterprise Edition" the best hello world application on Microsoft Windows too on the way to [Hello] World Domination!

Conclusion

In this article you saw ibs in action, generating a full fledged NetBeans build system for a non-trivial system that involves multiple projects, static libraries, shared libraries, applications and test programs. ibs handled well multiple target operating systems (Mac OS X and Kubuntu 9.04) and allowed building and testing from the NetBeans IDE or externally from a terminal window. Bob demonstrated ibs successfully to Isaac his manager and in the next episode, Bob will try to make ibs build the "Hello World - Enterprise Edition" system on the Windows OS.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video