Blank lines instead of outputting task console in MSBuild

My product is migrating from Delphi 6 to the new Delphi XE3. Delphi 6 compiler used to display a list of files compiled into an executable file:

Borland Delphi Version 14.0 Copyright (c) 1983,2002 Borland Software Corporation ProjectName.dpr(X) ... PathToSomeUnit.pas(X) ... PathToSomeIncludedFile.inc(X) ... X lines, X.XX seconds, X bytes code, X bytes data. 

where "X" means some numbers

We have internal software for analyzing dependencies between applications and specific files - units and included files. This software uses the dcc32 console output (such as the one above) as its input.

With the new Delphi XE3, we no longer call dcc32 directly, but we use MSBuild. Unfortunately, the console output is not the same as Delphi 6. If the "Quiet compile" parameter is disabled, the console output contains several empty lines instead of a list of compiled files.

 Embarcadero Delphi for Win32 compiler version 24.0 Copyright (c) 1983,2012 Embarcadero Technologies, Inc. [multiple blank lines] X lines, XX seconds, X bytes code, X bytes data. (TaskId:65) 

With the / verbosity: diagnostic parameter, it looks like this

 Embarcadero Delphi for Win32 compiler version 24.0 (TaskId:65) Copyright (c) 1983,2012 Embarcadero Technologies, Inc. (TaskId:65) (TaskId:65) (TaskId:65) (TaskId:65) (TaskId:65) (TaskId:65) (TaskId:65) ... X lines, XX seconds, X bytes code, X bytes data. (TaskId:65) 

When dcc32 was called directly, a similar problem arose, but it was solved using the -B compiler (-B = Build all units). I tried a similar approach with MSBuild by adding / p: DCC_AdditionalSwitches = -B, but still it prints a few empty lines.

+2
source share
2 answers

Here a solution is possible:

  • Backup files, etc.
  • Open the .NET Framework SDK v2.0 command prompt.
  • Borland.Build.Tasks.Delphi.dll (located in the $(BDS)\bin ):

    ildasm Borland.Build.Tasks.Delphi.dll /out=Borland.Build.Tasks.Delphi.il

  • Modify Borland.Build.Tasks.Delphi.dcctask.xml (created in the previous step) and comment out the Ignore OutputParsing node subdirectory.

  • Collect it:

    ilasm Borland.Build.Tasks.Delphi.il /dll

  • Register a strong name for him:

    sn -Vr Borland.Build.Tasks.Delphi.dll

If you turned silent mode off, as described in this answer , creating Delphi projects using MSBuild should now show detailed compiler output.

+2
source

Add - depends on the DCC32 command line or / p: DCC_OutputDependencies = true to msbuild, it will output a .d file that can be easily analyzed, for example, the example below:

 C:\publico\BUILD\temp\YourDPR.exe: YourDPR.dpr \ C:\blabla blabla\FrameWork\Base\biblioteca\dcus\unit15.dcu \ C:\blabla blabla\FrameWork\Base\biblioteca\dcus\unit13.dcu \ C:\bla bla\bla\LIBD5\Units\unit12.dcu \ C:\blabla blabla\FrameWork\Base\biblioteca\rxlib\units\unit1.dcu \ C:\blabla blabla\FrameWork\Base\biblioteca\rxlib\units\unit13.dcu \ C:\bla bla\bla\LIBD5\Units\unit1.dcu \ C:\bla bla\bla\LIBD5\Units\unit12.dcu \ 

Ps. You can hide these empty msbuild lines with / p: DCC_Hints = false;

+1
source

Source: https://habr.com/ru/post/1233147/


All Articles