PowerBuilder Reviews and Articles

Al Soucy

Subscribe to Al Soucy: eMailAlertsEmail Alerts
Get Al Soucy: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


PowerBuilder: Article

PowerBuilder Product Review: PowerGen by E. Crane Computing

The proven workhorse for PowerBuilder build automation

We discovered PowerGen when we were looking for a command line utility for importing objects into PowerBuilder. At the time (PowerBuilder V5.0) we were struggling with a source control system whose SCC-API interface was having all kinds of trouble with PowerBuilder (as most source control systems did at the time). As a result we cobbled together our own check-in/check-out utility using PowerGen's command line operations.

In the course of that exercise we invited the vendor, E. Crane Computing, to come to our offices and make a PowerGen presentation. What we found out, of course, is that importing objects was just a sideline of PowerGen's major strength of automating the entire build process for PowerBuilder applications. We've been using PowerGen ever since and it's a staple in our environment.

What is PowerGen?
Since its first release PowerGen has been focused exclusively on automating the build process for PowerBuilder applications. First released for PowerBuilder V4, it has allowed for a consistent build methodology through all succeeding PB versions.

It has two major functions. The first is producing PB deliverables from PBLs. To do this it offers regeneration, PBD and DLL creation, and EXE creation. To support the users' complete automation requirements it also includes, copy, import, export, and optimize functions. With a separate utility VersionEdit, delivered with PowerGen, it can also modify version resource information. (VersionEdit also works with any standard Windows executable such as EXE and DLL.)

The second major function is producing PBLs from source objects. Starting with only the PB objects in their *.sr* exported source format, PowerGen can create PBLs and repopulate them with their constituent objects. First introduced for PB 5.0, this function is called Bootstrap Import (a term since appropriated by other products). It allows "source traceable builds," an essential element of a good Software Configuration Management (SCM) process. It also lets you maintain only object-level source in your Source Control system, without resorting to versioning PBLs, which was never a good practice.

A sister function of the Bootstrap Import, the Synchronize function, will update a set of PBLs with modified source. In the Synchronize function PowerGen examines each object in the PBL and compares it with the exported source. It updates the object in the PBL only if it's changed. It also adds new objects, represented in export files, but not present in the PBL, and removes objects that exist in the PBL, but have no corresponding source. The advantage of the Synchronize function over the Bootstrap Import is that the Synchronize function is usually an order of magnitude faster.

The PowerGen 'Project'
A PowerGen project consists of one or more PB applications.

New projects are created from existing PB applications defined in Targets, Workspaces, and PB.INI files. A project can also be created by choosing the application PBL and adding the libraries individually. (See Figure 1)

When presented in the PowerGen's GUI, the applications in the project are shown in the top list and the PBLs in the selected application are shown in the bottom list. Note that the paths used in the project can be specified as "relative paths." This allows for greater portability between specific build environments. PowerGen provides a lot of control for the build process. Each PBL is marked as included or excluded from the regeneration process. This has proven efficient for applications sharing PBLs, because the shared PBLs are regenerated the first time they appear and are then subsequently just referenced in the library list. This saves time in the build. Likewise PBDs or DLLs can be created selectively for each PBL, avoiding redundant operations. Each PBL can be turned into its own PBD or its objects can be included with the EXE. Another useful feature is that PowerGen will relocate the deliverables, PBDs/DLLs/EXE to a specified directory. Finally, as part of the build process PowerGen can, optionally, optimize the PBLs. One capability unique to PowerGen is that it can create a mix of PBDs and DLLs for a single application. Although DLLs (machine code) haven't been widely used, there are cases where specific functions in an application will benefit. If those functions are confined to just one or a few PBLs then PowerGen can create DLLs for just those PBLs. This functionality provides an opportunity to optimize the delivery environment without unduly burdening the build environment.

The project is saved as a separate file with a .gen extension. The file is ASCII and is fully documented with the understanding that users may want to modify or create their projects programmatically. Although the information saved in the project file has been expanded through the various releases of PowerGen, each new PowerGen version can open any previous version's projects. See Listing 1. Most of PowerGen's options are saved in the project file although a few are saved in the registry. The ones saved in the registry are judged to be more germane to the build environment than a specific project. For example, the option of whether the resulting PB applications exhibit "New Visual Styles" is saved in the Registry.

Command Line and GUI
All of PowerGen's functions can operate from the GUI or the command line. PowerGen 1.0 (for PB4) was delivered with a command line interface and it has been maintained in compatible form to the current release V6.5 (supporting PB5 through 10.5). The priority of compatibility in the command line syntax means that a PowerGen script written for PowerGen 1.0 will operate without change with PowerGen 6.5.

The command line syntax generally consists of "switches" introduced by a slash (/) with parameters separated by spaces. Command lines can be simple. For example, Pwrgn105.exe /A=Examples.gen will build all of the applications defined in the project, Examples.gen. This means it will regenerate the PBLs and create PBDs and EXEs as defined in the project. (See Figure 2)

Note that the name of the PowerGen EXE corresponds to the version of PB that you're using; Pwrgn105.exe corresponds to PB10.5.

A more complicated example is:

Pwrgn105.exe /K=Examples.gen /PBG /P=PBExamfe.pbl /RP /L=Example.log /A=Example

This command line synchronizes an individual PBL, PBExamfe.pbl in the example application defined in the project file, Examples.gen. The /PBG switch indicates that the synchronize function should use the corresponding PBG file, PBExamfe.pbg, to get information about the objects that belong in the PBL. The /RP switch specifies doing a full regeneration following synchronization and the /L parameter names the file where the output log is saved.

PowerGen signals a failure from a command line operation by writing a file containing an error code. Scripts can be branch-based in the absence or existence of the file. For example:

If Exist Power1.err Goto ERROR
(next operation)
Goto END
:ERROR
Echo Error Building Examples
:END

You can see the scripts that we use at NH-DHHS on the E. Crane Web site on their support pages, http://ecrane.com/scripts.htm.


More Stories By Al Soucy

Al Soucy is software configuration manager at the State of New Hampshire's Department of Information Technology (DoIT). In that role Al manages software configuration for dozens of PowerBuilder applications as well as applications written in Java, .NET, and COBOL (yes, COBOL). Al plays bass guitar, acoustic guitar, electric rhythm/lead guitar, drums, mandolin, keyboard; he sings lead and back up vocals and he has released 8 CDs.

Comments (3) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
PBDJ News Desk 07/29/06 08:54:09 AM EDT

We discovered PowerGen when we were looking for a command line utility for importing objects into PowerBuilder. At the time (PowerBuilder V5.0) we were struggling with a source control system whose SCC-API interface was having all kinds of trouble with PowerBuilder (as most source control systems did at the time). As a result we cobbled together our own check-in/check-out utility using PowerGen's command line operations.

PBDJ News Desk 07/28/06 10:25:40 AM EDT

We discovered PowerGen when we were looking for a command line utility for importing objects into PowerBuilder. At the time (PowerBuilder V5.0) we were struggling with a source control system whose SCC-API interface was having all kinds of trouble with PowerBuilder (as most source control systems did at the time). As a result we cobbled together our own check-in/check-out utility using PowerGen's command line operations.

PowerBuilder News Desk 07/28/06 09:53:23 AM EDT

We discovered PowerGen when we were looking for a command line utility for importing objects into PowerBuilder. At the time (PowerBuilder V5.0) we were struggling with a source control system whose SCC-API interface was having all kinds of trouble with PowerBuilder (as most source control systems did at the time). As a result we cobbled together our own check-in/check-out utility using PowerGen's command line operations.