简体   繁体   中英

Trim MSBuild FileLogger output

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.

我通常使用grep,sed和awk做这样的事情。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM