Executing additional commands

The entire build & deploy 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.

Example 1: to add commands to remove the "build" 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.

RMDIR /s /q "D:\PB2021\SalesDemo\Build"


Step 2: In the build file, locate the "BuildPlan" block and then the "PreCommand" setting; and add the file path and name of Command_DeleteFolder.bat.

    "BuildPlan": {
        "SourceControl": {
            "PreCommand": "Command_DeleteFolder.bat",
            "SVN": [
                ...
            ],

When the PBAutoBuild210.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.

Example 2: to add commands to start the PowerServer Web APIs after building the PowerServer project in the PowerBuilder IDE.

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

dotnet.exe run --no -build --project C:\Users\appeon\source\repos\PowerServer_salesdemo\ServerAPIs\ServerAPIs.csproj

Step 2: In the build file, locate the "BuildJob" block and then the "PostCommand" setting; and add the file path and name of startwebapi.bat.

        "BuildJob": {
            "PreCommand": "",
            "Projects": [
                ...
            ],
            "PostCommand": "startwebapi.bat /show / sync"
        }

When the PBAutoBuild210.exe command is executed later, it will execute the commands in startwebapi.bat after it finishes building the PowerServer project.

Example 3: to publish the PowerServer Web API after building the PowerServer project in the PowerBuilder IDE.

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

dotnet.exe publish C:\Users\appeon\source\repos\PowerServer_salesdemo\ServerAPIs\ServerAPIs.csproj -c release -o C:\Publish

Step 2: In the exported build file, locate the "BuildJob" block and then the "PostCommand" setting; and add the file path and name of publish.bat.

        "BuildJob": {
            "PreCommand": "",
            "Projects": [
                ...
            ],
            "PostCommand": "publish.bat /show / sync"
        }

When the PBAutoBuild210.exe command is executed later, it will execute the commands in publish.bat after it finishes building the PowerServer project.

Note

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