Power Builder Tutorial_5
Power Builder Tutorial_5
Applications
Synchronization of PowerBuilder Applications
to Source Control
E. Crane Computing
16 Centre Street
Concord, New Hampshire 03301
603-226-4041 http://www.ecrane.com
PowerGen White Paper
Concepts
PowerGen focuses on some of the unique problems facing PowerBuilder
development shops in managing releases and software configurations. These are
critical aspects of the PowerBuilder life cycle, since 70% of the cost of the
overall product development effort is applied to maintenance activities, of which
release management and configuration control are key elements.
2
PowerGen White Paper
3
PowerGen White Paper
4
PowerGen White Paper
5
PowerGen White Paper
A PowerGen Example
Here’s an example of how Creative Kids, a company that sells children’s toys
through catalog sales, uses PowerGen to increase the quality of their build,
improve source and release control, and enhance productivity at the same time.
Creative Kids has developed two PowerBuilder applications: one handling order
entry and the other handling customer records. Each application has its own
unique set of PowerBuilder libraries; both of these applications access a third-
party Class Framework library as well as a set of in-house Common Libraries.
6
PowerGen White Paper
7
PowerGen White Paper
Step-by-Step
This section describes the step-by-step methodologies recommended for
The Build Process
Source Traceable Builds for PowerBuilder Applications
Synchronization of PowerBuilder Applications to Source Control
Incorporating these methodologies will ensure that your build is accurate,
efficient, and repeatable, and that your application releases are reproduced from
a single source.
8
PowerGen White Paper
Few PBD’s
+ Easier installation
+ Easier packaging
+ Easier configuration control and support
- Low degree of modularity disadvantages both development
and maintenance
- Functions within the application(s) may be duplicated
Many PBD’s
+ High degree of modularity makes development and
maintenance easier
+ Functions can easily be shared between applications.
+ “Spot” updates possible
- Difficult installation
- Difficult packaging
- More difficult configuration control and support
9
PowerGen White Paper
Step 1 Example
Creative Kids has two applications – Order Entry and Customer Records—and
defines the following deliverable components for each of them. Notice that the
dynamic libraries in both the Class Framework library and in-house Common
libraries are shared between the Order Entry application and Customer Records
application.
10
PowerGen White Paper
Step 2 Example
The following PowerGen screen shows all of Creative Kid’s applications,
including the two applications Creative Kids defined in Step 1. Note that each
application is shown with its library list (the set of PBL’s from which the
application will be derived). The list of PBL’s displayed in the Library List box
depends on the application currently highlighted in the Applications box.
11
PowerGen White Paper
At this point, no applications are listed in the bottom part of the window,
because no applications have been added to the project yet. That will happen in
Step 3.
12
PowerGen White Paper
Step 3: Specify the Applications in Your PowerGen Project and Save the
Project
Now you need to specify the applications you want included in your PowerGen
project. PowerGen will build these applications in the order it sees in this project
list. Once you’ve specified the applications, you need to save the project, giving
it an appropriate file name and saving it to the directory containing the
application PBL.
Add Applications
The Select Applications for Project dialog box lists all the applications in the last
source you had specified.
If you need to select a different source, click the appropriate PB.INI, PBL,
Target, or Workspace button and browse to locate the application source.
Regardless of the source, to add an application to your PowerGen project,
simply highlight it in the Available Applications area and click the Add button.
The selected application will appear in the Applications in Project area. Note
that within a selected application, PowerGen will always build things in the
correct order automatically. When you’re finished adding applications, the
application list at the bottom of the screen should match the list of applications
you defined in Step 1. When the Applications in Project list is complete and in
the appropriate order, click OK .
Save the Project
The main PowerGen window for the project appears. PowerGen automatically
assigns a project name with a GEN extension to each new project (Power1.gen,
for example). It is recommended that you specify an appropriate name for your
project and then save it into the same directory as the application PBL.
To save the project with an appropriate name, click the Save button or choose
Project → Save. The Save As dialog appears, where you can give the project a name
with a GEN extension and browse to locate the file in the same directory as the
application PBL. Then click OK to save the project information.
13
PowerGen White Paper
Step 3 Example
The source for both of the Creative Kids applications is in the PB.INI. Creative
Kids adds the Order and Customer applications to the PowerGen project.
Once they click OK, the main PowerGen window for their project opens,
displaying the two selected applications and appropriate libraries for each
application.
14
PowerGen White Paper
Since Creative Kids does not want the assigned Power1 file name for their
project, they click the Save button and name their project creative.gen, and save
it into the same directory as the application PBL.
15
PowerGen White Paper
Step 4 Example
The named project, creative.gen, appears in the Window title area and the two
applications Creative Kids specified in Step 3 are still listed in the Applications
box of the PowerGen window.
16
PowerGen White Paper
Creative Kids uses the Options button to open the Application Build Settings
dialog box and set File Specifications for the Order application.
They use the Browse button to specify the path and name of the executable file
in the EXE Path text box and the executable support files in the other text boxes.
Creative Kids keeps the PBD’s for the Order application in the default directory
(which is the directory where the PBL is located).
Creative Kids would then specify a path to the executable for the Customer
application as well.
17
PowerGen White Paper
18
PowerGen White Paper
Step 5 Example
This screen shows the Regeneration folder at the Application Build Settings
dialog box:
Creative Kids is specifying a full regeneration for the Order application and
regenerating all objects in all of the referenced libraries for the Order
application. They have chosen not to regenerate duplicate objects.
19
PowerGen White Paper
20
PowerGen White Paper
When specifying the type of machine code output, the default is not to
optimize. If you change the defaults, you may optimize for speed or for size.
For machine code output, you may also choose to set the Trace Information
option if you intend to trace program execution (by using the /debug command
line argument with your application). Set the Error Context option to display
information about the specific object, event, and script line number in your
application when a runtime error occurs.
Step 6 Example
Creative Kids skips this step in the process. The screen below shows the Code
Generation folder at the Application Build Settings dialog box. Because
Creative Kids is using PowerBuilder Version 7.0, their default options are 32-bit
for p-code and 32-bit for machine code, with no optimization.
21
PowerGen White Paper
22
PowerGen White Paper
Step 7 Example
The screen displayed here shows the OE_MAIN library within the Order Entry
application. Creative Kids is including the objects in this PBL in the
regeneration and locating its objects in the PBD.
The list below shows the specifications Creative Kids will enter for each library
within each application in their PowerGen project.
23
PowerGen White Paper
Note that when common libraries and third party or class framework libraries
are specified within the Order Entry application, they are included in the regen
and are built with the other libraries in the application. They are excluded from
the regen (avoiding redundant regeneration) and not built when specified in the
Customer Records applications. This results in shorter build times and makes
the process more repeatable, since you are not performing the same step
(building common PBD’s) more then once.
24
PowerGen White Paper
Step 8 Example
Creative Kids has selected to optimize PBL’s when building applications and to
build EXE’s and libraries even if regeneration errors occur.
25
PowerGen White Paper
Step 8 Example
At this point, Creative Kids has kept the default log file preference options.
When Creative Kids is in the final stages of testing their build, they might select
the “Show Regen Errors only” option, to target only those errors and abbreviate
the log file output as a result.
26
PowerGen White Paper
27
PowerGen White Paper
4. Creating EXE’s
1. With the first application in the list still highlighted, choose Application
→ Create EXE.
2. When created, look for errors in PowerGen’s log file.
3. Check the directory to make sure that the executable was created
properly. Make sure the EXE can be started with no errors. Check
that the desired icon is displayed with the EXE.
4. Once you’re satisfied that this aspect is working properly, continue
testing the application by repeating this process with each of the other
applications, in appropriate order.
When the individual applications have been tested, choose Project → Build All to
build the entire PowerGen project in a batch. Review the log file, looking for
errors and making sure that PBD’s and EXE’s were created.
Step 10 Example
The following is an excerpt from the log file created from regenerating the
objects in the “Order” application.
PowerGen Version 4.2
Log Started on 7/1/01 8:41:17am
Application:
order
Library List:
d:\ck\order\oe_main.pbl
d:\ck\order\oe_dlg.pbl
d:\ck\order\oe_data.pbl
d:\ck\order\oe_item.pbl
d:\ck\order\utils.pbl
d:\ck\order\com.pbl
d:\ck\order\tabfold.pbl
d:\ck\order\grid.pbl
Regenerating Objects in Inheritance Order
DataWindows
d_ord_codelist_values_unaggr d:\ck\order\oe_main.pbl
d_ord_codelist_values_aggr d:\ck\order\oe_main.pbl
d_ord_pane_attrib d:\ck\order\oe_dlg.pbl
28
PowerGen White Paper
Structures
str_pane_layout_object d:\ck\order\oe_dlg.pbl
str_pane_layout_font d:\ck\order\oe_dlg.pbl
str_pane_layout_color d:\ck\order\oe_dlg.pbl
Windows
w_ord_base_browser d:\ck\common\utils.pbl
w_ord_codelist_browser d:\ck\order\oe_main.pbl
w_ord_codelist_export d:\ck\order\oe_main.pbl
w_ord_codelist_import d:\ck\order\oe_main.pbl
w_ord_codelist_import_create d:\ck\order\oe_main.pbl
w_ord_codelist_values_modify d:\ck\order\oe_main.pbl
w_ord_frame d:\ck\common\utils.pbl
Error C0019: Incompatible field ii_active_sheet_count—for type w_ord_frame at
line 25 of function wf_pop_sheet of object w_ord_frame
Line no: 25 Column no: 0
Error C0015: Undefined variable: i—at line 26 of function wf_pop_sheet of object
w_ord_frame
Line no: 26 Column no: 0
w_ord_page_layout_browser d:\ck\common\com.pbl
...
Log Ended on 7/1/01 8:45am
Based on the Log File preference options selected in the previous step, Creative
Kids’ log file lists all of the activities carried out in the build process, including
regeneration and PBD and EXE creation. Errors are listed with the object that
caused the error. The log output will also appear in the Output Window while
the build is running.
29
PowerGen White Paper
Step 1: Get Object Source from your Source Control System and Create
PBL Subdirectories
The first step in producing source traceable builds with PowerGen is to get the
object source from your source control system. It’s recommended that you
create a subdirectory for each PBL in the application and that you create the
subdirectory below the directory where the PBL itself is located. Once you’ve
created all the appropriate subdirectories, then place the associated objects for
the PBL into each of them.
Step 1 Example
Creative Kids has one Class Framework library, one set of in-house Common
Libraries, and two applications – Order Entry and Customer Records. They
create the following subdirectories for object source and place the appropriate
objects in them.
30
PowerGen White Paper
Note that the Common, Thrdprty, Order, and Customer directories contain the
existing PBL’s as well. In Step 3, these will be deleted so that PowerGen can
Bootstrap Import the new object source and create new PBL’s from it.
31
PowerGen White Paper
Step 2 Example
Creative Kids is building the Order Entry application first, and is including the
Class Framework and Common Library PBL’s in this application. PowerGen
creates an OLF for the Order Entry application that looks like this:
ORDER.OLF
d:\ck\order\oe_main\*.sr*, d:\ck\order\oe_main\oe_main.pbl
d:\ck\order\oe_dlg\*.sr*, d:\ck\order\oe_dlg\oe_dlg.pbl
d:\ck\order\oe_data\*.sr*, d:\ck\order\oe_data\oe_data.pbl
d:\ck\order\oe_item\*.sr*, d:\ck\order\oe_ item \oe_ item.pbl
d:\ck\common\utils\*.sr*, d:\ck\common\utils\utils.pbl
d:\ck\common\com\*.sr*, d:\ck\common\com\com.pbl
d:\ck\thrdprty\tabfold\*.sr*, d:\ck\thrdprty\tabfold \tabfold.pbl
d:\ck\thrdprty\grid\*.sr*, d:\ck\thrdprty\grid\grid.pbl
The OLF for the Customer Records application is shown below. Note that
the Class Framework and Common Library PBL’s are not included here, since
they are being created with the Order Entry application.
CUSTOMER.OLF
d:\ck\ customer\cr_data\*.sr*, d:\ck\customer\cr_data\cr_data.pbl
d:\ck\customer\cr_main\*.sr*, d:\ck\customer\cr_main\cr_main.pbl
d:\ck\ customer\cr_win\*.sr*, d:\ck\customer\cr_win\cr_win.pbl
32
PowerGen White Paper
Step 3 Example
Creative Kids now uses PowerGen to delete all libraries from the Common,
Thrdprty, Order, and Customer subdirectories. No PBL’s now exist, and each
subdirectory contains its associated object source.
33
PowerGen White Paper
34
PowerGen White Paper
Step 4 Example
Creative Kids is keeping the defaults to automatically detect
$PBHeader…information and to regenerate objects after the last Bootstrap
Import phase. They are also requesting PowerGen to automatically register the
objects for source control when Bootstrap Import is completed.
35
PowerGen White Paper
And then views the results in the Output Window. In the early phases of the
import errors may appear in the log; these may be ignored. The final error total
will only include errors encountered in the final phase.
36
PowerGen White Paper
Creative Kids then Bootstrap Imports the Customer application and views the
results in the Output Window as well.
At the conclusion of this process, PowerGen’s application list looks identical to
its appearance before Bootstrap Importing, but now the libraries listed are
populated with source.
37
PowerGen White Paper
If you have already specified the executable path, support files, regen
information, code generation information, PBL information, and build
options for your applications (Steps 4 through 8 in the Step-by-Step Build
Process described previously), then you would now proceed to testing the
build (Step 9).
If you haven’t previously specified this information, then proceed with the
PowerGen build process at Step 4.
38
PowerGen White Paper
Step 1: Get Object Source from your Source Control System and Create
PBL Subdirectories
The first step in the source and release control process with PowerGen is to get
the object source from your source control system. It’s recommended that you
create a subdirectory for each PBL in the application and that you create the
subdirectory below the directory where the PBL itself is located. Once you’ve
created all the appropriate subdirectories, place the associated objects for the
PBL into each of them.
Step 1 Example
Creative Kids has one Class Framework library, one set of in-house Common
Libraries, and two applications – Order Entry and Customer Records. They
create the following subdirectories for object source and place the appropriate
objects in them.
39
PowerGen White Paper
Note that the Common, Thrdprty, Order, and Customer directories contain the
existing PBL’s as well. These will be Synchronized with the updated source
files.
40
PowerGen White Paper
Step 2 Example
Creative Kids is Synchronizing the Order Entry application first, and is
including the Class Framework and Common Library PBL’s in this application.
PowerGen creates an OLF for the Order Entry application that looks like this:
ORDER.OLF
d:\ck\order\oe_main\*.sr*, d:\ck\order\oe_main\oe_main.pbl
d:\ck\order\oe_dlg\*.sr*, d:\ck\order\oe_dlg\oe_dlg.pbl
d:\ck\order\oe_data\*.sr*, d:\ck\order\oe_data\oe_data.pbl
d:\ck\order\oe_item\*.sr*, d:\ck\order\oe_ item \oe_ item.pbl
d:\ck\common\utils\*.sr*, d:\ck\common\utils\utils.pbl
d:\ck\common\com\*.sr*, d:\ck\common\com\com.pbl
d:\ck\thrdprty\tabfold\*.sr*, d:\ck\thrdprty\tabfold \tabfold.pbl
d:\ck\thrdprty\grid\*.sr*, d:\ck\thrdprty\grid\grid.pbl
The OLF for the Customer Records application is shown below. Note that
the Class Framework and Common Library PBL’s are not included here, since
they are being Syncrhonized with the Order Entry application.
CUSTOMER.OLF
d:\ck\ customer\cr_data\*.sr*, d:\ck\customer\cr_data\cr_data.pbl
d:\ck\customer\cr_main\*.sr*, d:\ck\customer\cr_main\cr_main.pbl
d:\ck\ customer\cr_win\*.sr*, d:\ck\customer\cr_win\cr_win.pbl
41
PowerGen White Paper
42
PowerGen White Paper
The Synchronization function compares the object source in the PBL and the
source in the object source file in order to determine which objects have
changed. The comparison can be selected as either an exact match or as one in
which blank lines are ignored. Blank lines are commonly added or removed
when PowerBuilder imports or exports an object. These lines have no effect on
the object’s function so can safely be ignored. This is the default.
Set Log File Options for Synchronization
PowerGen lets you specify whether you want the log file, when displaying
Synchronization information, to show only the objects that have been modified
(i.e., added, deleted, or imported) because a change was detected. Choose this
option by selecting Options → Log File and then making the appropriate selection
at the bottom of the Log File Save As dialog.
You would most likely not choose this option initially, but later when fewer
errors are likely to be encountered.
Step 3 Example
Creative Kids is keeping the defaults to automatically detect
$PBHeader…information and to regenerate objects after the last
Synchronization phase. They are also requesting PowerGen to automatically
register the objects for source control when Synchronization is completed, to
register new objects for source control, to delete PBL objects not synchronized,
and to ignore blank lines in comparison.
43
PowerGen White Paper
Because Creative Kids does not want the log file to show only Synchronize
differences, they do not need to open the Log File options and make any
changes there.
44
PowerGen White Paper
And then views the results in the Output Window. In the early phases of the
import errors may appear in the log; these may be ignored. The final error total
will only include errors encountered in the final phase.
45
PowerGen White Paper
Creative Kids then Synchronizes the Customer application and views the results
in the Output Window as well.
If you have already specified the executable path, support files, regen
information, code generation information, PBL information, and build
options for your applications (Steps 4 through 8 in the Step-by-Step Build
Process described previously), then you would now proceed to testing the
build (Step 9).
If you haven’t previously specified this information, then proceed with the
PowerGen build process at Step 4.
46