Title: [131445] trunk
Revision
131445
Author
[email protected]
Date
2012-10-16 05:48:32 -0700 (Tue, 16 Oct 2012)

Log Message

[Qt] Add logic for triggering clean builds on changes to build system files

Patch by Simon Hausmann  <[email protected]>, Tor Arne Vestbø <[email protected]> on 2012-10-16
Reviewed by Csaba Osztrogonác.

.:

Add a line here that can be re-used for recording dummy commits to count how the clean-build-needed
logic failed.

* WebKit.pro:

Tools:

Re-use the existing logic that gives us a range between old and new SVN revision and
parse the summarized output of diff to see if any of the changed files include files
that are part of the Qt build system. If they change we likely need a clean build and
trigger it just to be on the safe side and reduce the amount of manual intervention
needed on the Qt build bots.

* Scripts/VCSUtils.pm:
* Scripts/webkitdirs.pm:
(buildQMakeProjects):

Modified Paths

Diff

Modified: trunk/ChangeLog (131444 => 131445)


--- trunk/ChangeLog	2012-10-16 12:30:46 UTC (rev 131444)
+++ trunk/ChangeLog	2012-10-16 12:48:32 UTC (rev 131445)
@@ -1,3 +1,14 @@
+2012-10-16  Simon Hausmann  <[email protected]>, Tor Arne Vestbø <[email protected]>
+
+        [Qt] Add logic for triggering clean builds on changes to build system files
+
+        Reviewed by Csaba Osztrogonác.
+
+        Add a line here that can be re-used for recording dummy commits to count how the clean-build-needed
+        logic failed.
+
+        * WebKit.pro:
+
 2012-10-16  Simon Hausmann  <[email protected]>
 
         Unreviewed, rolling out r131436.

Modified: trunk/Tools/ChangeLog (131444 => 131445)


--- trunk/Tools/ChangeLog	2012-10-16 12:30:46 UTC (rev 131444)
+++ trunk/Tools/ChangeLog	2012-10-16 12:48:32 UTC (rev 131445)
@@ -1,3 +1,19 @@
+2012-10-16  Simon Hausmann  <[email protected]>, Tor Arne Vestbø <[email protected]>
+
+        [Qt] Add logic for triggering clean builds on changes to build system files
+
+        Reviewed by Csaba Osztrogonác.
+
+        Re-use the existing logic that gives us a range between old and new SVN revision and
+        parse the summarized output of diff to see if any of the changed files include files
+        that are part of the Qt build system. If they change we likely need a clean build and
+        trigger it just to be on the safe side and reduce the amount of manual intervention
+        needed on the Qt build bots.
+
+        * Scripts/VCSUtils.pm:
+        * Scripts/webkitdirs.pm:
+        (buildQMakeProjects):
+
 2012-10-16  Allan Sandfeld Jensen  <[email protected]>
 
         Fix the paths for QtGraphics related WebKit2 files.

Modified: trunk/Tools/Scripts/VCSUtils.pm (131444 => 131445)


--- trunk/Tools/Scripts/VCSUtils.pm	2012-10-16 12:30:46 UTC (rev 131444)
+++ trunk/Tools/Scripts/VCSUtils.pm	2012-10-16 12:48:32 UTC (rev 131445)
@@ -87,6 +87,8 @@
         &svnRevisionForDirectory
         &svnStatus
         &toWindowsLineEndings
+        &gitCommitForSVNRevision
+        &listOfChangedFilesBetweenRevisions
     );
     %EXPORT_TAGS = ( );
     @EXPORT_OK   = ();
@@ -2088,4 +2090,41 @@
     exec { $args[0] } @args or die "Failed to exec(): $!";
 }
 
+sub gitCommitForSVNRevision
+{
+    my ($svnRevision) = @_;
+    my $command = "git svn find-rev r" . $svnRevision;
+    $command = "LC_ALL=C $command" if !isWindows();
+    my $gitHash = `$command`;
+    if (!defined($gitHash)) {
+        $gitHash = "unknown";
+        warn "Unable to determine GIT commit from SVN revision";
+    } else {
+        chop($gitHash);
+    }
+    return $gitHash;
+}
+
+sub listOfChangedFilesBetweenRevisions
+{
+    my ($firstRevision, $lastRevision) = @_;
+    my $command;
+
+    if ($firstRevision eq "unknown" or $lastRevision eq "unknown") {
+        return ();
+    }
+
+    if (isGit()) {
+        my $firstCommit = gitCommitForSVNRevision($firstRevision);
+        my $lastCommit = gitCommitForSVNRevision($lastRevision);
+        $command = "git diff --name-status $firstCommit..$lastCommit";
+    } elsif (isSVN()) {
+        $command = "svn diff --summarize -r $firstRevision:$lastRevision";
+    }
+    my $diffOutput = `$command`;
+    $diffOutput =~ s/^[A-Z]\s+//gm;
+    return split(/[\r\n]+/, $diffOutput)
+}
+
+
 1;

Modified: trunk/Tools/Scripts/webkitdirs.pm (131444 => 131445)


--- trunk/Tools/Scripts/webkitdirs.pm	2012-10-16 12:30:46 UTC (rev 131444)
+++ trunk/Tools/Scripts/webkitdirs.pm	2012-10-16 12:48:32 UTC (rev 131445)
@@ -2318,14 +2318,34 @@
        die "\nFailed to set up build environment using $qmakebin!\n";
     }
 
-    if ($configChanged) {
+    my $needsCleanBuild = 0;
+    my $needsIncrementalBuild = 0;
+
+    if ($svnRevision ne $previousSvnRevision) {
+        print "Last built revision was " . $previousSvnRevision .
+            ", now at revision $svnRevision. Full incremental build needed.\n";
+        $needsIncrementalBuild = 1;
+
+        my @fileList = listOfChangedFilesBetweenRevisions($previousSvnRevision, $svnRevision);
+
+        foreach (@fileList) {
+            if (m/\.pr[oif]$/ or
+                m/\.qmake.conf$/ or
+                m/^Tools\/qmake\//
+               ) {
+                print "Change to $_ detected, clean build needed.\n";
+                $needsCleanBuild = 1;
+                last;
+            }
+        }
+    }
+
+    if ($configChanged or $needsCleanBuild) {
         print "Calling '$command wipeclean' in " . $dir . "\n\n";
         $result = system "$command wipeclean";
     }
 
-    if ($svnRevision ne $previousSvnRevision) {
-        print "Last built revision was " . $previousSvnRevision .
-            ", now at revision $svnRevision. Full incremental build needed.\n";
+    if ($needsIncrementalBuild) {
         $command .= " incremental";
     }
 

Modified: trunk/WebKit.pro (131444 => 131445)


--- trunk/WebKit.pro	2012-10-16 12:30:46 UTC (rev 131444)
+++ trunk/WebKit.pro	2012-10-16 12:48:32 UTC (rev 131445)
@@ -47,3 +47,5 @@
 Tools.file = Tools/Tools.pro
 Tools.makefile = Makefile.Tools
 SUBDIRS += Tools
+
+# Number of times incremental builds have failed: 0
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to