IBM / sourceorbit

Dependency Management for IBM i projects
https://ibm.github.io/sourceorbit/
Apache License 2.0
18 stars 9 forks source link

Custom object library in .ibm.json configuration #63

Closed arco400 closed 1 month ago

arco400 commented 4 months ago

Hi @worksofliam,

Thank you for creating these wonderful tools!

I'm going step by step to see if I can implement these in our development, which is currently already versioned in git, but from RDI iProjects. Ideally I'd like to create a CI/CD with our Azure DevOps repo.

Now to my question. In the same project, we use different libraries as compile target. So for example application objects to MYOBJ, tables to MYDTA, general purpose functions to MYGPL, etc.

I tried all kinds of combinations for the objlib setting in .ibm.json. However it seems not to be honored to change the target library during build. SourceOrbit builds the programs fine, but seems to always use the defined object library definition in iproj.json.

How can I influence the target library during project build?

Kind regards, Arco Simonse

worksofliam commented 4 months ago

@arco400 Hey, thanks for your kind words.

Regarding the build library: it has nothing to do with Source Orbit, since SO doesn't do any builds, and only generates the build files. If you are using -bf make, then BIN_LIB is the variable you'd use:

gmake BIN_LIB=ABCD

If it's ibmi-bob, I believe you can override the environment variables on the CLI. Perhaps -e objlib=ABCD?

edmundreinhardt commented 4 months ago

What Liam said about -e objlib=ABCD is true

arco400 commented 4 months ago

Thanks @worksofliam for that quick response.

I'm building with so -bf.

{ "name": "Build entire project with Source Orbit 🔨", "command": "so -bf make && /QOpenSys/pkgs/bin/gmake LIBL='&LIBLS' BIN_LIB=&CURLIB OPT=*EVENTF", "environment": "pase", "deployFirst": true, "extensions": [ "GLOBAL" ], "postDownload": [ ".evfevent/" ] }

What I want to achieve is that I can make a distinct during execution of the build. While with BOB i can define a different objlib in .ibm.json in a subfolder of the project,

I would like to compile content in /src/apps to library MYOBJ /src/data to library MYDTA

I do not understand how to achieve that with SO.

Thanks, Arco

worksofliam commented 4 months ago

@arco400

So it's totally dependent on the build tool really.

With bob, as you mentioned, you can achieve this by using objlib in .ibmi.json in a subdirectory. So you'd have one in both of those directories which have their own unique build libraries.

{
    "build": {
            "objlib":"&L01",
    } 
}
makei -e L01=LIB1 -e L02=LIB2

With make, it's not possible as we generate the entire build file with the intension of building in one directory [right now.]

worksofliam commented 4 months ago

I made #64 to track -bf make to support building into multiple libraries.

edmundreinhardt commented 4 months ago

a slight tweak to the above -makei needs a parameter to know you want to build or compile so makei build -e L01=LIB1 -e L02=LIB2 will do the job

arco400 commented 4 months ago

Thank you both @worksofliam and @edmundreinhardt !