If you are creating an automated build process for an EGL application, you willwant the build to start with an empty workspace and load the application sourcefiles from the latest committed changes in the Source Control Manager repository.This example demonstrates how to use Ant builds to:
- Unzip an empty workspace and load a project into the workspace from a Concurrent Versions System (CVS) or a Rational Team Concert (RTC) repository.
- Capture and archive your own empty workspace.
- Download headlessProjectLoadDemo.zip and unzip the following files into a temporary file directory. Refer to the Appendix at the end of this blog entry for a description of each of the files you unzipped.
- Edit setRBDEnvironment.cmd and change variable settings as necessary to be correct for your installation of RBD.
Loading a Project from a CVS Repository
From your temporary directory, run command file runLoadFromCVS.cmd. The command file loads one Java project fromthe Eclipse EDT open source repository.
When loading from a CVS repository, you identify the projects you want to load in an Eclipse project set (.psf) file. The command file uses the RAD projectSetImport Ant task (shipped in RBD) to import the projects named in the project set file. Which project is loaded by this sample is notimportant; the purpose is to show how to load a project from CVS.
You can create a project set file for projects in your own repository by checkingout the projects into RBD and clicking on “Export, Team, Team ProjectSet”. The command is a misnomer; it doesnot export the projects you select. Instead it creates a project set file with an entry for each projectidentifying the project, branch, and team server from which the project can bechecked out or loaded.
Loading a Project from a Rational Team Concert Repository
Youwill need to install the RTC Eclipse Client intoyour RBD IDE before running this sample. Then, from the temporary directory, run command file runLoadFromRTC.cmd. The command fileunzips an empty workspace and downloads a small EGL project from the Jazz communitysandbox.
WithRTC, you specify the projectsthat you want to load by defining a “repository workspace” to RTC and include the projectsyou want to load in the repository workspace. The command file uses the teamFetch Ant task toload the projects from the repository workspace into the local RBD workspace.
Capturing your own Empty Workspace
Theempty workspaces used in this example have already been captured. When you are ready to apply the examples toyour own situation you will want to capture your own empty workspace withpreferences set according to the needs of your developers.
Tocapture a workspace:
- Switch to a new workspace in RBD.
- Set workspace preferences as you want them to be for your build.
- If you are using CVS, define a connection to the repository fromwhich your build will load projects.
- Shut down RBD.
- Use the captureWorkspace command file to zip up the workspace:
captureWorkspace d:\workspace_CVS workspace_CVS.zip OtherSource Control Managers
Use the SVN command to checkout the projects you want to build into alocal directory. Then use the RAD projectImport Ant taskfrom your command file to import the project from the local directory into yourRBD workspace.
Youcan export project set files with an “SVN nature” if the Subversive Team Provider is installed in your RBD,but the projectSetImport Ant task does not appear to work with SVN project setfiles.
If you have the Eclipse GIT Team Provider installed on your IDE, youcan export project set files with an “Git nature” for projects shared on a Gitrepository. You can use the projectSetImportAnt task to load the projects named in the project set file.
Use cleartool subcommands or clearcase Ant tasks toload a snapshot view of the projects you want to build. Then use the RAD projectImport Ant task fromyour command file to import the project from the local directory into your RBDworkspace.
Appendix: Files provided in the example
- setRBDEnvironment.cmd - identifies workspace andRDB jar files for running IDE in headless mode
- captureWorkspace.cmd - zips up workspace
- runAntInIDE.cmd - launches Eclipse Antrunner in your RBD workspace
- runAntCmd.cmd - launches Ant buildoutside of the IDE
- runLoadFromCVS.cmd - unzips workspace andloads project from CVS repository
- runLoadFromRTC.cmd - unzips workspace andloads project from RTC repository
- UnzipWorkSpace.xml - unzips workspace
- ZipWorkSpace.xml - zips workspace
- LoadProjectSet.xml - loads projects usingprojectSetImport task
- LoadRepositoryWorkspace.xml - loads projects from RTC repository workspace usingteamFetch Ant task
- workspace_CVS.zip - zipped workspace withconnection to Eclipse CVS repository
- workspace_RTC.zip - zipped workspace, noconnection defined
- projectSet_CVS.psf - set of projects to importfrom CVS
- password.txt – encrypted RTC password