[Win] Switch to MSBuild so we get more useful stdout logging in buildbot
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Mar 2015 20:05:20 +0000 (20:05 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Mar 2015 20:05:20 +0000 (20:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140845

Reviewed by David Kilzer.

Update 'webkitdirs.pm' to locate the MSBuild used with Visual Studio 2013
and generate suitable build commands to drive a full build from our
existing solution files.

* Scripts/webkitdirs.pm:
(msBuildInstallDir): Added.
(determineConfigurationForVisualStudio): Revise to use MSBuild command
line arguments to drive the build.
(setupCygwinEnv): Warn user if MSBuild cannot be located.
(buildVisualStudioProject): Revise to use MSBuild command line arguments
to specify build architecture.
* win/AssembleBuildLogs/AssembleLogs.cmd: MSBuild doesn't produce individual
output logs, so don't attempt to consolidate them. Also: Drive-by fix: Don't
bother looking for CoreUI or SafariTheme build logs.

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

Tools/ChangeLog
Tools/Scripts/webkitdirs.pm
Tools/win/AssembleBuildLogs/AssembleLogs.cmd

index e07b394..204fd2a 100644 (file)
@@ -1,3 +1,25 @@
+2015-03-05  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Switch to MSBuild so we get more useful stdout logging in buildbot
+        https://bugs.webkit.org/show_bug.cgi?id=140845
+
+        Reviewed by David Kilzer.
+
+        Update 'webkitdirs.pm' to locate the MSBuild used with Visual Studio 2013
+        and generate suitable build commands to drive a full build from our
+        existing solution files.
+
+        * Scripts/webkitdirs.pm:
+        (msBuildInstallDir): Added.
+        (determineConfigurationForVisualStudio): Revise to use MSBuild command
+        line arguments to drive the build.
+        (setupCygwinEnv): Warn user if MSBuild cannot be located.
+        (buildVisualStudioProject): Revise to use MSBuild command line arguments
+        to specify build architecture.
+        * win/AssembleBuildLogs/AssembleLogs.cmd: MSBuild doesn't produce individual
+        output logs, so don't attempt to consolidate them. Also: Drive-by fix: Don't
+        bother looking for CoreUI or SafariTheme build logs.
+
 2015-03-05  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         [buildbot] mastercfg_unittest.py should be runnable easily
index c773b04..dfc59cf 100755 (executable)
@@ -125,6 +125,7 @@ my $xcodeVersion;
 my $programFilesPath;
 my $vcBuildPath;
 my $vsInstallDir;
+my $msBuildInstallDir;
 my $vsVersion;
 my $windowsSourceDir;
 my $winVersion;
@@ -515,6 +516,16 @@ sub visualStudioInstallDir
     return $vsInstallDir;
 }
 
+sub msBuildInstallDir
+{
+    return $msBuildInstallDir if defined $msBuildInstallDir;
+
+    $msBuildInstallDir = File::Spec->catdir(programFilesPath(), "MSBuild", "12.0", "Bin");
+    chomp($msBuildInstallDir = `cygpath "$msBuildInstallDir"`) if isCygwin();
+
+    return $msBuildInstallDir;
+}
+
 sub visualStudioVersion
 {
     return $vsVersion if defined $vsVersion;
@@ -531,7 +542,7 @@ sub determineConfigurationForVisualStudio
     return if defined $configurationForVisualStudio;
     determineConfiguration();
     # FIXME: We should detect when Debug_All or Production has been chosen.
-    $configurationForVisualStudio = $configuration . (isWin64() ? "|x64" : "|Win32");
+    $configurationForVisualStudio = "/p:Configuration=" . $configuration;
 }
 
 sub usesPerConfigurationBuildDirectory
@@ -1564,18 +1575,18 @@ sub setupCygwinEnv()
     return if $vcBuildPath;
 
     my $programFilesPath = programFilesPath();
-    $vcBuildPath = File::Spec->catfile(visualStudioInstallDir(), qw(Common7 IDE devenv.com));
-    if (-e $vcBuildPath) {
+    my $visualStudioPath = File::Spec->catfile(visualStudioInstallDir(), qw(Common7 IDE devenv.com));
+    if (-e $visualStudioPath) {
         # Visual Studio is installed;
         if (visualStudioVersion() eq "12") {
-            $vcBuildPath = File::Spec->catfile(visualStudioInstallDir(), qw(Common7 IDE devenv.exe));
+            $visualStudioPath = File::Spec->catfile(visualStudioInstallDir(), qw(Common7 IDE devenv.exe));
         }
     } else {
         # Visual Studio not found, try VC++ Express
-        $vcBuildPath = File::Spec->catfile(visualStudioInstallDir(), qw(Common7 IDE WDExpress.exe));
-        if (! -e $vcBuildPath) {
+        $visualStudioPath = File::Spec->catfile(visualStudioInstallDir(), qw(Common7 IDE WDExpress.exe));
+        if (! -e $visualStudioPath) {
             print "*************************************************************\n";
-            print "Cannot find '$vcBuildPath'\n";
+            print "Cannot find '$visualStudioPath'\n";
             print "Please execute the file 'vcvars32.bat' from\n";
             print "'$programFilesPath\\Microsoft Visual Studio 12.0\\VC\\bin\\'\n";
             print "to setup the necessary environment variables.\n";
@@ -1590,6 +1601,18 @@ sub setupCygwinEnv()
     print "WEBKIT_LIBRARIES is set to: ", $ENV{"WEBKIT_LIBRARIES"}, "\n";
     # FIXME (125180): Remove the following temporary 64-bit support once official support is available.
     print "WEBKIT_64_SUPPORT is set to: ", $ENV{"WEBKIT_64_SUPPORT"}, "\n" if isWin64();
+
+    # We will actually use MSBuild to build WebKit, but we need to find the Visual Studio install (above) to make
+    # sure we use the right options.
+    $vcBuildPath = File::Spec->catfile(msBuildInstallDir(), qw(MSBuild.exe));
+    if (! -e $vcBuildPath) {
+        print "*************************************************************\n";
+        print "Cannot find '$vcBuildPath'\n";
+        print "Please make sure execute that the Microsoft .NET Framework SDK\n";
+        print "is installed on this machine.\n";
+        print "*************************************************************\n";
+        die;
+    }
 }
 
 sub dieIfWindowsPlatformSDKNotInstalled
@@ -1655,12 +1678,17 @@ sub buildVisualStudioProject
 
     chomp($project = `cygpath -w "$project"`) if isCygwin();
 
-    my $action = "/build";
+    my $action = "/t:build";
     if ($clean) {
-        $action = "/clean";
+        $action = "/t:clean";
     }
 
-    my @command = ($vcBuildPath, $project, $action, $config);
+    my $platform = "/p:Platform=" . (isWin64() ? "x64" : "Win32");
+    my $logFile = File::Spec->catdir($baseProductDir, $configuration, "BuildOutput.htm");
+    chomp($logFile = `cygpath -w "$logFile"`) if isCygwin();
+    my $logging = "/flp:LogFile=" . $logFile . ";Verbosity=minimal";
+    
+    my @command = ($vcBuildPath, "/verbosity:minimal", $project, $action, $config, $platform, "/fl", $logging);
 
     print join(" ", @command), "\n";
     return system @command;
index 8ee693c..6b6e2af 100755 (executable)
@@ -34,6 +34,8 @@ type "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\libEGL\BuildLog.htm"
 
 :SkipANGLEProjects
 
+if not exist "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\WTF\BuildLog.htm" GOTO SkipIndividualBuilds
+
 echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
 echo COMPILING WTF...                                          >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
 echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
@@ -116,16 +118,6 @@ echo COMPILING WebKitQuartzCoreAdditions...                    >> "%CONFIGURATIO
 echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
 type "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\WebKitQuartzCoreAdditions\BuildLog.htm" >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
 
-echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-echo COMPILING CoreUI...                                       >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-type "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\CoreUI\BuildLog.htm"       >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-
-echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-echo COMPILING SafariTheme...                                  >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-type "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\SafariTheme\BuildLog.htm"  >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-
 :SkipInternalProjects
 
 echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
@@ -211,4 +203,7 @@ type "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\gtest-md\BuildLog.htm" >
 echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
 echo COMPILING TestWebKitAPI...                                >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
 echo _________________________________________________________ >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
-type "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\TestWebKitAPI\BuildLog.htm" >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
\ No newline at end of file
+type "%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\TestWebKitAPI\BuildLog.htm" >> "%CONFIGURATIONBUILDDIR%\BuildOutput.htm"
+
+:SkipIndividualBuilds
+echo "No individual build logs to address"
\ No newline at end of file