Closed cosentino-smeup closed 1 month ago
@edmundreinhardt Can you take a look at this?
@cosentino-smeup thanks for the example, I think I understand what you are trying to do.
When you say:
RPG.BNDDIR: RPG.BNDDIR
you are telling gmake
that if the object RPG.BNDIR is missing or older than the local source file RPG.BNDIR then to run the RPG.BNDIR pseudo source to create the RPG.BNDDIR object.
This is not working for you as there is no RPG.BNDDIR object for gmake to check on.
What you really want is to create a new recipe that gets run to build .PGM from .pgm.rpgle Unfortunately BOB is parsing the Rules.mk to keep the syntax very simple and so complex make features like macros are not available.
at this point repeating the command for every target is the simplest option
Another option would be to set some environment variables and reference them to get the pieces of the custom command
i.e.
cl "CALL PGM(BOBMIN/TEST3CL) PARM(('$@' (*CHAR 50)) ('$<' (*CHAR 50)) ('BOBMIN' (*CHAR 10)) ('BOBMIN_C' (*CHAR 10)))"
becomes
${BUILD1}$@${BUILD2}$<${BUILD3}
where BUILD1=cl "CALL PGM(BOBMIN/TEST3CL) PARM((' BUILD2=' (CHAR 50)) (' BUILD3= ' (CHAR 50)) ('BOBMIN' (CHAR 10)) ('BOBMIN_C' (CHAR 10)))"
Set these in your .env file and use this for your Rules.mk
COSANT2.PGM: cosant2.pgm.rpgle
${BUILD1}$@${BUILD2}$<${BUILD3}
COSANT1.PGM: cosant1.pgm.rpgle
${BUILD1}$@${BUILD2}$<${BUILD3}
@cosentino-smeup After discussing this with Edmund, we realized that custom recipes like you have will not be able to take advantage of the cool aspects of bob involving setting up the library, retrieving job log, etc. We are going to consider this as an enhancement that will be looked at. It can be tracked here.
For now, one option would be to use the environment variables as Edmund had suggested. However, note that since the .env
file will not be pushed to git, each developer that clones the project will need to set this up. For a GitHub workflow, this would also need to be setup as well. If you would like for the specific command to be persisted as part of your project and simply just pass in the objlib
and srclib
, you can do this in the Rules.mk
:
COSANT1.PGM: cosant1.pgm.rpgle
cl "CALL PGM(${srclib}/TEST3CL) PARM(('$@' (*CHAR 50)) ('$<' (*CHAR 50)) ('${srclib}' (*CHAR 10)) ('${objlib}' (*CHAR 10)))"
COSANT2.PGM: cosant2.pgm.rpgle
cl "CALL PGM(${srclib}/TEST3CL) PARM(('$@' (*CHAR 50)) ('$<' (*CHAR 50)) ('${srclib}' (*CHAR 10)) ('${objlib}' (*CHAR 10)))"
@cosentino-smeup After discussing this with Edmund, we realized that custom recipes like you have will not be able to take advantage of the cool aspects of bob involving setting up the library, retrieving job log, etc. We are going to consider this as an enhancement that will be looked at. It can be tracked here.
For now, one option would be to use the environment variables as Edmund had suggested. However, note that since the
.env
file will not be pushed to git, each developer that clones the project will need to set this up. For a GitHub workflow, this would also need to be setup as well. If you would like for the specific command to be persisted as part of your project and simply just pass in theobjlib
andsrclib
, you can do this in theRules.mk
:COSANT1.PGM: cosant1.pgm.rpgle cl "CALL PGM(${srclib}/TEST3CL) PARM(('$@' (*CHAR 50)) ('$<' (*CHAR 50)) ('${srclib}' (*CHAR 10)) ('${objlib}' (*CHAR 10)))" COSANT2.PGM: cosant2.pgm.rpgle cl "CALL PGM(${srclib}/TEST3CL) PARM(('$@' (*CHAR 50)) ('$<' (*CHAR 50)) ('${srclib}' (*CHAR 10)) ('${objlib}' (*CHAR 10)))"
@SanjulaGanepola, even if I don't use the .env file, Github does execute the call to my program. It keeps compiling the programs with CRTBNDRPG.
I tried not to use any variable but Github completely ignores the CALL command. For example:
cl "CALL PGM(BOBMIN/TEST3CL) PARM(('COSANT1.PGM' (*CHAR 50)) ('/SMEDOC/BOB/MINIMAL/SRC/cosant1.pgm.rpgle' (*CHAR 50)) ('BOBMIN' (*CHAR 10)) ('BOBMIN_C' (*CHAR 10)))"
Is there any way to make Github call the program like VS Code does?
@cosentino-smeup Please refer to https://github.com/IBM/vscode-ibmi-projectexplorer/issues/587#issuecomment-2349279435
Using github actions with 'makei' should work fine as long you have 'yum install bob' present on the target IBM i. We designed bob with environment variables to enable just this scenario. Does the user profile used by the github action have the path set up to include'/QOpenSys/pkgs/bin'?
Closing as discussion was moved to https://github.com/IBM/vscode-ibmi-projectexplorer/issues/587
I am building programs with a custom command and it works perfectly.
I would like to improve the syntax by putting the CALL statement in another file like this:
IBMi-bob doesn't execute the call inside RPG.BNDDIR. How can I achieve this?
I would like also to retrieve the variable "objlib" and pass it as parameter to the CALL statement. Is it possible?
Please find attached the project folder.
Thank you
bob-min.zip