Boost your Forms Development with GIT and Forms API Master (DOAG 2017)

I prepared these post as an additional bonbon for the attendees of my presentation at the DOAG 2017 in Nuremburg. Hope this will help you to get things work at your environments and development efforts.

Well, some introducing words first.

*.FMBs != Agile Development

Modern development methodologies and technics demands some kind of agile approach. Times of waterfall procedural model are now things of past and hopefully vanished completely (hopefully!).

Bear in mind that development is a highly creative process which needs the flexibility it demands. Means, as a developer I must have the opportunity to collaborate with each other, create source code simultaneously, bring things together and compare different states of artifacts at any point in the project.

Git as the quasi-standard version control system supports all the described “minimal requirements”. Great!

But, developing forms means to handle binary files instead of plain source code which Git can perfectly manage at the best. At the first glance these seams to be a show stopper, but the Forms API Master can master these task and fulfill the lack between Git and Oracle Forms​1​.

The tool provides all needed functionalities to diff and merge forms as if they were normal plain text files. That is your objective!

Prepare Git for Forms API Master

To make forms development literally more agile it is up to you to configure the Forms API Master as a new diff- and mergetool. With these settings your are able to interact with Git in forms context in a common way.

Modify your .gitconfig File

In the .gitconfig file, located in your home directory, we are going to make some modifications. Add the following lines in the file:

[difftool "fapi"]
  cmd = fapi_diff.sh $LOCAL $REMOTE
[mergetool]
  prompt = true   keepBackup = false  
[mergetool "fapi"]
  cmd = fapi_merge.sh $BASE $LOCAL $REMOTE  

We introduced with these lines Git a new diff- and mergetool named “fapi”. Whenever you start to typing in the git bash:

git difftool --tool=fapi .

or

git mergetool --tool=fapi .

Git will redirect the diff and merge calls to the CMD commands you defined. In your case the fapi_merge.sh and fapi_diff.sh shell scripts. We will come to these scrips now.

fapi_merge and fapi_diff Scripts

The Forms API Master provides some basic Windows CMD commands to call the functionalities. Since, we are spend most of your time in the Git bash (yeah give it a try) and this bash is a shell we need some kind of wrapper to call the Forms API Master CMD commands during the diff or merge process.

PATH Settings on Windows Machines

Some of your may recognize that in the .gitconfig I did not specify absolutely where the both wrapper files are located. Because I added those files in my %HOMEPATH%\bin and extended the %Path% in my windows settings to have also a look into these folder.

Just google how to configure system variables in windows or reference both files in the .gitconfig absolutely.

So we need to create two shell scripts:

The fapi_diff.sh

#!/bin/sh
LOCAL=$(echo $1 | sed 's|/|\\|g')
REMOTE=$(echo $2 | sed 's|/|\\|g')
cmd.exe /C "FapiMaster.exe /COMPARE /MODULE1=$LOCAL /MODULE2=$REMOTE"

The fapi_merge.sh

#!/bin/sh
MODULEBASE=$(echo $1 | sed 's|/|\\|g')
MODULE1=$(echo $2 | sed 's|/|\\|g')
MODULE2=$(echo $3 | sed 's|/|\\|g')
cmd.exe /C "FapiMaster.exe /COMPARE /MODULEBASE=$MODULEBASE /MODULE1=$MODULE1 /MODULE2=$MODULE2"

These scripts does not much work. They just translate some slashes in back slashes (for windows) and bind the file paths to variables which will be proceed by the Forms API Master.

PATH Settings on Windows Machines

Also consider to include the FapiMaster.exe in your windows %Path% or reference absolutely.

The Taste of our Work

Lets compare an altered *.FMB file with the master version (I assume that you modified a Forms File and committed it). When you now start to compare the state of your development branch with the master, which should equal your production state, you are going to get the following output:

adam.Lukaszewski@DEPC00108 MINGW64 ~/workspace/
$ git diff master
diff --git a/ui_forms/a_form.fmb b/ui_forms/a_form.fmb
index f0b0a0e..ae777eb 100644
Binary files a/ui_forms/a_form.fmb and b/ui_forms/a_form.fmb differ

So Git indicates that with the normal difftool (yet you do not tell Git to use your new fapi tool) it is not able to diff your binary files. Lets extend the command:

adam.Lukaszewski@DEPC00108 MINGW64 ~/workspace/
$ git difftool --tool=fapi master
Viewing (1/1): 'ui_forms/a_form.fmb'
Launch 'fapi' [Y/n]: y

Next the Forms API Master starts and presents your a nice looking diff between the version your touched and the production version.

Diff of two *.fmb revisions

Bibliography

  1. 1.
    ORCL Toolbox . FormsAPI Master. ORCL Toolbox – The leader in Oracle Forms productivity tools. http://www.orcl-toolbox.com. Published January 2017. Accessed January 2017.