Source Orbit is available as a CLI tool. It can be installed through npm onto most platforms, including IBM i.
Source Orbit will scan the sources in the current working directory (CWD) and can do a few things:
- Show object dependencies with
-l - Generate a different file formats based on the dependency tree to build the project
- Rename files easily (
.rpgle/.clle/.clp->.pgm.rpgle/.pgm.clle/.clle) with-ar - Fix RPGLE includes if the source is found locally (useful for converting from member include style) with
-fi - List detailed information with
--verbose - Want to only scan a specific source? Use the
-soption:so -s qrpglesrc/employees.pgm.sqlrpgle
cd myibmiproject
so -h
so -bf make && gmake BIN_LIB=libnameSource Orbit CLI can generate different file formats using the -bf <type> parameter.
Types available:
jsonGenerate all dependency info as JSONbobto generate the requiredRules.mkfilesmakegenerates a single makefile with the targets and rules.- See more here for our make support.
imdcan be used to generate analysis reports for branches- This is particularly useful for pull-requests. It is possible have a pipeline that runs on a push to a branch/PR to generate dependency information.
- See about GitHub Actions here.
so -bf imd -f `git diff --name-only origin/main origin/${GITHUB_HEAD_REF}`- You can use
-fto make Source Orbit to only care about specific sources. This still scans the entire project, so will know about object parents. - Using
-smeans only a specific files and children of that file/object. This will not scan the entire project.
The ability to cleanup your source code is usually a one-and-done situation. After you've migrated your source code into git, you may find that a majority of your source extensions are incorrect (like missing the .pgm attribute on your source). There are currently two methods of cleanup available:
-arfor auto-rename. This fixes most extensions for your repository. For example, adds the.pgmattribute where possible, changes RPGLE headers to use.rpgleincand fixes SQL sources to use right extension based on theCREATEstatement inside of it.-fifor fix includes. This will scan all RPGLE source code and change the include statements to use the unix style path if the mapped source member can be found in the current working directory.
You can also use --verbose before using those parameters to see impact it will have before running them. To follow up to that, consider using git before using this parameters.
cd myrpgrepo
# Preview warnings and infos
so --verbose
# Fix names
so -ar
# Preview warnings and infos. Will be different since file names changed
so --verbose
# Fix names
so -fiWe recommend Node.js 18+.
- Install Source Orbit globally
npm i -g @ibm/sourceorbit
- Use
so
- Install Node.js via
yumand/or useupdate-alternativesto set the Node.js version.yum install nodejsxxupdate-alternatives --set node /QOpenSys/pkgs/lib/nodejs18/bin/node
- Install Source Orbit globally on to the IBM i
npm i -g @ibm/sourceorbit
- Update the
PATHenvironment variable to include thenpmbinary directory for installed CLI packagesPATH=/QOpenSys/pkgs/lib/nodejs18/bin:$PATH- put in
.bash_profilefor CLI usage, put in.bashrcfor Code for IBM i usage
- Use
so