My goal is to build (generate & compile) different solution configurations from one set of the same apps (e.g. base.app, app1.app, … appn.app).
For each solution target there are several templates activated or not (example: TemplateXyz.tpl).
I have some configuration files (example):
PROJECT_CUSTOMER_A_TEMPLATE_SWITCH_SETTINGS.DAT
with one line as
SUPPRESS_TEMPLATE_XYZ=1
PROJECT_CUSTOMER_B_TEMPLATE_SWITCH_SETTINGS.DAT
with one line as
SUPPRESS_TEMPLATE_XYZ=0
For every target one of these files is copied to PROJECT_TEMPLATE_SWITCH_SETTINGS.DAT
.
The current DAT file is read at the beginning of every generation process from AppGen (example: SUPPRESS_TEMPLATE_XYZ=1
) to automate template activation.
I have customized several templates to be activated or deactivated from outside the concerning template itself.
Here is a simple example to explain what I mean (hope so):
#EXTENSION ('Switch Templates',%SwitchTemplates)
#ATSTART
#! This code results in
#! %SuppressTemplateXyz = %true or %SuppressTemplateXyz = %false
#DECLARE (%SuppressTemplateXyz)
#INSERT(%GetTemplateSettings_TemplateXyz_FromConfigurationFile)
#ENDAT
#!
#GROUP (%GetTemplateSettings_TemplateXyz_FromConfigurationFile)
#DECLARE (%IoFile)
#SET (%IoFile,'PROJECT_TEMPLATE_SWITCH_SETTINGS.DAT')
#OPEN (%IoFile),READ
#(File processing sets %SuppressTemplateXyz %true|%false)
#CLOSE (%IoFile)
#EXTENSION ('TemplateXyz%',%TemplateXyz)
#PROMPT ('Setting 1',CHECK),%Setting1
#PROMPT ('Setting 2',CHECK),%Setting2
#PROMPT ('Setting 3',CHECK),%Setting3
#PROMPT ('Enable TemplateXyz',CHECK),%TemplateXyzEnabled,#DEFAULT(%true)
#ATSTART
#! switch on/switch off this extension
#IF (VAREXISTS(%SuppressTemplateXyz) and %SuppressTemplateXyz)
#SET (%TemplateXyzEnabled,%false)
#ELSIF (VAREXISTS(%SuppressTemplateXyz) and ~%SuppressTemplateXyz)
#SET (%TemplateXyzEnabled,%true)
#ENDIF
#ENDAT
#AT (%CustomGlobalDeclarations), WHERE (~%GlobalExternal)
#IF (%TemplateXyzEnabled)
#PROJECT ('library(XyzDll1.lib)')
#PROJECT ('library(XyzDll2.lib)')
#ELSE
#PROJECT ('remove(XyzDll1.lib)')
#PROJECT ('remove(XyzDll2.lib)')
#ENDIF
#ENDIF
#! this should work also:
#AT (%CustomGlobalDeclarations), WHERE (~%GlobalExternal)
#IF (%TemplateXyzEnabled)
#PROJECT (XyzDll1.lib)
#PROJECT (XyzDll2.lib)
#ENDIF
#ENDIF
#!
#(other template code), WHERE (%TemplateXyzEnabled)
#! Last line
Inside the Clarion10 IDE this concept works fine and also with C6.x as a DDE-Server since the #PROJECT statement
has immediate impact when giving the build command from an external DDE client.
With ClarionCL the #PROJECT statement seems to be ignored (perhaps I didn’t understand all that new C10/MSBUILD/ClarionCL stuff as an gray haired C62 fellow).
Executing “ClarionCL /ag base.app” will not modify the base.cwproj at all after switching %SuppressTemplateXyz %true or %false.
This is simple to check out with enable / disable a template within the IDE and save without generate and run ClarionCL /ag against the app.
My current solution is to use the “SED.EXE”-Tool to modify the base.cwproj dynamic for several target systems from the same set of apps by toggling the “Include” properties.
%SuppressTemplateXyz = %false:
< Library Include="XyzDll1.lib" />
< Library Include="XyzDll2.lib" />
%SuppressTemplateXyz = %true:
< !-- Library Include="XyzDll1.lib" /-->
< !-- Library Include="XyzDll12.lib" /-->
This works until I generate the “base.app” in CLARION10 IDE with %SuppressTemplateXyz = %false.
But setting %SuppressTemplateXyz = %false with new generate will remove the Include property from the base.cwproj and switching is no more possible (detecting %SuppressTemplateXyz = with “SED.EXE” since this line no longer exists).
I think I could extend this mechanism to insert a new proerty line in the base.cwproj but it would be more
effective (& elegant) to use only ClarionCL in this way:
ClarionCl /ag base.app /mp on (mp = modiyfy projects)
Every hint is appreciated.
Thanks in forward,
Bernd