Make build-webkit output VCExpress 2010 build logs properly.
authorroger_fong@apple.com <roger_fong@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 May 2013 23:47:23 +0000 (23:47 +0000)
committerroger_fong@apple.com <roger_fong@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 May 2013 23:47:23 +0000 (23:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=117096

Reviewed by Brent Fulgham.

Make it so that output from VCExpress is always printed to console.
Get build log results from AssembleBuildLogs project output.
We don't need those old VCExpress scripts anymore either.

* Scripts/build-webkit:
* Scripts/print-msvc-project-dependencies: Removed.
* Scripts/print-vse-failure-logs: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151056 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/build-webkit
Tools/Scripts/print-msvc-project-dependencies [deleted file]
Tools/Scripts/print-vse-failure-logs [deleted file]

index 9698ca1..8f3cba0 100644 (file)
@@ -1,3 +1,18 @@
+2013-05-31  Roger Fong  <roger_fong@apple.com>
+
+        Make build-webkit output VCExpress 2010 build logs properly.
+        https://bugs.webkit.org/show_bug.cgi?id=117096
+
+        Reviewed by Brent Fulgham.
+
+        Make it so that output from VCExpress is always printed to console.
+        Get build log results from AssembleBuildLogs project output.
+        We don't need those old VCExpress scripts anymore either. 
+
+        * Scripts/build-webkit:
+        * Scripts/print-msvc-project-dependencies: Removed.
+        * Scripts/print-vse-failure-logs: Removed.
+
 2013-05-31  Brent Fulgham  <bfulgham@apple.com>
 
         [Windows] Use WinLauncher to display LayoutTest results
index e22f2c9..9e33938 100755 (executable)
@@ -347,17 +347,26 @@ for my $dir (@projects) {
     # Various build* calls above may change the CWD.
     chdirWebKit();
 
+    my $baseProductDir = baseProductDir();
+    if (usingVisualStudioExpress()) {
+        # Visual Studio Express is so lame it can't stdout build failures.
+        # So we find its logs and dump them to the console ourselves.
+        
+        open(my $OUTPUT_HANDLE, '<', "$baseProductDir/BuildOutput.htm");
+        if ($OUTPUT_HANDLE) {
+            print while (<$OUTPUT_HANDLE>);
+            close($OUTPUT_HANDLE);
+        }
+        else {
+            print "Error: BuildOutput.htm created by AssembleBuildLogs project is missing!";
+        }
+    }
+
     if (exitStatus($result)) {
         my $scriptDir = relativeScriptsDir();
-        if (usingVisualStudioExpress()) {
-            # Visual Studio Express is so lame it can't stdout build failures.
-            # So we find its logs and dump them to the console ourselves.
-            system(File::Spec->catfile($scriptDir, "print-vse-failure-logs"));
-        }
         if (isAppleWinWebKit()) {
             print "\n\n===== BUILD FAILED ======\n\n";
             print "Please ensure you have run $scriptDir/update-webkit to install dependencies.\n\n";
-            my $baseProductDir = baseProductDir();
             print "You can view build errors by checking the BuildLog.htm files located at:\n$baseProductDir/obj/<project>/<config>.\n";
         }
         exit exitStatus($result);
diff --git a/Tools/Scripts/print-msvc-project-dependencies b/Tools/Scripts/print-msvc-project-dependencies
deleted file mode 100755 (executable)
index dbc8402..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 2008 Apple Inc. All Rights Reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use File::Basename;
-
-sub printDependencyTree($);
-
-my $basename = basename($0);
-@ARGV or die "Usage: $basename sln1 [sln2 sln3...]";
-
-foreach my $sln (@ARGV) {
-    printDependencyTree($sln);
-}
-
-exit;
-
-sub printDependencyTree($)
-{
-    my ($sln) = @_;
-
-    unless (-f $sln) {
-        warn "Warning: Can't find $sln; skipping\n";
-        return;
-    }
-
-    unless (open SLN, "<", $sln) {
-        warn "Warning: Can't open $sln; skipping\n";
-        return;
-    }
-
-    my %projectsByUUID = ();
-    my $currentProject;
-
-    my $state = "initial";
-    foreach my $line (<SLN>) {
-        if ($state eq "initial") {
-            if ($line =~ /^Project\([^\)]+\) = "([^"]+)", "[^"]+", "([^"]+)"\r?$/) {
-                my $name = $1;
-                my $uuid = $2;
-                if (exists $projectsByUUID{$uuid}) {
-                    warn "Warning: Project $name appears more than once in $sln; using first definition\n";
-                    next;
-                }
-                $currentProject = {
-                    name => $name,
-                    uuid => $uuid,
-                    dependencies => {},
-                };
-                $projectsByUUID{$uuid} = $currentProject;
-
-                $state = "inProject";
-            }
-
-            next;
-        }
-
-        if ($state eq "inProject") {
-            defined($currentProject) or die;
-
-            if ($line =~ /^\s*ProjectSection\(ProjectDependencies\) = postProject\r?$/) {
-                $state = "inDependencies";
-            } elsif ($line =~ /^EndProject\r?$/) {
-                $currentProject = undef;
-                $state = "initial";
-            }
-
-            next;
-        }
-
-        if ($state eq "inDependencies") {
-            defined($currentProject) or die;
-
-            if ($line =~ /^\s*({[^}]+}) = ({[^}]+})\r?$/) {
-                my $uuid1 = $1;
-                my $uuid2 = $2;
-                if (exists $currentProject->{dependencies}->{$uuid1}) {
-                    warn "Warning: UUID $uuid1 listed more than once as dependency of project ", $currentProject->{name}, "\n";
-                    next;
-                }
-
-                $uuid1 eq $uuid2 or warn "Warning: UUIDs in depedency section of project ", $currentProject->{name}, " don't match: $uuid1 $uuid2; using first UUID\n";
-
-                $currentProject->{dependencies}->{$uuid1} = 1;
-            } elsif ($line =~ /^\s*EndProjectSection\r?$/) {
-                $state = "inProject";
-            }
-
-            next;
-        }
-    }
-
-    close SLN or warn "Warning: Can't close $sln\n";
-
-    my %projectsNotDependedUpon = %projectsByUUID;
-    CANDIDATE: foreach my $candidateUUID (keys %projectsByUUID) {
-        foreach my $projectUUID (keys %projectsByUUID) {
-            next if $candidateUUID eq $projectUUID;
-            foreach my $dependencyUUID (keys %{$projectsByUUID{$projectUUID}->{dependencies}}) {
-                if ($candidateUUID eq $dependencyUUID) {
-                    delete $projectsNotDependedUpon{$candidateUUID};
-                    next CANDIDATE;
-                }
-            }
-        }
-    }
-
-    foreach my $project (values %projectsNotDependedUpon) {
-        printProjectAndDependencies($project, 0, \%projectsByUUID);
-    }
-}
-
-sub printProjectAndDependencies
-{
-    my ($project, $indentLevel, $projectsByUUID) = @_;
-
-    print " " x $indentLevel, $project->{name}, "\n";
-    foreach my $dependencyUUID (keys %{$project->{dependencies}}) {
-        printProjectAndDependencies($projectsByUUID->{$dependencyUUID}, $indentLevel + 1, $projectsByUUID);
-    }
-}
diff --git a/Tools/Scripts/print-vse-failure-logs b/Tools/Scripts/print-vse-failure-logs
deleted file mode 100755 (executable)
index 7580465..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2010 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-# 
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# This is a very simple script designed to crawl the build directory
-# for visual studio express build logs and print them to stdout.
-
-from __future__ import with_statement
-
-import codecs
-import os
-import re
-
-from webkitpy.common.checkout import scm
-from webkitpy.common.system.executive import Executive
-from webkitpy.thirdparty import BeautifulSoup
-
-
-class PrintVisualStudioExpressLogs(object):
-    def __init__(self):
-        self._executive = Executive()
-
-    def _find_buildlogs(self, build_directory):
-        build_log_paths = []
-        for dirpath, dirnames, filenames in os.walk(build_directory):
-            for file_name in filenames:
-                if file_name == "BuildLog.htm":
-                    file_path = os.path.join(dirpath, file_name)
-                    build_log_paths.append(file_path)
-        return build_log_paths
-
-    def _build_order(self):
-        """Returns a list of project names in the order in which they are built."""
-        script_path = os.path.join(self._scripts_directory(), "print-msvc-project-dependencies")
-        sln_path = os.path.join(scm.find_checkout_root(), "WebKit", "win", "WebKit.vcproj", "WebKit.sln")
-        lines = self._executive.run_command([script_path, sln_path]).splitlines()
-        order = [line.strip() for line in lines if line.find("Folder") == -1]
-        order.reverse()
-        return order
-
-    def _sort_buildlogs(self, log_paths):
-        build_order = self._build_order()
-        def sort_key(log_path):
-            project_name = os.path.basename(os.path.dirname(os.path.dirname(log_path)))
-            try:
-                index = build_order.index(project_name)
-            except ValueError:
-                # If the project isn't in the list, sort it after all items that
-                # are in the list.
-                index = len(build_order)
-            # Sort first by build order, then by project name
-            return (index, project_name)
-        return sorted(log_paths, key=sort_key)
-
-    def _obj_directory(self):
-        build_directory_script_path = os.path.join(self._scripts_directory(), "webkit-build-directory")
-        # FIXME: ports/webkit.py should provide the build directory in a nice API.
-        # NOTE: The windows VSE build does not seem to use different directories
-        # for Debug and Release.
-        build_directory = self._executive.run_command([build_directory_script_path, "--top-level"]).rstrip()
-        return os.path.join(build_directory, "obj")
-
-    def _scripts_directory(self):
-        return os.path.dirname(__file__)
-
-    def _relevant_text(self, log):
-        soup = BeautifulSoup.BeautifulSoup(log)
-        # The Output Window table is where the useful output starts in the build log.
-        output_window_table = soup.find(text=re.compile("Output Window")).findParent("table")
-        result = []
-        for table in [output_window_table] + output_window_table.findNextSiblings("table"):
-            result.extend([text.replace("&nbsp;", "") for text in table.findAll(text=True)])
-            result.append("\n")
-        return "".join(result)
-
-    def main(self):
-        build_log_paths = self._sort_buildlogs(self._find_buildlogs(self._obj_directory()))
-
-        print "Found %s Visual Studio Express Build Logs:\n%s" % (len(build_log_paths), "\n".join(build_log_paths))
-
-        for build_log_path in build_log_paths:
-            print "%s:\n" % build_log_path
-            with codecs.open(build_log_path, "r", "utf-16") as build_log:
-                print self._relevant_text(build_log)
-
-
-if __name__ == '__main__':
-    PrintVisualStudioExpressLogs().main()