3
votes

I try to configure Hudson (3.1.0) to build Delphi XE3 project (MSBuild).

Batch for build:

call "C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\bin\rsvars.bat"
msbuild "X:\Tests\DelphiTest\Project1Test.dproj" /t:Build /v:minimal /p:config="Debug"

Run this batch in command line (cmd.exe) - build correct.

When I put this batch into Hudson build step faild with errors from delphi compiler:

[..]

C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\bin\CodeGear.Common.Targets : warning : Expected configuration file missing - C:\Windows\system32\config\systemprofile\AppData\Roaming\Embarcadero\BDS\10.0\EnvOptions.proj
_PasCoreCompile:
    Embarcadero Delphi for Win32 compiler version 24.0
    Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\Bin\CodeGear.Delphi.Targets(172,5): error E1026: File not found: 'Controls.res'

[..]

In fact I don't have missing file in this location. But I've found it in
C:\Users\<username>\AppData\Roaming\Embarcadero\BDS\10.0

So I try do dummy think like copy existing dir to missing location but it doesn't work.

I'm using: Delphi XE3 Enterprise, Win 7 Ultimate (x64)

Thanks for help.

2
Don't know about Hudson, but MSBUILD should be expanding the APPDATA environment variable in whatever XE3's version of CodeGear.Common.Targets is <Import Project="$(APPDATA)\borland\$(BDSAppDataBaseDir)\5.0\EnvOptions.proj" , Condition="Exists('$(APPDATA)\borland\$(BDSAppDataBaseDir)\5.0\EnvOptions.proj')"/>, so you need to get Hudson to set that correctly for whatever user it is logged in as.Gerry Coll
Make that <EnvOptions>$(APPDATA)\Embarcadero\$(BDSAppDataBaseDir)\$(ProductVersion)\EnvOptions.proj</EnvOptions>Gerry Coll
@GerryColl Where should I add this <EnvOptions>, some Hudson config file?robertw
Finally I solved problem using tips in question stackoverflow.com/questions/5735241/… I've changed user which Hudson windows servis is loggin in. Now, everything is fine. I know this is an intermediate solution but for me and my environment is fine. Thanks for help!robertw
FWIW: The EnvOptions tag is in CodeGear.Common.Targets, which is in the Delphi/Rad Studio bin folder. It is an MSBuild "target" file, that tells MSBuild where to find other info.Gerry Coll

2 Answers

2
votes

this usually happens the first time you run MSBUILD or DCC32 on a machine which has never had the IDE gui open (bds.exe) and which has passed the mandatory startup environment configuration tasks that happen inside BDS.exe.

If you log in on Hudson or Jenkins as a Windows service using an account that has never been used for Windows logins, has never run BDS.exe, you will get this issue. The MSBUILD utility from Microsoft must invoke DCC32, which is licensed commercial software, and the Delphi command line compilation licensing and environment configuration requires that you have run the IDE as the account, and that your jenkins build account and computer is licensed properly.

Solution:

  1. Either change Jenkins or Hudson to log in as an account that has a license to run Delphi, and has run Delphi at least once.

  2. If you can't change the server login, then log in interactively (via remote desktop) using the account that Jenkins/Hudson is using, and configure Delphi (Rad Studio) so it runs fine from that account.

Update 2015: I am now running into a whole new class of problems related to Group Managed Service Accounts. They were working with Delphi XE8, but I am not able to get a GMSA account to work with Delphi 10 Seattle. I'll update this answer if I ever do figure out a way, but for now, I recommend conventional service accounts, not GMSAs, for Delphi continuous integration with Jenkins or Continua, or others. Also check Delphi.wikia.com for more tips: http://delphi.wikia.com/wiki/Setting_up_a_Delphi_Build_Machine

1
votes

We recently ran in a similar kind of problem. We are trying to compile our projects on an jenkins. We simplified the "build" script to the following 2 lines

call "[....]Embarcadero\Studio\18.0\bin\rsvars.bat"
MSBuild.exe /p:config=Release /target:Rebuild  Project2.dproj

This is building the project successful.

But when we switch to /p:config=debug the build fails with the known errors about missing *.res files. We looked up in the delphi lib/win32/ directory and realized that there are *.res files in the release folder but not in the debug folder. We now further modified the msbuild command to this:

MSBuild.exe /p:config=Release /target:Rebuild /p:ResourcePath="%BDS%\lib\win32\release" Project2.dproj

And this is compiling just fine. So apparently the compiling in debug mode lacks the path to the delphi sources (which are included in several subfolders in %BDS%\source\

So as a workaround we can compile debug builds using jenkins and simply giving delphi the *.res files from its release folder. But that can only be an intermediate solution.

Maybe this information helps someone to find a final solution which is not "Adding all subfolders of %BDS%\source into the search path" ;-)