Build Delphi - using events to capture compiler settings for compatibility testing

Time to time all of us have to update compilers and libraries. We like to implement alternative test build with updated tools before putting them into production. We don’t like full cloning of build setup for this purpose but prefer to redirect compilation to another computer with updated tools - Delphi and libraries.
To implement it I need to capture compiler settings for each Build Delphy Action from current production then run updated compiler with this settings remotely. In this scenario I’d like to skip actual resource and code compilation but to capture all settings.
FB8 Build Delphi Action has script events related to my task but I can’t find any documentation on it.
So what about OnGenerateCFG(…LibraryPath),OnCFGGenerated(…CFGStrings), OnGenerateResourceScript(…SkipResource…), OnBeforeCompileResource(…SkioResource…), OnAfterCompileResource(…UpdateDOF).
It looks like some of this events allow Skip compilation I need but how it effects the whole Build Delphi Action result. Thanks in advance.

The OnBeforeCompile event is the last one fired before compliation begins, so you can skip the compilation by setting SkipCompile = true in that event.

You can skip the resource compilation in the same way in the other events.

That said, I’m not sure I understand what it is you are trying to do? If you want the settings provided to the compiler you can turn on the option to keep the generated .cfg file

That will show the generated options for the compiler.

Thank you, Vincent.

Just to refine my problem.
We implement extension of our build process to be able test it’s corruption by compiler / library version upgrade.
We have hundreds of <project, settings> pairs to test so it have to be special variation of build process.

My current idea to implement it is to have special build flag to run local Build Delphi actions to skip actual compiler execution
but collect all compiler settings Build action makes then run another version of compiler with parameters collected on remote computer.
We don’t want to install FB for this rare testing so we need raw settings to run dcc/brcc.
Result logs and binaries could be transferred back to analyze.

So I need to capture contents of .cfg file and .rc generated.

I can’t use your suggestion on Keep generated .cfg since we use Load settings from project File option and it blocks all
Compiler options tab settings.


I hope to get .cfg contents from OnCfgGenerated CFGStrings parameter.
Is it enough to reproduce contents of .cfg?

The only features important for .rc file in our case is icon file path taken from .dproj and language settings.
Can I read .rc content generated from file when OnBeforeCompileResource event handler called?

I think we need to move that checkbox so that this doesn’t happen as it’s not actually affected by the loading of settings etc.

Turn off the Load compiler settings option, switch to the compiler tab, turn on the keep cfg option, switch back to the project tab and turn on the load compiler setting option again. That should work.

You can also use the OnCfgGenerated CFGStrings parameter is that is literally a TStringList (wrapped for scripting) that is saved to a file directly after that event.

Or it’s enough to get CFGStrings only?

Could you comment on .rc compilation.

I don’t believe the scripting will give you access to the generated .rc file - however that file is not deleted after compilation so the file is still there for you to look at.

But what happens if I SkipResource OnBeforeCompileResource? I see two resouce related stages of build in the log
Generating Resource File…
Including ICON File :…\…\…\CommonLib\Images\A0icon_256.ico
Generating Version Info…
Saving Resource file : D:\SVN\InfoStroy\trunk\A0\D10\WSProc\A0w.rc
Running Borland Resource compiler…
-c1251 -l0419 -v A0w.rc
CodeGear Resource Compiler/Binder
Version 1.2.2 Copyright (c) 2008-2012 Embarcadero Technologies Inc.

Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.

Creating A0w.RES
Using codepage 1251 as default
Writing ICON:1, lang:0x419, size 58737
Writing ICON:2, lang:0x419, size 51240
Writing ICON:3, lang:0x419, size 38056
Writing ICON:4, lang:0x419, size 16936
Writing ICON:5, lang:0x419, size 9640
Writing ICON:6, lang:0x419, size 4264
Writing ICON:7, lang:0x419, size 2440
Writing ICON:8, lang:0x419, size 1128
Writing GROUP_ICON:MAINICON, lang:0x419, size 118.
Writing VERSION:1, lang:0x419, size 480
Resource Compiled OK.

When 3 Resource-related events fired?

If I add

SkipResource = true;

In the OnBeforeCompileResource then I see this in the log

Generating Resource File....
Including ICON File :E:\\Emb\\Studio\\21.0\\bin\\delphi_PROJECTICON.ico
Including Manifest File :I:\Github\DelphiPackageManager\DPMMaster\Source\dpmManifest.xml
Saving Resource file : I:\Github\DelphiPackageManager\DPMMaster\Source\dpm.core.tests.rc
Skipped Running Resource compiler due to OnBeforeCompileResource script <<<<

I think there may be a bug in the OnGenerateResource event as SkipResource doesn’t appear to do anything in my quick test, investigating.

Ok, investigate, please. I have alternative idea to get .rc - I can set Resource compiler with my own script and receive .rc genererated. I’ll investigate this way too…
BTW, FB pdf dated 2010 so it could be good to update it.

Please try this build

You will still see the Generating Resource message, however if SkipResource = true then the resource will not be saved.

We will probably remove the pdf since all our documentation is on the wiki now

Are you talking about .rc script or about .res compiled? So SkipResource is “skip resource compilation” or "skip resource script generation ". My expectation is .rc have to be created if project option “Regenerate resource” enabled. Is it right?

Unfortunately wiki has no descriptoin on specific Build Delphi action events we discuss now. Or I’m looking in wrong place?

Unfortnately the help alway lags behind the product - we have limited resources - so priority always goes to working on the applications before the help. The only way that will change is if we charge a lot more for our products, which would turn people away. Catch 22.

Ok. We live in this reality too. But you know the docs is actually you product features faceplate/adverticement => cashflow :wink: