Can I build a Delphi multi language project from the command line? - delphi

Using Delphi 2009 (or higher) and the ITE (Internal Translation Manager), how can I build the language projects from the command line? The projects are for example
Project\Languages\DEU\Project_DEU.bdsproj
Project\Languages\ENG\Project_ENG.bdsproj
Theses bdsproj files are not MSBuild projects, so do I have to call DCC32 and pass all search paths and compiler parameters using a script file, or is there a way to use MSBuild for this task, if I specifiy a special build target?

You could have a separate .groupproj including the .dproj files.

Related

Will the dcc32.exe compiler use project build configuration file when is called with --no-config parameter?

Problem description:
Consider the following command line call (called for Delphi 2009 compiler):
dcc32.exe --no-config --peflags:1 Project.dpr
Will this call use the Project.dproj or Project.dof configuration files ?
If yes, will the command line options take precedence over the configuration file(s) ?
If not, where the build configuration will be taken from if the dcc32.cfg file is not loaded in this case ?
Problem background:
I know that MSBuild should be used since Delphi 2007 but in fact, it's the reason why I'm asking. I found that InnoSetup uses this batch file for building its projects and I have serious problems to link the JEDI JVCL library to it (it's a pure nightmare). So I'd like to configure the project settings to use MSBuild, but I'm not sure what build settings are used in the above command line call.
--no-config means that dcc32.cfg is not loaded, neither from the compiler executable directory, nor from the project directory.
The rules for applying options specified in .dproj and .dof files are not affected. Those options are applied and any command line options take precedence.

Is it possible to run the command line compiler with selected build configuration in Delphi XE2?

I'd like to make builds from the command line and I'm wondering if there's a way how to execute the command line compiler with selected build configuration ?
I know there is option --no-config which won't load default dcc32.cfg file but I would like to set the build configuration I've prepared in my project.
I would like to run something like
dcc32.exe --some-option RELEASE Win32 PLATFORM
Is there some option for selecting build configuration ?
Thank you
You need to be using msbuild rather than dcc32 for this:
msbuild myproject.dproj /p:Config=RELEASE;Platform=Win32
Make sure you have called the rsvars.bat file from the RAD Studio bin folder before you attempt to call msbuild. This sets up the necessary environment variables.
The great thing about the modern msbuild based build system, as implemented in Delphi, is that you can quite easily ensure that your command line builds are identical to your IDE builds.
As far as I know, you can use the dcc64.exe to compile for 64-bit if you do not want to use MSBuild. It is in the same folder as the dcc32.exe (and dccosx.exe for compile for OSX)

How can I get MSBuild to do a full build of a Delphi project equivalent to dcc32 -b?

How can I get MSBuild to do a full build of a Delphi project equivalent to dcc32 -b?
I've got two projects I'm trying to build, the first one uses some conditional defines, which are getting passed via msbuild to the dcc32. However, some common units appear to be stuck with the first set of conditionals, so the second project is built improperly.
I believe it's /t:rebuild, the msbuild output lists "Deleting file: ..." for all the dcu's, then builds the project.
I use a batch file to call msbuild to build delphi projects, for Delphi 2007 and Delphi 2009 (which just has a different path for %BDS%):
set DCC_Quiet=true
set BDS=%ProgramFiles%\CodeGear\RAD Studio\5.0
set MSBuildBinPath=%WinDir%\Microsoft.NET\Framework\v2.0.50727
call %MSBuildBinPath%\msbuild /nologo /t:rebuild /p:config=Release %1 %2 %3 %4 %5
[Note, from this question, for Release "Build Configuration", Delphi 2009 is /p:config=Release, and Delphi 2007 is /p:Configuration=Release]
I guess the question Delphi MSBuild Build Configuraions From Command Line contains the answer. Try
msbuild /target:Build
As I remember in D7 there was a similar problem when GUI vs dcc32 produced different builds. Take a look at location and content of your dcc32.cfg file(s). They actually can contain as many conditionals as you need. One conditional per-line
Another option is to delete the DCU's of the compiled units after your first build is complete and before you start your next one.
With my RAD Studio 2010 Professional, /t:rebuild is not defined. I figured
MSBuild.exe /t:Build /p:config=Release;DCC_BuildAllUnits=true
does the job

Delphi MSBuild Build Configurations From Command Line

Delphi 2009 uses build configurations. When you create a new project you have two default build configurations "Debug" and "Release".
Now I asked myself how to automate builds using MSBuild (which is supported by Delphi since version 2007).
You can start the "msbuild" command in the "RAD Studio Command Prompt" in some Delphi project directory and it will build the default build configuration (the last activated build configuration inside the Delphi IDE).
Now, I want to specify a certain (non-default) build configuration by a command line parameter.
The Delphi help asserts that the parameter is [/p:configuration=<configuration name>], which is wrong (Delphi 2009, Help Update 1)!
What is the right way?
Now, if you want to change the build configuration you have to add the parameter
/p:config=<BUILD_CONFIG_NAME>
For example:
C:\Projects\TestDelphiApp001>msbuild /target:Build /p:config=Release
or
C:\Projects\TestDelphiApp001>msbuild /target:Build /p:config=Debug
Copied from original "question"; note community wiki.
I tried this with Delphi XE. It didn't work until I figured out I needed to set the environment variables referenced by the .dproj file:
SET BDS=C:\Program Files (x86)\Embarcadero\RAD Studio\8.0
SET BDSBIN=C:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin
SET BDSAPPDATABASEDIR=BDS
msbuild myproject.dproj /target:Build /p:config=Release
I've had the same problem and found the solution:
Write /p:config instead of /p:configuration
Write "Release Build" or "Debug Build" (in double quotes) instead of Release or Debug
It did it for me.

Running Delphi builds under TFS MSBuild

Wanting to build and test a bunch of Borland Delphi 6 projects that are integrated with ASP.NET services. Had been using WANT and CruiseControl for building Delphi. With TFS Build agent we can tie all together and do some testing. I am looking for guidance and direction.
One issue I see is that there is no "solution" in a Delphi project to be given to MSBuild as a '<'SolutionToBuild'>'.
<SolutionToBuild Include="There is no such thing as a Delphi.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
Also, I have references to <UsingTask> but am a little unsure how to use them. The <UsingTask> allows run custom task for Delphi command-line compile.
Your guidance would be appreciated.
Can you upgrade? Delphi 2006+ uses MSBuild by default. There is nothing to configure.
You can use MSBuild to run the Delphi command line compiler. It's been a while, but I'm pretty sure either the IDE supports command line compilation or there is a stand-alone compiler that can be run from the command line. In either case, you would need to create an <Exec> task that runs the appropriate command line build tool with the required parameters.
When you say you have "references to <UsingTask>" do you mean that you are importing an external MSBuild task? The <UsingTask> element is used to pull in a custom MSBuild task that resides in an external assembly (DLL). Once the task is imported, you use it just like you would any other built-in task.

Resources