Last week, I wrote about msbuild verbosity levels. The post was both for my own documentation, but also out of need as I wanted to have way more verbose logging for a Delphi build process involving search path configurations.
When using my Delphi build script you can both pass msbuild options and Delphi compiler options:
Run-Dependend-rsvars-From-Path.bat 5 msbuild -verbosity:detailed "/p:DCC_OutputDependencies=true" MyProject.dproj
The bold one is the msbuild parameter, the italic one the Delphi compiler parameter for unit dependencies. They are directly passed to msbuild:
...\msbuild.exe /target:build /p:DCC_BuildAllUnits=true /p:config=Debug -verbosity:detailed "/p:DCC_OutputDependencies=true" MyProject.dproj
You can multiple options too:
Run-Dependend-rsvars-From-Path.bat 5 msbuild -verbosity:detailed "/p:DCC_OutputDependencies=true" "/p:DCC_Quiet=false" MyProject.dproj
In addition to unit dependencies, you can also get an overview of .dfm
and other resource file dependencies by passing /p:DCC_OutputDRCFile=true
on the command-line this will generate a DRC file that not just has all the resource string constants in it, but also a comment section specifying all resource files including these file types:
Both DCC_OutputDependencies
and DCC_OutputDRCFile
can also be set to true in a .dproj
file and are configurable under two different project option paths:
DCC_OutputDependencies
: “Project Options” -> “Delphi Compiler” -> “Compiling” -> “Output unit dependency information”
DCC_OutputDRCFile
: “Project Options” -> “” -> “Delphi Compiler” -> “Linking” -> “Ouput resource string .drc file”
The -verbosity:detailed
however, is not passed to the various Delphi DCC
compilers, as somewhere along the line, the CodeGear.Delphi.Targets
got changed to Quiet="true"
somewhere in-between Delphi 2007 and Delphi 2010.
Delphi 2007 had from Borland.Delphi.Targets
files containing from Quiet="$(DCC_Quiet)"
; the file got renamed and changes likely in Delphi 2009. See these related posts:
This means as of then on, the DCC commandline compilers will always output non-verbose logging. Even specifying "/p:DCC_AdditionalSwitches=-Q-"
will not help: you will just get blank lines.
In the past, one of the things the verbose DCC logging would help you to see which files where accessed using the actual build. This was a tremendous help when figuring out search path problems that kick in every now and then.
For units, there is a little trick you can use here: it’s the /p:DCC_OutputDependencies=true"
option you see above.
It will output an additional file with the .d
extension that:
- on the first two lines are an empty line followed by lining having the the .dpr filenamea space and a backslash
- continues with units in reverse order of dependency:
- optional lines having two tabs, a full .dcu filename (even if the file was actually a .pas file), a space and a backslash
- a final line having two tabs, a full .dcu filename (even if the file was actually a .pas file) but no space or backslash
That file is relatively easy to scan or parse for path problems.
Project settings
I am not sure at which Delphi version the depends
feature became a project setting, but it is. The odd thing: it does not always work, at least not in the Delphi 102. Tokyo installations I have used.
In a .dproj file, it is inside this element: <DCC_OutputDependencies>true</DCC_OutputDependencies>
just like the msbuild name.
In the UI, you can find it here:
Related
–jeroen