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

**URL:** https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095
**Category:** Discussion
**Created:** [August 7, 2021, 1:46pm UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095 "2021-08-07T13:46:55Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 7, 2021, 1:46pm UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/1 "2021-08-07T13:46:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [August 10, 2021, 8:20am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/2 "2021-08-10T08:20:16Z")

</div>

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

 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/9/9b749454450354f089f559835e3cbdebabb8f3c8.png)

That will show the generated options for the compiler.

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 10, 2021, 10:35am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/3 "2021-08-10T10:35:18Z")

</div>

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.

 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/0/0bad2947b2c3117809b7fb7f52546db6c9458022.png)

![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/b/b3965656b8c52c8f3765558e104609a2f61acc9b.png)

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?

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [August 10, 2021, 10:42pm UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/4 "2021-08-10T22:42:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 11, 2021, 11:53am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/5 "2021-08-11T11:53:45Z")

</div>

> [@Andrey](#):
>
> 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?

Or it’s enough to get CFGStrings only?

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 12, 2021, 7:02am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/6 "2021-08-12T07:02:37Z")

</div>

Could you comment on .rc compilation.

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [August 12, 2021, 7:05am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/7 "2021-08-12T07:05:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 12, 2021, 7:24am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/8 "2021-08-12T07:24:22Z")

</div>

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  
A0w.rc.  
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?

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [August 12, 2021, 7:42am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/9 "2021-08-12T07:42:15Z")

</div>

If I add

```javascript
SkipResource = true;

```

In the OnBeforeCompileResource then I see this in the log

```auto
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.

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 12, 2021, 8:17am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/10 "2021-08-12T08:17:32Z")

</div>

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.

 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/f/fc4bb0429cd85ea094c6f3d16496bcfe98e8f8d8.png)

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [August 12, 2021, 8:17am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/11 "2021-08-12T08:17:36Z")

</div>

Please try this build

[https://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800\_3022.exe](https://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800_3022.exe)

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

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [August 12, 2021, 8:18am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/12 "2021-08-12T08:18:51Z")

</div>

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

[https://wiki.finalbuilder.com/display/FB8](https://wiki.finalbuilder.com/display/FB8)

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 12, 2021, 8:29am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/13 "2021-08-12T08:29:27Z")

</div>

> [@Vincent](#):
>
> You will still see the Generating Resource message, however if `SkipResource = true` then the resource will not be saved.

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?

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 12, 2021, 8:35am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/14 "2021-08-12T08:35:54Z")

</div>

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

- [Build Delphi Project Action - FinalBuilder 8 - VSoft Technologies Documentation Wiki](https://wiki.finalbuilder.com/display/FB8/Build+Delphi+Project+Action)
- [Action Script Events - FinalBuilder 8 - VSoft Technologies Documentation Wiki](https://wiki.finalbuilder.com/display/FB8/Action+Script+Events)

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [August 12, 2021, 8:37am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/15 "2021-08-12T08:37:52Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Andrey](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@Andrey](https://www.finalbuilder.com/forums/u/Andrey)
#### Post date: [August 12, 2021, 8:48am UTC](https://www.finalbuilder.com/forums/t/build-delphi-using-events-to-capture-compiler-settings-for-compatibility-testing/7095/16 "2021-08-12T08:48:04Z")

</div>

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