Title: [286080] trunk/Source/WebKit
Revision
286080
Author
cdu...@apple.com
Date
2021-11-19 14:38:00 -0800 (Fri, 19 Nov 2021)

Log Message

Revert r282446 to bring back support for WebKitAdditions in Framework headers
https://bugs.webkit.org/show_bug.cgi?id=233374

Reviewed by Wenson Hsieh.

* WebKit.xcodeproj/project.pbxproj:
* mac/replace-webkit-additions-includes.py: Added.
(read_content_from_webkit_additions):
(main):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286079 => 286080)


--- trunk/Source/WebKit/ChangeLog	2021-11-19 22:20:47 UTC (rev 286079)
+++ trunk/Source/WebKit/ChangeLog	2021-11-19 22:38:00 UTC (rev 286080)
@@ -1,3 +1,15 @@
+2021-11-19  Chris Dumez  <cdu...@apple.com>
+
+        Revert r282446 to bring back support for WebKitAdditions in Framework headers
+        https://bugs.webkit.org/show_bug.cgi?id=233374
+
+        Reviewed by Wenson Hsieh.
+
+        * WebKit.xcodeproj/project.pbxproj:
+        * mac/replace-webkit-additions-includes.py: Added.
+        (read_content_from_webkit_additions):
+        (main):
+
 2021-11-19  J Pascoe  <j_pas...@apple.com>
 
         [WebAuthn] Add headers for [_WKWebAuthenticationPanel makeCredentialWithClientDataHash] and [_WKWebAuthenticationPanel getAssertionWithClientDataHash]

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (286079 => 286080)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-11-19 22:20:47 UTC (rev 286079)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-11-19 22:38:00 UTC (rev 286080)
@@ -13802,6 +13802,7 @@
 				1A6280C81919956B006AD9F9 /* Migrate WebKitLegacy Headers */,
 				375A248817E5048E00C9A086 /* Postprocess WKBase.h */,
 				1AD98ECF191D867300CAA6DF /* Postprocess WKFoundation.h */,
+				F4EFBAD522540CBB00049BA6 /* Replace WebKitAdditions in Framework Headers */,
 				1A1D2115191D96380001619F /* Postprocess Framework Headers */,
 				2E16B6F42019BC25008996D6 /* Copy Additional Resources */,
 				8DC2EF520486A6940098B216 /* Resources */,
@@ -14674,6 +14675,20 @@
 			shellPath = /bin/sh;
 			shellScript = "echo \"Preprocessing sandbox\"\nScripts/generate-derived-sources.sh sandbox-profiles-ios\ncp ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2/com.apple.WebKit.WebContent.sb ${DSTROOT}/${INSTALL_PATH}\n";
 		};
+		F4EFBAD522540CBB00049BA6 /* Replace WebKitAdditions in Framework Headers */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			name = "Replace WebKitAdditions in Framework Headers";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "if [ \"${XCODE_VERSION_ACTUAL}\" -ge \"1140\" -a \"${WK_USE_NEW_BUILD_SYSTEM}\" = \"YES\" ]; then\n    # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step.\n    exit 0\nfi\n\nif [ \"${ACTION}\" = \"analyze\" -o \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n    for HEADERS_DIRECTORY in \"${PUBLIC_HEADERS_FOLDER_PATH}\" \"${PRIVATE_HEADERS_FOLDER_PATH}\"; do\n        for HEADER_PATH in \"${TARGET_BUILD_DIR}/${HEADERS_DIRECTORY}/\"*.*; do\n            if [[ ! -z `grep '#import <WebKitAdditions/.*>' \"${HEADER_PATH}\"` ]]; then\n                python \"${SRCROOT}/mac/replace-webk
 it-additions-includes.py\" \"${HEADER_PATH}\" \"${BUILT_PRODUCTS_DIR}\" \"${SDKROOT}\" || exit $?\n            fi\n        done\n    done\nfi\n\n\n";
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */

Added: trunk/Source/WebKit/mac/replace-webkit-additions-includes.py (0 => 286080)


--- trunk/Source/WebKit/mac/replace-webkit-additions-includes.py	                        (rev 0)
+++ trunk/Source/WebKit/mac/replace-webkit-additions-includes.py	2021-11-19 22:38:00 UTC (rev 286080)
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 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.
+#
+
+import os
+import re
+import sys
+
+
+def read_content_from_webkit_additions(built_products_directory, sdk_root_directory, filename):
+    additions_path = os.path.join("usr/local/include/WebKitAdditions", filename)
+    try:
+        file_in_build_directory = open(os.path.join(built_products_directory, additions_path), "r")
+        return file_in_build_directory.read()
+    except Exception as ex:
+        try:
+            file_in_sdk_root = open(os.path.join(sdk_root_directory, additions_path), "r")
+            return file_in_sdk_root.read()
+        except Exception as ex:
+            return ""
+
+
+def main(argv=None):
+    if not argv:
+        argv = sys.argv
+
+    if len(argv) != 4:
+        print("Usage: replace-webkit-additions-includes.py <header_path> <built_products_directory> <sdk_root_directory>")
+        return 1
+
+    header_path = argv[1]
+    built_products_directory = argv[2]
+    sdk_root_directory = argv[3]
+    if not len(header_path):
+        print("(%s): header path unspecified" % argv[0])
+        return 1
+
+    if not len(built_products_directory):
+        print("(%s): built products directory unspecified" % argv[0])
+        return 1
+
+    if not len(sdk_root_directory):
+        print("(%s): SDK root directory unspecified" % argv[0])
+        return 1
+
+    additions_import_pattern = re.compile(r"\#if USE\(APPLE_INTERNAL_SDK\)\n#import <WebKitAdditions/(.*)>\n#endif")
+    try:
+        with open(header_path, "r") as header:
+            header_contents = header.read()
+            match = additions_import_pattern.search(header_contents)
+            while match:
+                header_contents = header_contents[:match.start()] + read_content_from_webkit_additions(built_products_directory, sdk_root_directory, match.groups()[0]) + header_contents[match.end():]
+                match = additions_import_pattern.search(header_contents)
+            try:
+                with open(header_path, "w") as header:
+                    header.write(header_contents)
+            except Exception as ex:
+                print("(%s): failed to write to file: %s" % (argv[0], header_path))
+                return 1
+        return 0
+    except Exception as ex:
+        print("(%s): failed to read file: %s" % (argv[0], header_path))
+        return 1
+
+
+if __name__ == "__main__":
+    sys.exit(main(sys.argv))
Property changes on: trunk/Source/WebKit/mac/replace-webkit-additions-includes.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to