Client tools - JeffBerman/Bob GitHub Wiki

This page describes the contents of the Client-tools directory.

Overview

The Bob client tools are a set of shell scripts that allow source code to be edited on a local PC or Mac and pushed to the i to be built, eliminating the need to sign onto the i to issue build commands. They are primarily designed to be integrated with the Rational Developer for i (RDi) IDE, but as they are largely free standing it is likely that they could be called from other code editors as well.

In a nutshell, the client tools provide the following functionality:

  • Configuring the client tools.
  • Cleaning recently-imported source code to allow it to become standard source text files that work with the build system.
  • Pushing source code to a build directory on the IBM i.
  • Kicking off a Bob build on the IBM i.

The client tools are located in a Bob project subdirectory called Client-tools.

The client tools scripts

Following is a high-level description of each user-callable script that exists in the Client-tools directory and instructions for use. For more details, see the actual code. All are Bash scripts.

Edit build settings.sh

When called, this script opens the project's .buildsettings file in the nano text editor so client tools settings can be configured. The individual settings are actually shell variables, so they are in the format setting="some value".

Nano is a popular Unix command-line editor. Use the arrow keys (not the mouse) to move the cursor. Type control-x, then Enter to save your changes.

Using in RDi

  1. From the Project Explorer view, select the project name.
  2. Access either the Run -> External Tools -> Edit build settings menu bar item or select Edit build settings from the Run external tools toolbar button.
  3. Configure the settings file.
  4. Type control-x, Enter to save your changes.

Clean source files.sh

When source code is converted from source physical file members to text files, it may not be in a proper state to be used with Bob, depending on the tool used to do the conversion. Lines may be padded with spaces (a holdover from fixed-width source files), prefixed with SEU sequence numbers and date fields, and terminated with Windows-style CRLF line endings.

The Clean source files.sh script cleans either a single file or directory of files by doing the following:

  • Remove the SEU sequence numbers and date fields from the beginning of each line, if they exist.
  • Convert Windows-style CRLF line endings to PASE-appropriate LF endings.
  • Remove trailing spaces from each line.

Using in RDi

  1. From the Project Explorer view, select either a single file or subdirectory, or the project name (to clean all files in the project).
  2. Access either the Run -> External Tools -> 'Clean' source file(s) menu bar item or select 'Clean' source file(s) from the Run external tools toolbar button.

Status information will appear in the Console view as files are cleaned, and statistics will be presented when cleaning is complete.

Push to i.sh

With this development model, source code is edited and saved locally on a developer's PC. To be compiled, it must first be sent to the IBM i. The Push to i.sh script determines which source code has changed in the local source code directory and sends the changed files to the build directory on the i. The underlying technology used is rsync, which is extremely fast and efficient.

rsync has been recorded pushing over 4,500 source files from PC to i over the Internet in 14 seconds. Compare that to 290 seconds for the Remote System Explorer view to simply refresh the listing of the same directory in the IFS -- not copy the actual files, just list the directory. Subsequent source code pushes can complete in a split second, if only a few files have changed.

Using in RDi

  1. From the Project Explorer view, select the project name.
  2. Access either the Run -> External Tools -> Push to IBM i menu bar item or select Push to IBM i from the Run external tools toolbar button.

Source files in the project directory on your PC will be pushed to the IBM i build directory specified for that project.

Status information will appear in the Console view as files are sent, and statistics will be presented when the process is complete.

Build all.sh

Source code has been pushed to a build directory on the IBM i, and now it is time to initiate a build! The Build all.sh script starts a process on the IBM i that compiles all source code in the build directory to the build library. In reality, only new or changed source files will be compiled, as well as anything depending on them -- but the end result is as if the entire project was built.

When the build process completes, successfully or otherwise, compile listings are transferred back to the Logs directory in the project directory on your PC.

If compile errors occur, the build process will stop so that the error can be fixed and the build retried. When this happens, examine the failing compile listing and the IBMiMake.log in the Logs directory for an idea of what went wrong.

Using in RDi

  1. From the Project Explorer view, select the project name.
  2. Access either the Run -> External Tools -> Build all menu bar item or select Build all from the Run external tools toolbar button.

Status information will appear in the Console view as source files are compiled, and either a "Build Successful!" or an error message will be presented when the process is complete.

Push to i and Build all.sh

The Push to i and Build all.sh script is a convenience, and does exactly as it sounds: it pushes source code to a build directory on the IBM i and then builds it. Under the covers, it merely calls the Push to i.sh and Build all.sh scripts in succession.

Using in RDi

  1. From the Project Explorer view, select the project name.
  2. Access either the Run -> External Tools -> Build all menu bar item or select Build all from the Run external tools toolbar button.

Source files in the project directory on your PC will be pushed to the IBM i build directory specified for that project.

Status information will appear in the Console view as files are sent and compiled, and either a "Build Successful!" or an error message will be presented when the process is complete.