Creating a UCM Build Tools Structure


If you are using UCM, the process is similar but requires additional steps to create UCM objects. In addition, I will demonstrate how some of the more powerful capabilities of UCM work, such as baselines and composite components, to show you how they can be used in practice.

Create a UCM Project VOB

First, create a UCM project VOB (PVOB). A PVOB is not intended to hold any real data, such as source code. Instead, it is a specific repository for holding UCM metadata, such as projects, streams, and activities. Usually, one PVOB is shared across many teams; however, there is no reason that there can't be more than one of them if teams are isolated and have no reason to share code or changes. A PVOB might already have been created for you. However, for the sake of completeness, I will describe the process required to create it here; the command to do this is shown in Listing 3.5.

ClearCase LT and the PVOB

One of the main limitations of ClearCase LT is that you can have only a single PVOB. Consequently, if you intend to use ClearCase LT and a PVOB already exists, you have to reuse it. If this is the case, you need to replace the PVOB tag that is used in the following listings (\RatlBankProjects) with the name of your existing PVOB tag.


Listing 3.5. Creating a UCM Project VOB

[View full width]

>cleartool mkvob -tag \RatlBankProjects -c "Rational UCM project VOB" -ucmproject -public  -stgloc ccstg_d_vobs

This creates a PVOB called RatlBankProjects. There is no need to mount the UCM PVOB because it will not be accessed directly.

Create a Build Tools VOB

Next, create a Base ClearCase VOB (which will later be turned into UCM components) and a temporary Base ClearCase view. This can be achieved using the commands shown in Listing 3.6.

Listing 3.6. Creating a UCM JavaTools VOB

>cleartool mkvob -tag \JavaTools -c "JavaTools VOB" -public -stgloc ccstg_d_vobs >cleartool mount \JavaTools >cleartool mkview -snapshot -tag temp_view -stgloc ccstg_d_views C:\Views\temp_view >cd C:\Views\temp_view >cleartool update -add_loadrules JavaTools

The reason that a Base ClearCase view is created is that a view context is required to execute some of the following cleartool UCM commands.

Create the Build Tools Components

Next, you should turn the Base ClearCase VOB into a UCM VOB so that it can contain the build tools components. This can be achieved using the commands shown in Listing 3.7.

Listing 3.7. Creating UCM JavaTools Components

[View full width]

>cd C:\Views\temp_view\JavaTools >cleartool mkcomp -c "JavaTools composite component" -nroot JAVATOOLS_BL@\RationalProjects >cleartool mkcomp -c "Ant component" -root ant ANT@\RatlBankProjects >cleartool mkcomp -c "CruiseControl component" -root cruisecontrol CRUISECONTROL@ \RatlBankProjects >cleartool mkcomp -c "Groovy component" -root groovy GROOVY@\RatlBankProjects >cleartool mkcomp -c "Java Development Kit component" -root j2sdk J2SDK@\RatlBankProjects >cleartool mkcomp -c "Generic libraries component" -root libs LIBS@\RatlBankProjects

This creates the following components:

  • JAVATOOLS_BL A composite baseline component that does not hold any data. Instead, it holds composite baselines that can be used to refer to compatible versions of all the other components.

  • ANT This component holds your installed version of Apache Ant.

  • CRUISECONTROL This component holds your installed version of CruiseControl.

  • GROOVY This component holds an installed version of the Groovy scripting language.

  • J2SDK This component holds the recommended version of the JDK for building against.

  • LIBS A generic component that holds internally developed and third-party libraries.

This list of components is not prescriptive; you might like to create more or fewer components.

Specifying VOB Selectors from the Command Line

If you frequently use UCM and the command line, you need to get used to using VOB selectors. Since all the UCM metadata is usually stored in a separate UCM PVOB, whenever you are working with a particular UCM object, you also need to specify this PVOB. The syntax for this is usually in the form vob_object@\PVOB (on Windows) or vob_object@/vobs/PVOB (on Linux or UNIX), where the @\PVOB part is called the VOB selector. For example, if you wanted to refer to a UCM integration stream called Foo_Int, and you had a PVOB called Foo_Projects, you would need to refer to the stream using Foo_Int@\Foo_Projects (on Windows) or Foo_Int@/vobs/Foo_Projects (on Linux or UNIX).


Alternatively, you can start the ClearCase Project Explorer GUI, right-click the Components folder, and select New, Component in a VOB. This brings up the dialog box shown in Figure 3.3, in which you can enter the details about the component to be created.

Figure 3.3. Creating a UCM component in the UCM Project Explorer


Create a Build Tools UCM Project

Now that the components have been created, the next stage is to create a UCM project and stream for accessing their data. This can be achieved using the commands shown in Listing 3.8.

Listing 3.8. Creating a UCM JavaTools Project and Stream

[View full width]

>cd C:\Views\temp_view\JavaTools >cleartool mkproject -c "JavaTools Project" -mod ANT@\RatlBankProjects, CRUISECONTROL@ \RatlBankProjects,GROOVY@\RatlBankProjects, J2SDK@\RatlBankProjects,LIBS@\RatlBankProjects  -in RootFolder JavaTools_Proj@\RatlBankProjects >cleartool chproject -bln component,basename JavaTools_Proj@\RatlBankProjects >cleartool mkstream -integration -in JavaTools_Proj@\RatlBankProjects JavaTools_Int@ \RatlBankProjects

The first cleartool command creates a UCM project called JavaTools_Proj, specifying that it will be able to modify all the components created previously. It also specifies that the project is created in the RootFolder. The RootFolder is just a reference to a top-level virtual directory; if you want to, you can create folders to contain collections of related projects. The second command changes the project's baseline naming template, specifying that the format for each baseline will be of the form COMPONENT_BASENAME. You specify the basename when you create a new baseline. For example, if you create a new baseline in the ANT component by specifying a basename of 01_INT, the baseline ANT_01_INT is created. Baseline naming templates are a good way of automating and ensuring baselining consistency. Finally, the third command creates an integration stream for this project called JavaTools_Int.

Alternatively, you can use the ClearCase Project Explorer GUI, right-click the Project VOB folder, and select New, Project. This brings up the New Project wizard, as shown in Figure 3.4, which guides you through the process of creating a new project.

Figure 3.4. Creating a UCM project in the UCM Project Explorer


Create a Build Tools View

The next stage is to create a view onto the integration stream. This can be achieved using the commands shown in Listing 3.9.

Listing 3.9. Creating a UCM JavaTools View

[View full width]

>cleartool mkview -snapshot -tag javatools_int -stream JavaTools_Int@\RatlBankProjects  -stgloc ccstg_d_views C:\Views\javatools_int >cd C:\Views\javatools_int >cleartool update -add_loadrules JavaTools >cleartool rebase -baseline JAVATOOLS_BL_INITIAL@\RatlBankProjects, ANT_INITIAL@ \RatlBankProjects, CRUISECONTROL_INITIAL@\RatlBankProjects, GROOVY_INITIAL@ \RatlBankProjects, J2SDK_INITIAL@\RatlBankProjects, LIBS_INITIAL@\RatlBankProjects -complete

The final rebase command is required to make sure that the view that has just been created is based on an appropriate baseline of all the components. Although no elements have been imported so far and this baseline is not that interesting, it is still required.

Alternatively, you can use the ClearCase Project Explorer GUI to join a project by right-clicking the project and selecting Join. This brings up the Join Project wizard, as shown in Figure 3.5, which guides you through the process of creating a new view onto the integration stream, as well as a new development stream and view if required.

Figure 3.5. Joining a project in the UCM Project Explorer


Import the Build Tools

The build tools view can now be used to import the build tools and add them to version control. Chapters 4 and 6 discuss how to compile and install Ant and CruiseControl; however, the process is the same irrespective of the tool being imported. You can either navigate to the relevant JavaTools component directory and copy the files in, or, if there is a significant amount of data to import, you can use the ClearCase clearfsimport command instead. For example, if you wanted to import a version of the JDK into the JavaTools VOB, if the JDK was currently located on the file system at C:\j2sdk_1.4.12, you could use the following commands to import it into the VOB:

>cd C:\Views\javatools_int\JavaTools\j2sdk >cleartool mkactivity "Initial Import" >clearfsimport -recurse C:\j2sdk_1.4.12\* .


This imports and version-controls every file under C:\j2sdk_1.4.12 into the JavaTools j2sdk component directory. Note that before you execute the import process, with UCM you need to specify that activity under which ClearCase check-ins should be associated. In this case it is an activity called Initial Import. This also assumes that the integration with ClearQuest has not yet been enabled for this project. If it has, the activity needs to be created from ClearQuest instead.

ClearQuest-Enabled UCM Projects

If you will use ClearQuest integrated with ClearCase UCM, the activity-creation process might require you to enter additional information, such as a description or severity (which is usually carried out from the ClearQuest GUI). Therefore, for initial project setup, it is sometimes worth leaving the ClearQuest integration disabled and then enabling it at a later date when this setup has been completed.


Baseline the Build Tools

After you have imported all the elements you require, you can finally place a baseline across them. At this stage you also can create the dependency from the composite baseline component to the other components. This can be achieved using the commands shown in Listing 3.10.

Listing 3.10. Creating a UCM JavaTools Baseline

[View full width]

>cd C:\Views\javatools_int\JavaTools >cleartool mkbl -full -component JAVATOOLS_BL@\RatlBankProjects -adep ANT@ \RatlBankProjects,CRUISECONTROL@\RatlBankProjects, GROOVY@\RatlBankProjects,J2SDK@ \RatlBankProjects LIBS@\RatlBankProjects 01

In this example, a composite baseline JAVATOOLS_BL_01 is created, as well as baselines in any component that has been changed, such as the J2SDK component.

Alternatively, you can use the ClearCase Project Explorer GUI to edit the baseline dependencies, right-click the project integration stream, and select Edit Baseline Dependencies. This brings up the window shown in Figure 3.6, which allows you to drag and drop components to create the baseline hierarchy you require.

Figure 3.6. Creating baseline dependencies in the UCM Project Explorer


Once you have specified the dependencies, you are asked the name of the new baseline to be created. You would simply specify a basename of 01, as shown in Listing 3.10.

Make the Build Tools Available to Your Users

Once the JavaTools structure has been created and baselined, it can be made available to other projects. This can be achieved by adding the JAVATOOLS_BL components to any UCM project that is created, ensuring that the correct baseline is recommended. This will subsequently pull in the baselines for the other components. For example, Figure 3.7 illustrates the configuration of a new UCM project created using the New Project wizard.

Figure 3.7. Creating a new project configuration using the UCM Project Explorer


To prevent users from making any changes to the JavaTools structure, you should make the components read-only in the UCM project.

Clean up the Temporary View

Because a temporary view was created to set up the UCM JavaTools structure, it is good practice to tidy up this view. This can be achieved using the following command:

>cleartool rmview -f C:\Views\temp_view


Note that if you still have any command prompts or Windows Explorer sitting inside this directory, you need to close them down or navigate outside this directory first.




IBM Rational ClearCase, Ant, and CruiseControl. The Java Developer's Guide to Accelerating and Automating the Build Process
IBM Rational ClearCase, Ant, and CruiseControl: The Java Developers Guide to Accelerating and Automating the Build Process
ISBN: 0321356993
EAN: 2147483647
Year: 2004
Pages: 115
Authors: Kevin A. Lee

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net