Channels ▼
RSS

.NET

A Build System for Complex Projects: Part 5


Gigi Sayfan specializes in cross-platform object-oriented programming in C/C++/ C#/Python/Java with emphasis on large-scale distributed systems. He is currently trying to build intelligent machines inspired by the brain at Numenta (www.numenta.com).


A Build System for Complex Projects: Part 1
A Build System for Complex Projects: Part 2
A Build System for Complex Projects: Part 3
A Build System for Complex Projects: Part 4
A Build System for Complex Projects: Part 5


This is the fifth and last article in a series of articles that explore an innovative build system for complicated projects. The previous articles discussed build systems in general and the internals of the ideal build system that can integrate with existing build systems. Part 1 and Part 2 discussed build systems in general and the internals of the ideal build system that can integrate with existing build systems. Part 3 discussed in detail how to the ideal build system works with the NetBeans IDE and can generate its build files. Part 4 did the same for Microsoft Visual Studio. This installment (Part 5) focuses on testing the flexibility of ibs (short for the "Invisible Build System) and how to extend it in response to new requirements. The complete source code and related files are available here.

Kicking the Tires

ibs was deployed and used as the build system for "Hello World - Enterprise Platinum Edition". The development team started to see how it does. The premise of ibs is that the developers will just add or remove files, directories, libraries, and programs and never need to muck around with build files.

Adding a File

The H team is responsible for the "hello" library that consists of two files called hello.hpp and hello.hpp. Here is the hello.cpp file:


#include "hello.hpp"
std::string HelloProvider::getHello()
{
  return "hello";
}

This file implements the HelloProvider::GetHello() method that returns the string "hello". The H team felt that putting all the eggs in one basket makes it difficult for multiple team members to work in parallel. They decided that it makes more sense to use divide and conquer approach. The new design calls for two new functions -- get_he() and get_llo() -- thatwill be used by the getHello() method. Here is the code for the two new functions that are placed in a file called helpers.cpp with the prototypes in helpers.hpp:


#include "helpers.hpp"
std::string get_he()
{
    return "he";
}
std::string get_llo()
{
    return "llo";
}

The getHello() method in hello.cpp now uses these functions:


#include "hello.hpp"
#include "helpers.hpp"

std::string HelloProvider::getHello()
{
  return get_he() + get_llo();
}

The new helpers.cpp and helpers.hpp files were added to the all the relevant build files automatically by ibs (requires running build_system_generator.py).

Here is the relevant part of the NetBeans configurations.xml file:


<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="45">
  <logicalFolder name="root" displayName="root" projectFiles="true">
    <logicalFolder name="HeaderFiles"
                   displayName="Header Files"
                   projectFiles="true">
      <itemPath>hello.hpp</itemPath>
      <itemPath>helpers.hpp</itemPath>
    </logicalFolder>
    <logicalFolder name="ResourceFiles"
                   displayName="Resource Files"
                   projectFiles="true">
    </logicalFolder>
    <logicalFolder name="SourceFiles"
                   displayName="Source Files"
                   projectFiles="true">
      <itemPath>hello.cpp</itemPath>
      <itemPath>helpers.cpp</itemPath>
    </logicalFolder>
    ...

All the other build files were also updated and the new files show up in the NetBeans IDE after reloading the project. Bob recommended to the developers that they should close the NetBeans project group (or the Visual Studio solution) before running ibs and reopen it after ibs is done to make sure the IDE is up to date.


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