[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

mrowe at apple.com mrowe at apple.com
Thu Apr 8 02:10:39 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 1eedb5d0d403bd283d1ca0b64e137121d96e9157
Author: mrowe at apple.com <mrowe at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 5 00:23:40 2010 +0000

    Add a script to verify that WebKit framework headers are internally consistent.
    
    Reviewed by Sam Weinig.
    
    WebKit:
    
    * WebKit.xcodeproj/project.pbxproj: Run the script during the build and fail with
    an error should the consistency check fail.
    
    WebKitTools:
    
    This script detects the following problematic situations:
    * An exported WebKit header that includes a header from WebCore.
    * An exported WebKit header that includes a header that does not exist in the WebKit framework.
    * A public WebKit header that includes a private WebKit header.
    
    * Scripts/check-for-webkit-framework-include-consistency: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55561 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 66a30de..efdbe8b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-04  Mark Rowe  <mrowe at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Add a script to verify that WebKit framework headers are internally consistent.
+
+        * WebKit.xcodeproj/project.pbxproj: Run the script during the build and fail with
+        an error should the consistency check fail.
+
 2010-02-25  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Geoffrey Garen.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index f78f7a7..cacfb90 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -1574,6 +1574,7 @@
 				939D054F09DA02D500984996 /* Check For Global Initializers */,
 				9337D6540EBFE54D00DA3CB5 /* Check For Exit Time Destructors */,
 				5D0D54210E98631D0029E223 /* Check For Weak VTables and Externals */,
+				5D88EE6C11407DE800BC3ABC /* Check For Framework Include Consistency */,
 				5DE6D18C0FCF231B002DE28C /* Symlink WebKitPluginHost in to place */,
 			);
 			buildRules = (
@@ -1692,6 +1693,20 @@
 			shellPath = /bin/sh;
 			shellScript = "# Touch Info.plist to let Xcode know it needs to copy it into the built product\nif [[ \"${CONFIGURATION}\" != \"Production\" ]]; then\n    touch \"${PROJECT_DIR}/mac/Info.plist\";\nfi;\n";
 		};
+		5D88EE6C11407DE800BC3ABC /* Check For Framework Include Consistency */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			name = "Check For Framework Include Consistency";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n    exit 0;\nfi\n\nif [ -f ../WebKitTools/Scripts/check-for-webkit-framework-include-consistency ]; then\n    ../WebKitTools/Scripts/check-for-webkit-framework-include-consistency || exit $?\nfi\n";
+		};
 		5DE6D18C0FCF231B002DE28C /* Symlink WebKitPluginHost in to place */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index e9a1782..7b89c54 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-04  Mark Rowe  <mrowe at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Add a script to verify that WebKit framework headers are internally consistent.
+
+        This script detects the following problematic situations:
+        * An exported WebKit header that includes a header from WebCore.
+        * An exported WebKit header that includes a header that does not exist in the WebKit framework.
+        * A public WebKit header that includes a private WebKit header.
+
+        * Scripts/check-for-webkit-framework-include-consistency: Added.
+
 2010-03-04  Dumitru Daniliuc  <dumi at chromium.org>
 
         Reviewed by Adam Roben.
diff --git a/WebKitTools/Scripts/check-for-webkit-framework-include-consistency b/WebKitTools/Scripts/check-for-webkit-framework-include-consistency
new file mode 100755
index 0000000..592d83f
--- /dev/null
+++ b/WebKitTools/Scripts/check-for-webkit-framework-include-consistency
@@ -0,0 +1,109 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) 2010 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. AND ITS 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 APPLE INC. OR ITS 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.
+
+
+base_directory = ENV['CONFIGURATION_BUILD_DIR']
+
+unless base_directory
+  throw "Unable to find CONFIGURATION_BUILD_DIR in the environment!"
+end
+
+Dir.chdir base_directory
+
+$PERMITTED_INCLUDE_TYPES = { :public => [ :public ], :private => [ :public, :private ] }
+
+$HEADER_NAMES_TO_TYPE = { }
+$HEADERS_BY_TYPE = { :public => [], :private => [] }
+
+$error_printed = false
+
+def print_error msg
+  $error_printed = true
+  STDERR.puts "ERROR: #{msg}"
+end
+
+def build_header_maps
+  all_headers = `find WebKit.framework/Versions/A/{,Private}Headers -type f -name '*.h'`.split
+
+  all_headers.each do |header|
+    if /\/Headers\/(.*)/.match(header)
+      $HEADER_NAMES_TO_TYPE[$1] = :public
+      $HEADERS_BY_TYPE[:public] << header
+    elsif /\/PrivateHeaders\/(.*)/.match(header)
+      $HEADER_NAMES_TO_TYPE[$1] = :private
+      $HEADERS_BY_TYPE[:private] << header
+    else
+      print_error "Unknown header type: #{header}"
+    end
+  end
+end
+
+def resolve_include(header, included_header, permitted_types)
+  # Ignore includes that aren't in the typical framework style.
+  return unless /<([^\/]+)\/(.*)>/.match(included_header)
+
+  framework, included_header_name = [$1, $2]
+
+  # Ignore includes that aren't related to other WebKit headers.
+  return unless framework.start_with?('Web')
+
+  # A header of any type including a WebCore header is a recipe for disaster.
+  if framework == "WebCore"
+    # <rdar://problem/7718826> WebKeyGenerator.h should not include a WebCore header
+    return if header =~ /\/WebKeyGenerator.h$/ and included_header_name == "WebCoreKeyGenerator.h"
+
+    print_error "#{header} included #{included_header}!"
+    return
+  end
+
+  header_type = $HEADER_NAMES_TO_TYPE[included_header_name]
+
+  if not header_type
+    print_error "#{header} included #{included_header} but I could not find a header of that name!"
+  elsif not permitted_types.member?(header_type)
+    print_error "#{header} included #{included_header} which is #{header_type}!"
+  end
+end
+
+def verify_includes(header, permitted_types)
+  File.open(header) do |file|
+    file.each_line do |line|
+      if /#(include|import) (.*)/.match(line)
+        resolve_include(header, $2, permitted_types)
+      end
+    end
+  end
+end
+
+build_header_maps
+
+$HEADERS_BY_TYPE.each do |header_type, headers|
+  permitted_types = $PERMITTED_INCLUDE_TYPES[header_type]
+  headers.each do |header|
+    verify_includes header, permitted_types
+  end
+end
+
+exit 1 if $error_printed

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list