Working with OSSILE, RDi, iProject and git.
I was surprised on a recent Crowdcast from the OSSILE group to hear that in order to use git you had to migrate your source code to IFS based files? Having developed a lot of Open Source code and contributed that code to the GitHub repository we run that did not seem to be a valid statement. A lot of IBM i code is developed using Source files in libraries and people were obviously resistant to having to copy all of their code to the IFS just to allow them to use git. Another issue with IFS code is that many of the compiler commands do not accept IFS files as input for the source!
In this entry we hope to provide an explanation of how to work with IBM i code in source files with RDi and then push via git to a repository. We continue to develop and manage the code in the source physical files as we always have but use iProjects in RDi to allow that code to be pushed to our repository via git.
Make sure you have set up the workspace to automatically remove the line numbers and date information from the source on transfer to the iProject. OSSILE admins have said they do not want to see the line numbers etc in the code.
First of all we will pick an existing member from one of our source files (CHLIB Library) and copy it to the source files in the iProject (OSSILESRC Library), if you are starting with a new source member and adding content you can skip this part and just create a new source member in the iProject library.
We are going to copy and paste the RTVJRNOBJ member from CHLIB/QCSRC to OSSILESRC/QCSRC file.
Then we will open the file and tidy up the code before we add it to the iProject.
Now that we have tidied up the code we can add it to the iProject by right clicking on the source member and selecting add to iProject, this will bring up a list of the current iProjects we have.
Here is a list of our iProjects, we are going to add it to the sample_code project.
Once you press OK you will be informed that the code will be downloaded to the project, this is where the code is copied from the IBM i source file to the PC in the directory where the source for the project exists. Remember we have already set-up all of the projects and linked them to directories on the PC, if you are unsure of how to do this check out our previous posts which should explain.
Now switch to the git perspective so we can push the code to the github repository, you could look at the iProject perspective to verify it was copied but in this instance w are going to directly push the member we just created to our github repository (ChrisHird/OSSILE).
As you can see the member is already added to the Working Tree for us and an entry has been added to the list of changed objects. We are going to select the entry and add it to the index. (Staged Changes). there are lots of other changed objects which we are not interested in copying to the github repository because they are part of the iProject set up and not required to be pushed to github.
Now all we have to do is add a comment as to why we are pushing this commit to our repository and send it off.
After pushing the ‘Commit and Push’ button you will see a few dialogs showing the code being pushed up to the git repository and a resulting dialogue box which hopefully states the commit and push was successful.
Now we can go to our copy of the OSSILE repository and put in a pull request so the main repository administrators can add the code from our branch (shield_updates) into the main branch. At the time of this post the pull requests have not been actioned, you can find the code in our fork of the main repository under https://github.com/ChrisHird/OSSILE/tree/shield_updates .
We are using Version 9 of RDi and we have been asked if the same process is possible under WSDc which was the predecessor for RDi. As far as we know you can get all of this working with a bit of effort (use iSeries Projects in place of iProjects) as long as you install the git plug in, we had done this on a previous incarnation but have not tested lately to ensure it all works in the same manner.
Maybe one day IBM will recognize the need to get RDi out to the development community for free.
We hope your path to Open Source is a fruitful one, we are continuing to support the effort as much as we can so keep coming back to see if there are any new posts to view.