Updating Delphi XE2 path at runtime

Is there any way to specify the path for the Delphi XE2 compiler during a build as it appears FB is just reading the applicable Embarcadero registry key when it starts?

This is a problem as we now want to keep the required parts of Delphi XE2 in our version control and update the reference at runtime based on where we check out to.  We do this with other tools we use in FB as they have global options that can be set by script during the build.  We can work around this by having one FB project change the key and then a second perform the main build and hence pickup the registry change, but it's not ideal.

So presuming we've not overlooked something, we need a way to set the compiler path or as an alternative a way of getting FB to re-read the registry key.

- Simon

On the Directories tab of the Delphi action properties dialog, turn off the option to “Use Global Delphi Library Path”, then you are free to put whatever you like in the library path field (including variables), this is in fact the recommended thing to do (and the default option when you add a new delphi action), using the IDE’s library path is a bad idea for many reasons.

Sorry I wasn't clear enough:

I am not referring to the the library search path the Delphi compiler uses  (which I agree should always be set in the build), instead I am referring to the path for the Delphi compiler itself (DCC32.exe/DCC64.exe, resource compiler etc).

We are upgrading to a newer version of Delphi and we want to checkout Delphi from our version control system and tell FB where to find it as we do this with as many tools as possible so we can use applicable versions to create updates to older releases of our products with minimal risk.

For example we use script such as the following to tell FB where to find Help and Manual and madExcept:

HelpAndManualOptions.HM4Location = HelpManPath;
MadExceptOptionsObject.MadExceptLocation = MadExceptPatchPath;

How can we achieve the same for the Delphi compiler action?

 

Hi Simon

Sorry I misread your question. The delphi action uses variables to determine the path to the compiler. If you look under Application variables you will see DELPHIXE2WIN32, DELPHIXE2WIN64, DELPHIXE2OSX32. To change that, just add project variables with the same name and set the variable to the path you need.

Note that the delphi action also virtualises a bunch of other variables based on compiler version, namely BDSUSERDIR, BDSPROJECTSDIR, BDSCOMMONDIR, and for XE 2 also BDSLIB, BDSBIN, BDSINCLUDE & CG_BOOST_ROOOT (some are only for CBuilder). These currently cannot be overriden due to the way they are virtualised. I have added a new script method to allow this to be done, I’ll post here when a build is uploaded (running now). Note that the variable virtualisation was needed because delphi relies on environment variables, as soon as you have more than one installed that becomes a serious problem for command line compilation.

Ok, this build has the new script method.

http://downloads.finalbuilder.com/downloads/finalbuilder/700/FB700_1945.exe

To override one of the virtualised delphi variables in the before action script event (javascript) :

Action.SetDelphiVariable(cvDelphiXE2,“BDSLIB”,“c:\temp\blah”);

Note that this will then apply to all delphi actions that are set to use delphi XE2.

Many thanks for the quick turn around on an update!

We'll give that build a try and let you know if we have any issues.