2
votes

If I compile this Delphi 2007 project

program MyProject;

{$APPTYPE CONSOLE}

procedure Test;
var
  i: Integer;
begin
  if i = 666 then
    i := 42;
end;

begin
  Test;
end.

from the command line like

    MSBuild MyProject.dproj /t:Rebuild /p:Configuration=Release /l:FileLogger,Microsoft.Build.Engine;logfile=log.txt;verbosity=minimal

I get this log file:

    __________________________________________________
    Projekt C:\Documents and Settings\pcbs1251\My Documents\RAD Studio\Projekte\MyProject\MyProject.dproj (Rebuild-Ziel(e)):

    C:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe -B -DRELEASE [SNIP] MyProject.dpr   
    CodeGear Delphi für Win32 Compiler-Version 18.5
    Copyright (c) 1983,2007 CodeGear

    MyProject.dpr(10) Hinweis: H2077 Auf 'i' zugewiesener Wert wird niemals benutzt

    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Borland.Delphi.Targets : warning : MyProject.dpr(9) Warnung: W1036 Variable 'i' ist möglicherweise nicht initialisiert worden
    MyProject.dpr(9) Warnung: W1036 Variable 'i' ist möglicherweise nicht initialisiert worden

    17 Zeilen, 0.00 Sekunden, 11016 Byte-Code, 12156 Byte-Daten.
    Erstellen des Projekts MyProject.dproj beendet.

Now I would like to trim this to

    MyProject.dpr(10) Hinweis: H2077 Auf 'i' zugewiesener Wert wird niemals benutzt
    MyProject.dpr(9) Warnung: W1036 Variable 'i' ist möglicherweise nicht initialisiert worden

Are there any FileLoggerParameters to do this?

Update: As there seems no way to make MSBuild do what I want I finally wrote a little Delphi program to format the MSBuild output to my needs.

2
Can you give us a little more context? Where do you want to see this output?Jay Bazuzi
@Jay: The block ending with "Erstellen ... beendet." is what the FileLogger currently writes to log.txt. I'd rather have it write the two line block instead. No copyright, no summary, no duplicate warnings etc.Uli Gerhardt
Why? What is the next step in your process?Jay Bazuzi
I want to store the log file in version control, because we have some compiler messages which we can't get rid of, and I want to be able to see the development of that list. I started off by manually storing the output of the IDE's message window and want to replicate this format as close as possible.Uli Gerhardt

2 Answers

3
votes

I generally use grep, sed and awk to do things like this.

2
votes

Try msbuild /v:m. This sets msbuild command line verbosity to "minimal". It may give you something closer to what you want. See 'msbuild /?' for help on that.

Many command line tools have a '/nologo' option that could help. Maybe you can get that passed to dcc. Maybe you'll have to edit the .targets files.