Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.4 KiB

  1. while ($_ = $ARGV[0], /^-/)
  2. {
  3. shift;
  4. last if /^--$/;
  5. /^-d(.*)/i && ($targetroot = $1);
  6. /^-f(.*)/i && ($projectinifile = $1);
  7. /^-p(.*)/i && ($platformfilter = $1);
  8. /^-c(.*)/i && ($config = $1);
  9. }
  10. ($targetroot && $projectinifile) || die "Usage: CheckProjects.pl -D<target root dir> -F<project ini file> [-C<Release|Debug>] [-P<platform filter>]\n";
  11. open (FILE, $projectinifile) || die "Error opening $projectinifile!\n";
  12. while (<FILE>)
  13. {
  14. /^\[(.*)\]/ && ($projectname = $1) && (push @projectlist, $projectname);
  15. if ( $projectname )
  16. {
  17. /^Directory=(.*)/i && ($directory{$projectname} = $1);
  18. /^Platform=(.*)/i && ($platform{$projectname} = $1);
  19. /^Build=(.*)/i && ($build{$projectname} = $1);
  20. /^ProjectType=(.*)/i && ($projecttype{$projectname} = $1);
  21. /^ProjectFile=(.*)/i && ($projectfile{$projectname} = $1);
  22. }
  23. }
  24. close FILE;
  25. if ( $config =~ /Debug/i )
  26. {
  27. $logfile = "$targetroot\\BuildErrors_Debug.log";
  28. }
  29. else
  30. {
  31. $logfile = "$targetroot\\BuildErrors.log";
  32. }
  33. open (OUTFILE, ">$logfile") || die "Error opening $logfile: $!\n";
  34. $BuildLog = "";
  35. $ProjectLog = "";
  36. $BuildFailed = 0;
  37. $ProjectFailed = 0;
  38. $projectname = "";
  39. for ($i = 0; $i <= $#projectlist; $i++)
  40. {
  41. $project = $projectlist[$i];
  42. if ( ! $platformfilter || ($platform{$project} =~ /$platformfilter/i) )
  43. {
  44. if ( $build{$project} =~ /Yes/i )
  45. {
  46. $targetdir = "$targetroot\\$directory{$project}";
  47. ( $projectfile{$project} =~ /(.*)\.(.*)/ ) && ( $projectname = $1 );
  48. if ( $projecttype{$project} =~ /vc5/i )
  49. {
  50. $projectfilepath = "$targetdir\\$projectname.plg";
  51. }
  52. else
  53. {
  54. if ( $config =~ /Debug/i )
  55. {
  56. $projectfilepath = "$targetdir\\$projectfile{$project}_Debug.log";
  57. }
  58. else
  59. {
  60. $projectfilepath = "$targetdir\\$projectfile{$project}.log";
  61. }
  62. }
  63. print "Checking $projecttype{$project} project $projectfilepath...\n";
  64. if ( open (PROJFILE, $projectfilepath) )
  65. {
  66. while (<PROJFILE>)
  67. {
  68. if ( $projecttype{$project} =~ /vc/i )
  69. {
  70. ( /-{20}Configuration: .*-{20}/ ) && ( $ProjectLog = "" );
  71. $ProjectLog = "$ProjectLog$_";
  72. if ( /- (\d+) error\(s\),/ && $1 > 0 )
  73. {
  74. $BuildLog = "$BuildLog$ProjectLog";
  75. $ProjectFailed = 1;
  76. $BuildFailed = 1;
  77. }
  78. }
  79. elsif ( $projecttype{$project} =~ /vb/i )
  80. {
  81. $BuildLog = "$BuildLog$_";
  82. if ( /failed/gi )
  83. {
  84. $ProjectFailed = 1;
  85. $BuildFailed = 1;
  86. }
  87. }
  88. }
  89. close PROJFILE;
  90. }
  91. else
  92. {
  93. print "Error opening $projectfilepath: $!\n";
  94. $ProjectFailed = 1;
  95. $BuildFailed = 1;
  96. }
  97. if ( $ProjectFailed > 0 )
  98. {
  99. print OUTFILE "****************************************************************************************\n";
  100. print OUTFILE "$projectfilepath\n$BuildLog\n\n";
  101. }
  102. $ProjectFailed = 0;
  103. $BuildLog = "";
  104. }
  105. }
  106. }
  107. close OUTFILE;
  108. exit $BuildFailed;