Share Variable Definitions Across Targets
Posted: Mon Aug 26, 2019 4:00 pm
My documentation Flare projects include a large (and ever growing) number of variables which are stored in a Global project and shared via import files. Each variable has multiple definitions (mostly product names/codes which are different for the different companies we write for). The targets (also an ever growing number) are stored in the child projects because each target is used to produce multiple TOCs and therefore needs to be changed frequently.
The problem here is that if I update a secondary variable definition (i.e. not the default one) in the Global project, the update does NOT automatically carry through to the targets stored in my child projects. If variable set and target are edited in the same place, the Flare analyzer works its magic to update the target definition; but if they are not, the definition does not change even when the variable set is imported. I have to go through every target in multiple projects and update them, which almost defeats the purpose of having alternative variable definitions at all.
With some poking around, I found that the issue lies in how secondary variable definitions are encoded in the XML for targets. If the target in question only uses the defaults for variables, the XML is simply <Variables></Variables>. So at build time Flare goes and checks the default variable definitions and inserts them.
But if you use the dropdown menu in the Target Editor to select a secondary variable definition, you get this:
See the issue? It's hard-coded in as if I had just typed something into the target editor. That means that at build time Flare never checks the variable set at all - it just looks at whatever was last set in the target.
Ideally I would like the XML code in the target to look for the definition in the variable set rather than a hard-coded name (e.g. <variable name="productA" definition="2">), and I've submitted a feature request to that effect. But in case that isn't forthcoming, I'd like an automated way of keeping all of these targets synchronised with the variable set.
I toyed with the idea of using XInclude and writing some kind of pre-build command to take the variable definitions from somewhere else (e.g. a target in the Global project) and overwrite the current target before it builds, but I think that's probably a little beyond my capacity. Does anyone have any other suggestions along those lines?
The problem here is that if I update a secondary variable definition (i.e. not the default one) in the Global project, the update does NOT automatically carry through to the targets stored in my child projects. If variable set and target are edited in the same place, the Flare analyzer works its magic to update the target definition; but if they are not, the definition does not change even when the variable set is imported. I have to go through every target in multiple projects and update them, which almost defeats the purpose of having alternative variable definitions at all.
With some poking around, I found that the issue lies in how secondary variable definitions are encoded in the XML for targets. If the target in question only uses the defaults for variables, the XML is simply <Variables></Variables>. So at build time Flare goes and checks the default variable definitions and inserts them.
But if you use the dropdown menu in the Target Editor to select a secondary variable definition, you get this:
Code: Select all
<Variables>
<Variable name="ProductA">ProductA Alternative Name</Variable>
</Variables>
Ideally I would like the XML code in the target to look for the definition in the variable set rather than a hard-coded name (e.g. <variable name="productA" definition="2">), and I've submitted a feature request to that effect. But in case that isn't forthcoming, I'd like an automated way of keeping all of these targets synchronised with the variable set.
I toyed with the idea of using XInclude and writing some kind of pre-build command to take the variable definitions from somewhere else (e.g. a target in the Global project) and overwrite the current target before it builds, but I think that's probably a little beyond my capacity. Does anyone have any other suggestions along those lines?