Well, I've created such a plugin. Or more specifically what I did was take the existing MSBuild plugin and customize it to do PowerBuilder compiles instead.
In this post I'm going to look at how we can use that plugin, plus some additional changes I've made to the project in Jenkins to make better use of the capability of Jenkins and other Jenkin plugins.
Download and install the PBCompile plugin
The first thing you'll need to do is grab a copy of the pbcompile plugin. What you'll need is the PBCOMPILE.HPI. file.
Go into Jenkins and select the "Manage Jenkins" option, and then the "Manage Plugins" link on that page.
On the Plugin Manager page select "Advanced" and then look for the "Upload Plugin" section. Click the "Browse" button there and navigate to the HPI file you downloaded.
You'll need to restart the Jenkins server after installing the plugin before you can use it.
Configure the PBCompile plugin installation
After the server has been restarted go back into "Manage Jenkins" and then "Global Tool Configuration".
Scroll down that page and you'll see a new "PBCompile" section. Select the "PBCompile installations..." button
The only two items you'll need to provide are a name for the installation and the directory where the orcascript170 and pbc170 files are at.
Create a new PBCompile build step
Go back into your PowerBuilder project and select the "Configure" link.
Delete all the previous build steps. Now add a new one and notice a new "Build a PowerBuilder target using PBC" option has been added. Select that one.
You'll now see a build step that is custom to PowerBuilder 2017.
- PBCompile Version: Select the name you defined in the "PBCompile installations" above. It should be the only available entry.
- PBT File: Provide PBT file for your project, including any relative directory path.
- Exclude Liblist: Optional, It only needs to be populated if there are PBD files in the library. That tells OrcaScript to take those as are rather than attempting to generate them.
- PBC Command Line Arguments: The data you pulled from the project painter in PowerBuilder that previously we put in the batch file.
- Pass build variables as properties: The checkbox currently isn't used. MSBuild has this feature, and the option was left in here just in case a later version of the PowerBuilder Autocompile utility adds similar capability.
Archive the Project Artifacts
The first thing we're going to do is to tell Jenkins to archive off the EXE and PBDs (Jenkins calls them "artifacts"). To do this, create a Post Build step and select "Archive the Artifacts"
In the new step that is added, enter the following in for the "Files to Archive".
The syntax is Apache Ant include fileset. This particular setting tells Jenkins to find all of the EXE and PBD files in the workspace - including in any subdirectories - and copy them into the archive location. When it does so it preserves the subdirectory structure, something we'll deal with in the next step.
Install the Copy Artifacts plugin
Once again you'll need to restart the server before you can use the plugin.
Create a Copy Artifacts project
The only thing we're going to do with this new project is create one build step. Do that, and choose the new "Copy artifacts from another project" option.
- Project to Copy From: Select your original PowerBuilder project.
- Artifacts to Copy: You can leave this blank, as it defaults to copying all artifacts.
- Target Directory: The he location you want the files copied to, and can reference the Jenkins environmental variables using $VARIABLENAME (as opposed to %VARIABLENAME% that we used in the batch files). For example, I'm using:
In the previous article I was concatenating the job_name and build_number for the directory. I like this better as I'm now putting the builds in subdirectories under the job name.
- Flatten Directories: The one other option you will want to change is to check the "Flatten Directories" option. That tells the plugin to just copy over the EXE and PBD files and ignore the subdirectory structure.
Great a Post Build step to fire the Copy Artifacts project
And in the new post build step specify your "output" project as the project to run after the PowerBuilder project completes.
Test the new configuration
The build information from the "output" project isn't particularly interesting, but we can check out build folder and see that the build files are being created and stored correctly.