From 736c89b39e4a23d869d5edcbff96c81cac78ff45 Mon Sep 17 00:00:00 2001 From: "vestbo@webkit.org" Date: Thu, 19 Jan 2012 11:00:43 +0000 Subject: [PATCH] [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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105398 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- .gitignore | 1 + ChangeLog | 24 ++++++++++++++++++++++ Tools/ChangeLog | 29 +++++++++++++++++++++++++++ Tools/Scripts/update-webkit | 14 ++++++++++++- Tools/Scripts/webkitdirs.pm | 18 ++++++++++++++--- Tools/qmake/mkspecs/features/default_post.prf | 3 +-- 6 files changed, 83 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5d54134..363ffaf 100644 --- a/.gitignore +++ b/.gitignore @@ -183,3 +183,4 @@ LayoutTests/java/*.class # Ignore files generated by the Qt build-system: Source/qtwebkitversion.h +Tools/qmake/.build-hint diff --git a/ChangeLog b/ChangeLog index 172345c..c611db9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2012-01-19 Tor Arne Vestbø + + [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 [chromium] move Tools.gyp, switch build-webkit --chromium to All.gyp diff --git a/Tools/ChangeLog b/Tools/ChangeLog index dbf398e..7b4390b 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,32 @@ +2012-01-19 Tor Arne Vestbø + + [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 run-perf-tests should support Skipped list diff --git a/Tools/Scripts/update-webkit b/Tools/Scripts/update-webkit index fb9f798..b529feb 100755 --- a/Tools/Scripts/update-webkit +++ b/Tools/Scripts/update-webkit @@ -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(); diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm index a8a1a8f..dc8700d 100755 --- a/Tools/Scripts/webkitdirs.pm +++ b/Tools/Scripts/webkitdirs.pm @@ -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 = ); + 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; } diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index 88c2c86..b63709e 100644 --- a/Tools/qmake/mkspecs/features/default_post.prf +++ b/Tools/qmake/mkspecs/features/default_post.prf @@ -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 -- 2.7.4