Build & deploy using commands

Instead of building and deploying the PowerServer project from the PowerBuilder IDE, you can also build and deploy the project using the PBAutoBuild210 command. For step-by-step guidance, refer to Tutorial 7: Building your PowerServer project with commands. The PBAutoBuild210 command can integrate with Jenkins to automate the build and deployment process for PowerServer projects. Refer to the Jenkins user documentations for how to use Jenkins.

To build and deploy the PowerServer project with commands:

  1. Export the configurations of the PowerServer project to the JSON file.

    1. Click the Export PowerServer Build File button () in the toolbar if the PowerServer project painter opens, or right click the PowerServer project object and then select Export Build File.

    2. In the Export Build File dialog box, specify where to save the exported file.

      If you right click the workspace and then select Export Build File, you can select one or more targets to export the build file for, and then select one or more project types to export if there are more than one type of project objects in the selected target(s). If you select more than one project type, the corresponding project objects will be exported to the build file > "Projects" > [project object name]. If the selected targets contain project objects with the same name, only the object listed last will be added to the build file.

      Specify how to overwrite the following settings if the build file already exists: the source code settings, build job settings, and project settings.


    3. Click Export.

    The exported JSON file includes every single setting that is required for compiling, packaging and deploying the PowerServer project, for example,

    • Project settings such as project type, platform (32-bit or 64-bit), build options etc.

    • Library list

    • Version information

    • Run options

    • ...

    You can find a complete list of settings under the "Projects" block in the exported file.

    The exported file also contains a "BuildPlan" block which provides additional configurations:

    • "SourceControl" -- provides settings for downloading and merging source code from the source control server (including SVN, Git, and/or VSS).

      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).

    • "BuildJob" -- contains the location of the selected PowerBuilder application target(s) and the name of the project object(s).

    • 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.

      You can specify the commands or command file in "PreCommand" or "PostCommand". For example,

      "PreCommand": "SourcePre.bat"

      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,

      "PostCommand": "postcmd.bat /show /async"

    Note: The relative path specified in the file is relative to the path of the JSON file.

  2. Execute the PBAutoBuild210.exe file and the JSON file in a command line to automatically build and deploy the project. For example,

    PBAutoBuild210 /f c:\pssales.json /l deploy.log /le error.log /lu unsupport.log

    The PBAutoBuild210.exe file supports the following parameters:

    • /f -- specifies the configuration file. The configuration file (in JSON format) can be directly exported from the PowerBuilder IDE, as described in step 1.

      PBAutoBuild210 /f c:\pssales.json
    • /l -- writes the logging information to a file.

    • /le -- writes the error information to a file.

    • /lu -- writes the unsupported PowerScript features to a file. For example,

      PBAutoBuild210 /f c:\pssales.json /l deploy.log /le error.log /lu unsupport.log

      The relative path specified in the parameter is relative to the path of the configuration file. In the above example, the three log files will be generated under the same path as the configuration file.

    • /p -- specifies the password for logging into SVN, Git, or VSS. This will generate an encrypted value based on the password. If the password contains the double quotation mark ("), use the escape character \" to replace ".

      PBAutoBuild210 /p 123456
    • /h or /? -- displays the help information.

      PBAutoBuild210 /h


Note

The handling of PB.INI is the same in PBAutoBuild and OrcaScript:

If the application relies on a property in PB.INI to run, for example, [RichText] PageSizeAsControlSize=1, the user needs to copy the PB.INI file to the directory where the application executable resides.

If the compilation of PBAutoBuild or OrcaScript relies on a property in PB.INI, for example, [PB] DashInIdentifiers=0, the user needs to copy the PB.INI file to the directory where PBAutoBuild210.exe or pbc210.exe resides.