How to use PowerGen and PowerVCS to Automate the PowerBuilder Build Process:

3. Build PowerBuilder applications from the latest checked in source

Using PowerVCS and PowerGen in concert, you can construct a set of PBLs that represent the latest source and build the application from them. To construct the PBLs you use a process called “Bootstrap Import” (invented by E. Crane for PowerBuilder applications). In this process you start with a set of PowerBuilder object source files that have been saved in PowerVCS. These files are retrieved to the file system in the same folder arrangement as exists in PowerVCS. Then PowerGen uses the folder structure to create the PBLs and populate each one with objects included in the corresponding folder (See "How to Set Up PowerBuilder for Source Control with PowerVCS"). This is the Bootstrap Import process. The Bootstrap Import process is complicated by the fact that PowerGen (via a PowerBuilder API to its build functions) regenerates objects as it imports them into PBLs. This regeneration process only functions without significant errors if the source objects are parsed an imported incrementally in a 3-phase import. This all happens automatically with PowerGen, but is logged in detail in PowerGen’s output log so you can review exactly what happens.

The steps below show this process in more detail.

Retrieve all the files for the project by using the get command from the command line:

PowerVCS get –f *.* -t c:\build –p –r > log.txt

The parameter –f (for from) specified the files you are getting from the Repository. The –t (for to) parameter specifies where in the file system you want the files. The –r parameter specifies that you want to recurse the sub folders in the Repository and the –p parameter specifies that you want to preserve the folder structure in the file system to be the same as that in the Repository. The redirection symbol, ‘>’, means that the results will be redirected to file.

The beginning of the log file looks like:

And the resulting file system looks like:

with each folder containing the objects for the corresponding PBL.

Now you can open PowerGen and perform the build from the objects you have just retrieved from PowerVCS.

The Bootstrap Import will create PBLs and populate them with the objects you have retrieved from PowerVCS, using the Object List File to determine which object files are imported to which PBLs. In PowerGen you can start the Bootstrap Import by selecting Application->Bootstrap Import->From OLF... and selecting the OLF that you created earlier. You will see an output log that documents all the details of the import process.

At the completion of the Bootstrap Import you will have a set of PBLs which have been constructed entirely from the source controlled by PowerVCS.

From this point you can run other PowerGen functions, including Application->Build which regenerates the PBLs, creates PBDs and EXEs, according to wide variety of options that you can specify (refer to the PowerGen documentation for this). PowerGen also includes a utility (VersionEdit) that lets you create and modify version resources in the EXEs that you create. VersionEdit has a GUI and a command line interface, so you can easily integrate it into your build scripts. Also include with PowerGen is a utility (PBCodeSign) that lets you digitally sign your executable to assure your users that the application comes from a “trusted source” (you).