[Qt] Make build-webkit always do safe incremental builds after update-webkit
authorvestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 11:00:43 +0000 (11:00 +0000)
committervestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 11:00:43 +0000 (11:00 +0000)
When building against Qt5 with GCC we would just run 'make' in the build dir,
and rely on the dependency files output by GCC (-MD) to handle dependency
tracking, but that fails for special-cases like adding a Q_OBJECT macro
to a header.

To guarantee that an incrmental build will work, we have to run 'make qmake',
which we now do on every build-webkit that's followed by a successful run
of update-webkit. The reasoning is that update-webkit can result in such
potential corner-cases being applied, and since we can't know for sure
unless we inspect the diff and account for all the corner cases we assume
the worst and always run 'make qmake'.

After a succesful run of build-webkit we proceed to do just 'make' for any
subsequent runs, since we assume that the developer knows what kind of
changes he/she is doing, and when a 'make qmake' is needed.

Reviewed by Simon Hausmann.

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

.gitignore
ChangeLog
Tools/ChangeLog
Tools/Scripts/update-webkit
Tools/Scripts/webkitdirs.pm
Tools/qmake/mkspecs/features/default_post.prf

index 5d54134..363ffaf 100644 (file)
@@ -183,3 +183,4 @@ LayoutTests/java/*.class
 
 # Ignore files generated by the Qt build-system:
 Source/qtwebkitversion.h
+Tools/qmake/.build-hint
index 172345c..c611db9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2012-01-19  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Make build-webkit always do safe incremental builds after update-webkit
+
+        When building against Qt5 with GCC we would just run 'make' in the build dir,
+        and rely on the dependency files output by GCC (-MD) to handle dependency
+        tracking, but that fails for special-cases like adding a Q_OBJECT macro
+        to a header.
+
+        To guarantee that an incrmental build will work, we have to run 'make qmake',
+        which we now do on every build-webkit that's followed by a successful run
+        of update-webkit. The reasoning is that update-webkit can result in such
+        potential corner-cases being applied, and since we can't know for sure
+        unless we inspect the diff and account for all the corner cases we assume
+        the worst and always run 'make qmake'.
+
+        After a succesful run of build-webkit we proceed to do just 'make' for any
+        subsequent runs, since we assume that the developer knows what kind of
+        changes he/she is doing, and when a 'make qmake' is needed.
+
+        Reviewed by Simon Hausmann.
+
+        * .gitignore:
+
 2012-01-18  Dirk Pranke  <dpranke@chromium.org>
 
         [chromium] move Tools.gyp, switch build-webkit --chromium to All.gyp
index dbf398e..7b4390b 100644 (file)
@@ -1,3 +1,32 @@
+2012-01-19  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Make build-webkit always do safe incremental builds after update-webkit
+
+        When building against Qt5 with GCC we would just run 'make' in the build dir,
+        and rely on the dependency files output by GCC (-MD) to handle dependency
+        tracking, but that fails for special-cases like adding a Q_OBJECT macro
+        to a header.
+
+        To guarantee that an incrmental build will work, we have to run 'make qmake',
+        which we now do on every build-webkit that's followed by a successful run
+        of update-webkit. The reasoning is that update-webkit can result in such
+        potential corner-cases being applied, and since we can't know for sure
+        unless we inspect the diff and account for all the corner cases we assume
+        the worst and always run 'make qmake'.
+
+        After a succesful run of build-webkit we proceed to do just 'make' for any
+        subsequent runs, since we assume that the developer knows what kind of
+        changes he/she is doing, and when a 'make qmake' is needed.
+
+        Reviewed by Simon Hausmann.
+
+        * Scripts/update-webkit:
+        * Scripts/webkitdirs.pm:
+        (determineCurrentSVNRevision):
+        (currentSVNRevision):
+        (buildQMakeProjects):
+        * qmake/mkspecs/features/default_post.prf:
+
 2012-01-18  Ryosuke Niwa  <rniwa@webkit.org>
 
         run-perf-tests should support Skipped list
index fb9f798..b529feb 100755 (executable)
@@ -51,7 +51,7 @@ my $useMake = 0;
 
 determineIsChromium();
 determineIsChromiumAndroid();
-
+determineIsQt();
 determineIsWinCairo();
 
 chdirWebKit();
@@ -83,6 +83,8 @@ if ($useMake) {
 
 my $startTime = time();
 
+my $initialRevision = currentSVNRevision();
+
 my @svnOptions = ();
 push @svnOptions, '-q' if $quiet;
 
@@ -93,6 +95,9 @@ print "Updating OpenSource\n" unless $quiet;
 runSvnUpdate() if isSVN();
 runGitUpdate() if isGit();
 
+# The update might have given us a new revision
+determineCurrentSVNRevision();
+
 if (-d "../Internal") {
     chdir("../Internal");
     print "Updating Internal\n" unless $quiet;
@@ -116,6 +121,13 @@ if (-d "../Internal") {
         # WinCairo shares the auxiliary libs from the Apple port.
         system("perl", "Tools/Scripts/update-webkit-wincairo-libs") == 0 or die;
     }
+} elsif (isQt()) {
+    if (currentSVNRevision() ne $initialRevision) {
+        my $hintFile = File::Spec->catfile(sourceDir(), "Tools", "qmake", ".build-hint");
+        open(HINTFILE, ">$hintFile") || die("Could not open $hintFile for writing!\n");
+        print HINTFILE "incremental\n";
+        close(HINTFILE);
+    }
 }
 
 setupAppleWinEnv() if isAppleWinWebKit();
index a8a1a8f..dc8700d 100755 (executable)
@@ -416,7 +416,9 @@ sub setConfigurationProductDir($)
 
 sub determineCurrentSVNRevision
 {
-    return if defined $currentSVNRevision;
+    # We always update the current SVN revision here, and leave the caching
+    # to currentSVNRevision(), so that changes to the SVN revision while the
+    # script is running can be picked up by calling this function again.
     determineSourceDir();
     $currentSVNRevision = svnRevisionForDirectory($sourceDir);
     return $currentSVNRevision;
@@ -470,7 +472,7 @@ sub configurationForVisualStudio()
 
 sub currentSVNRevision
 {
-    determineCurrentSVNRevision();
+    determineCurrentSVNRevision() if not defined $currentSVNRevision;
     return $currentSVNRevision;
 }
 
@@ -2068,6 +2070,13 @@ sub buildQMakeProjects
 
     my %defines = qtFeatureDefaults(\@buildArgs);
 
+    my $pathToBuildHint = File::Spec->catfile(sourceDir(), "Tools", "qmake", ".build-hint");
+    my $buildHint = "";
+    if (-e $pathToBuildHint && open(BUILDHINT, $pathToBuildHint)) {
+        chomp($buildHint = <BUILDHINT>);
+        close(BUILDHINT);
+    }
+
     my $needsCleanBuild = 0;
 
     my $pathToDefinesCache = File::Spec->catfile($dir, ".webkit.config");
@@ -2153,7 +2162,7 @@ sub buildQMakeProjects
 
     if ($clean) {
         $command = "$command distclean";
-    } else {
+    } elsif ($buildHint =~ /^incremental$/) {
         $command = "$command incremental";
     }
 
@@ -2161,6 +2170,9 @@ sub buildQMakeProjects
     $result = system $command;
 
     chdir ".." or die;
+
+    unlink($pathToBuildHint) || die "Could not delete $pathToBuildHint: $!" if $result eq 0;
+
     return $result;
 }
 
index 88c2c86..b63709e 100644 (file)
@@ -256,8 +256,7 @@ contains(TEMPLATE, subdirs):!no_recursive_qmake {
 }
 
 incremental.target = incremental
-!CONFIG(GNUmake): incremental.commands += $(MAKE) -f $(MAKEFILE) qmake &&
-incremental.commands += $(MAKE) -f $(MAKEFILE)
+incremental.commands = $(MAKE) -f $(MAKEFILE) qmake && $(MAKE) -f $(MAKEFILE)
 QMAKE_EXTRA_TARGETS += incremental
 
 # Don't set OBJECTS_DIR for subdirs, as that will unconditionally