Can objectgenerators see compile flags?
If I'm using an objectgenerator, is there a way to check the compile flags and have it behave differently based on which flags are set?
And as a tangent, is there a list somewhere of what compile flags there are?
Product version: Caché 2018.1
Do you know that you can just do ZWrite in objectgenerator method, and see the all variables?
So, you would find %qstruct variable, where you could check all the compile flags
Hello @David Hockenbroch
I tested this simple method using CodeMode = Objectgenerator :
Do $SYSTEM.OBJ.Compile("User.NewClass1","ck")
We can see a lot of variable values at compile time :
%qstruct contains compile flags and qualifiers
A very exciting way to introduce some unexpected behavior down the line.
What is your use case?
Sure:
do $system.OBJ.ShowFlags() do $system.OBJ.ShowQualifiers()
That shows me what I wanted. Thank you!
My use case has to do with change logs on our development server. Having looked at your and Lorenzo's answers, I've got a class set up with an objectgenerator method. It looks at the flags, and if there's an "a" or "v" it adds an entry to a versioninfo table I've made that contains a major version number, a minor version number, the username who compiled the class, and a field for notes which we can fill in later. If it's the "a", the new entry keeps the most recent major version and increments the minor version. If it's a "v", it increments the major version and sets the minor version to 0.
Now I can go into Studio and Compile with options adding either of those flags to get the desired results.
This is a pretty immature idea so far. I just wanted to see if it was possible before I went too much further in depth on it.
I'd suggest using source control and CI/CD to track changes.
Additionally you can add parent commit hash and compile time automatically.