Modifying the build file – PB Docs 2022

Modifying the build file
About the build file

The exported build file contains all the settings required
for building and deploying the PBL files of the Example Sales App and some additional
settings:

Build file
content

Description

This section contains the version number of
the PowerBuilder IDE and PowerBuilder Runtime currently
in use.

This section contains settings for source
control and build jobs.

  • “SourceControl” — Provides settings for
    downloading and merging source code from the source
    control server (including SVN, Git, and/or
    VSS).

    You can download source code from SVN, Git, or
    VSS. If the source code is the objects in
    ws_objects, you can merge the objects to the PBL
    file. Merging will not only merge the source code
    but also upgrade the source code to the current
    version. However, it will not check or upgrade the
    PBD files used in the library list (you will need to
    replace the PBD files with the corresponding
    version).

    You can download and merge source code for one
    or more targets at one time. See Getting source code
    from SVN, Git, or VSS
    for more details and
    examples.

    The “ClearSrcBeforeDownload” setting is for
    removing files from the source code folder
    (specified by the “DestPath” setting) before
    downloading the source code.

    The “Git” > “Branch” setting is for
    downloading source code from the specified
    branch.

    The “Merging” > “RefreshPbl” setting is for
    refreshing the PBL files by deleting and then
    generating the PBL files again.

    Tip

    If you use Git repositories to host and
    collaborate on your code using Team Foundation
    Server (TFS) or Azure DevOps Server, you can
    configure the “Git” section in the build file to
    connect to Team Foundation Server (TFS) or Azure
    DevOps Server. See the next section for more
    information.

  • “BuildJob” — Contains the location of the
    PowerBuilder application target(s) and the name of
    the project object(s).

    You can specify one or more targets and
    projects (of the same or different type) and build
    them at one time.

Both the “SourceControl” and
“BuildJob” blocks contain a “PreCommand” setting and a
“PostCommand” setting which allow you to specify
commands that can be executed before and/or after that
particular block is executed. See Executing
additional commands
for more
examples.

The commands in “PreCommand” and
“PostCommand” can be executed in synchronous (default)
or asynchronous mode, and the command window can be
visible or invisible (default). For
example,

This section lists the project(s) that has
been exported. Every single setting that can be found in
the project painter can also be found here. You can
modify the settings here when necessary.

Settings in the build file are independent from each
other; they run in sequence but do not rely on other settings or
execution results, for example, if there is already source code
in ws_objects, then you only need to set the Merging setting,
and leave Git, SVN, and VSS empty as there is no need to
download source code; or if there are PBLs in your Git server,
then you only need to set the Git setting (to download PBLs) and
leave the Merging setting empty. If you do not want a setting to
run, just leave that setting with no values; or add “\” in
front of the setting name, for example, “\Git” or
“\SourceControl”, to skip the setting.

It is recommended that you make a copy of the exported
build file and place it to the same location or a location near
your PowerBuilder application target, so that you could manage
the file path (especially the relative file path) easily.

Note: the relative path specified in the build file is
relative to the build file.

Getting source code from SVN, Git, or VSS

You can configure the exported build file to download
source code from SVN, Git, or VSS before the build process
starts.

Step 1: Make a copy of the exported build file and place
it to a location near your PowerBuilder application target, so
that you could manage the file path (especially the relative
file path) easily.

Note: the relative path will be relative to the build
file.

Step 2: Open the build file in a text editor, locate the
“BuildPlan” section and then configure the corresponding
part.

If the computer connects to Git or SVN through a proxy
server, make sure to configure the proxy server settings in the
“Proxy” part.

The following example shows how to download source code
from Git:

You can also download source code from multiple targets at
one time:

The following example shows how to download source code
from Team Foundation Server (TFS) or Azure DevOps Server:

IMPORTANT: To download
source code from Team Foundation Server (TFS) or Azure DevOps
Server, you will need to configure the “Git” section, and input
your Personal Access Token (PAT) as the user name and password
for connection.

The following example shows how to download source code
from VSS:

Notes:

1) Connecting to Git or SVN through a proxy server is
supported; but connecting to VSS through a proxy server is not
supported yet.

2) The password for VSS is not supported. The VSS login
window will be displayed for you to input the password before
downloading the source code. The password for SVN or Git must be
an encrypted value which is generated from the original password
by executing “PBAutoBuild220.exe /p”, as shown below.

ps_tutorial_103.png

3) Getting an SVN/VSS branch is completely unsupported.
Getting a Git branch can be supported by using the “Branch”
setting.

Step 3: If the source code downloaded from SVN, Git, or
VSS is not the PBL file but objects in ws_objects, then you will
need to merge the objects to the PBL file. Locate the “Merging”
section in the build file and then configure as below:

Setting “RefreshPbl” to true if you want to refresh the
PBL files by deleting and then generating the PBL files
again.

You can also merge source code for multiple targets at one
time:

Merging will not only merge the source code but also
upgrade the source code to the current version. However, it will
not check or upgrade the PBD files used in the library list (you
will need to replace the PBD files with the corresponding
version).

At the same time, make sure to double check the target
location is set correctly in the “Projects” section, for
example,

When the PBAutoBuild220.exe command is executed later, it
will first download the source code from the Git server and then
merge the source code.

Executing additional commands

The entire build process is made up of several steps, and
additional commands can be executed before and/or after some
particular steps such as the “SourceControl” and “BuildJob”
steps.

For example, to add commands to remove a folder before
downloading the source code.

Step 1: Create a bat file which contains the following
command, and save the bat file as Command_DeleteFolder.bat.

Step 2: In the build file, locate the “BuildPlan” section
and then the “PreCommand” sub-section; and add the file path and
name of Command_DeleteFolder.bat.

When the PBAutoBuild220.exe command is executed
later, it will execute the commands in Command_DeleteFolder.bat before it
downloads the source code.

Besides the “PreCommand” setting, there is also a
“PostCommand” setting for the “SourceControl” and “BuildJob”
steps, which allows you to execute commands after that
particular step. See Example 2 and 3 for more details.

Note

The dotnet commands can
also be integrated with Jenkins. See Task 2 for more
details.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x