Title: [295067] trunk/Source/WebKit
Revision
295067
Author
e...@apple.com
Date
2022-05-31 14:47:39 -0700 (Tue, 31 May 2022)

Log Message

[Xcode] Fix dependency cycles caused by Safari header imports
https://bugs.webkit.org/show_bug.cgi?id=240285

Reviewed by Tim Horton.

We were including headers produced by targets which depend on WebKit.
For Xcode engineering builds, this is not a valid dependency, because
an engineering build does not distinguish between a "header"
dependency and a regular target dependency. These errors have survived
in the codebase because:

- Xcode doesn't recognize header imports as "implicit dependencies",
so the build system hasn't traditionally known these dependencies
exist, except in some incremental builds.
- These headers are available in internal SDKs, so it's possible for
the targets to build out-of-order but build successfully (as long as
the first target to build can use a possibly-outdated version of the
code from the SDK).

When building targets in parallel, we are emitting more information to
recognize these as implicit dependencies (revealing the cycle) and the
build system is laying down framework bundle directories earlier on in
the build (preventing reliance on SDK frameworks).

* Source/WebKit/WebKit.xcodeproj/project.pbxproj: WebKit needs to build
  after AuthenticationServicesCore in internal builds. Add it as a
  product dependency.
* Source/WebKit/Configurations/WebKit.xcconfig: Because
  AuthenticationServicesCore.framework is not available externally, add
  it to EXCLUDED_SOURCE_FILE_NAMES. The build system still honors the
  product dependency ordering, but won't fail when it's missing.

* Source/WebKit/Platform/spi/ios/SafariServicesSPI.h: Added, contains
  interface declarations for needed SSReadingList API. Technically not
  SPI, but follows the convention of similar platform redeclaration
  headers.
* Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm: WebKit cannot
  depend on SafariServices. Replace the import of SSReadingList.h with
  SafariServicesSPI.h.
* Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
  WebKit cannot depend on AuthenticationServices.framework. Thankfully,
  this import was unused. Delete it.
* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm: WebKit cannot
  depend on SafariServices. Replace the import of SSReadingList.h with
  SafariServicesSPI.h.

Canonical link: https://commits.webkit.org/251162@main

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/Configurations/WebKit.xcconfig (295066 => 295067)


--- trunk/Source/WebKit/Configurations/WebKit.xcconfig	2022-05-31 21:22:49 UTC (rev 295066)
+++ trunk/Source/WebKit/Configurations/WebKit.xcconfig	2022-05-31 21:47:39 UTC (rev 295067)
@@ -190,7 +190,9 @@
 SECTORDER_FLAGS_Production[sdk=iphoneos*] = -Wl,-order_file,$(SDKROOT)/AppleInternal/OrderFiles/WebKit.order;
 SECTORDER_FLAGS_Production[sdk=macosx*] = -Wl,-order_file,mac/WebKit2.order;
 
-EXCLUDED_SOURCE_FILE_NAMES = libWebKitAdditions.a $(EXCLUDED_IOS_RESOURCE_FILE_NAMES) $(EXCLUDED_MACOS_PLUGIN_FILE_NAMES) $(EXCLUDED_SOURCE_FILE_NAMES_$(WK_WHICH_BUILD_SYSTEM)) $(EXCLUDED_MIGRATED_HEADERS_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
+EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_PRODUCT_DEPENDENCY_NAMES) $(EXCLUDED_IOS_RESOURCE_FILE_NAMES) $(EXCLUDED_MACOS_PLUGIN_FILE_NAMES) $(EXCLUDED_SOURCE_FILE_NAMES_$(WK_WHICH_BUILD_SYSTEM)) $(EXCLUDED_MIGRATED_HEADERS_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
+// These are only available in internal builds, so they must be explicitly ignored for the open-source build to succeed.
+EXCLUDED_PRODUCT_DEPENDENCY_NAMES = libWebKitAdditions.a AuthenticationServicesCore.framework;
 EXCLUDED_IOS_RESOURCE_FILE_NAMES = Resources/ios/*;
 EXCLUDED_IOS_RESOURCE_FILE_NAMES[sdk=iphone*] = ;
 // The legacy build system does not install headers.

Added: trunk/Source/WebKit/Platform/spi/ios/SafariServicesSPI.h (0 => 295067)


--- trunk/Source/WebKit/Platform/spi/ios/SafariServicesSPI.h	                        (rev 0)
+++ trunk/Source/WebKit/Platform/spi/ios/SafariServicesSPI.h	2022-05-31 21:47:39 UTC (rev 295067)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+// SSReadingList is API, not SPI, but we need to redeclare it. SafariServices depends on WebKit
+// headers, so a WebKit dependency on SafariServices headers forms a dependency cycle.
+@interface SSReadingList : NSObject
++ (SSReadingList *)defaultReadingList;
++ (BOOL)supportsURL:(NSURL *)URL;
+- (BOOL)addReadingListItemWithURL:(NSURL *)URL title:(NSString *)title previewText:(NSString *)previewText error:(NSError **)error;
+@end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm (295066 => 295067)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm	2022-05-31 21:22:49 UTC (rev 295066)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm	2022-05-31 21:47:39 UTC (rev 295067)
@@ -40,7 +40,7 @@
 #import <wtf/text/WTFString.h>
 
 #if HAVE(SAFARI_SERVICES_FRAMEWORK)
-#import <SafariServices/SSReadingList.h>
+#import "SafariServicesSPI.h"
 SOFT_LINK_FRAMEWORK(SafariServices);
 SOFT_LINK_CLASS(SafariServices, SSReadingList);
 #endif

Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (295066 => 295067)


--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2022-05-31 21:22:49 UTC (rev 295066)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2022-05-31 21:47:39 UTC (rev 295067)
@@ -57,7 +57,7 @@
 #endif
 
 #if HAVE(SAFARI_SERVICES_FRAMEWORK)
-#import <SafariServices/SSReadingList.h>
+#import "SafariServicesSPI.h"
 SOFT_LINK_FRAMEWORK(SafariServices)
 SOFT_LINK_CLASS(SafariServices, SSReadingList)
 #endif

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (295066 => 295067)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-05-31 21:22:49 UTC (rev 295066)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-05-31 21:47:39 UTC (rev 295067)
@@ -2216,7 +2216,9 @@
 		DDA0A41727E67039005E086E /* WebEventRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = DDA0A41627E67039005E086E /* WebEventRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		DDA0A41927E672A5005E086E /* WAKAppKitStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = DDA0A41827E672A5005E086E /* WAKAppKitStubs.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		DDA0A41E27E94644005E086E /* WebKitLegacy.h in Headers */ = {isa = PBXBuildFile; fileRef = DDA0A41D27E94644005E086E /* WebKitLegacy.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DDAB377628234B3900890546 /* AuthenticationServicesCore.framework in Product Dependencies */ = {isa = PBXBuildFile; fileRef = DDAB377528234B2100890546 /* AuthenticationServicesCore.framework */; };
 		DDB04F3F278E55F1008D3678 /* _javascript_Core.framework in Product Dependencies */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* _javascript_Core.framework */; };
+		DDDFE827284699EC006F1EE5 /* SafariServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = DDDFE826284699E6006F1EE5 /* SafariServicesSPI.h */; };
 		DDE992F6278D071F00F60D26 /* libWebKitAdditions.a in Product Dependencies */ = {isa = PBXBuildFile; fileRef = DDE992F4278D06D900F60D26 /* libWebKitAdditions.a */; };
 		DF0C5F28252ECB8E00D921DB /* WKDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = DF0C5F24252ECB8D00D921DB /* WKDownload.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DF0C5F2A252ECB8E00D921DB /* WKDownloadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DF0C5F26252ECB8E00D921DB /* WKDownloadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -2752,6 +2754,7 @@
 			dstSubfolderSpec = 16;
 			files = (
 				DDE992F6278D071F00F60D26 /* libWebKitAdditions.a in Product Dependencies */,
+				DDAB377628234B3900890546 /* AuthenticationServicesCore.framework in Product Dependencies */,
 			);
 			name = "Product Dependencies";
 			runOnlyForDeploymentPostprocessing = 0;
@@ -6960,6 +6963,8 @@
 		DDA0A41627E67039005E086E /* WebEventRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebEventRegion.h; path = ../WebCore/page/ios/WebEventRegion.h; sourceTree = "<group>"; };
 		DDA0A41827E672A5005E086E /* WAKAppKitStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WAKAppKitStubs.h; path = ../WebCore/platform/ios/wak/WAKAppKitStubs.h; sourceTree = "<group>"; };
 		DDA0A41D27E94644005E086E /* WebKitLegacy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitLegacy.h; sourceTree = "<group>"; };
+		DDAB377528234B2100890546 /* AuthenticationServicesCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AuthenticationServicesCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		DDDFE826284699E6006F1EE5 /* SafariServicesSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafariServicesSPI.h; sourceTree = "<group>"; };
 		DDE992F4278D06D900F60D26 /* libWebKitAdditions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libWebKitAdditions.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		DF0C5F23252ECB8D00D921DB /* WKDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKDownload.mm; sourceTree = "<group>"; };
 		DF0C5F24252ECB8D00D921DB /* WKDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDownload.h; sourceTree = "<group>"; };
@@ -10465,6 +10470,7 @@
 		5750F3292032D4E300389347 /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				DDAB377528234B2100890546 /* AuthenticationServicesCore.framework */,
 				E34B110C27C46BC6006D2F2E /* libWebCoreTestShim.dylib */,
 				E34B110F27C46D09006D2F2E /* libWebCoreTestSupport.dylib */,
 				DDE992F4278D06D900F60D26 /* libWebKitAdditions.a */,
@@ -13177,6 +13183,7 @@
 				E5DEFA6726F8F42600AB68DB /* PhotosUISPI.h */,
 				2D279E1826955768004B3EEB /* PrototypeToolsSPI.h */,
 				46F38E8B2416E66D0059375A /* RunningBoardServicesSPI.h */,
+				DDDFE826284699E6006F1EE5 /* SafariServicesSPI.h */,
 				079D1D9926960CD300883577 /* SystemStatusSPI.h */,
 				CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */,
 				CEE4AE2A1A5DCF430002F49B /* UIKitSPI.h */,
@@ -15078,6 +15085,7 @@
 				07A5EBBC1C7BA43E00B9CA69 /* WKFrameHandleRef.h in Headers */,
 				1A4D664C18A3030E00D82E21 /* WKFrameInfo.h in Headers */,
 				2DF9EEE81A78245500B6CFBE /* WKFrameInfoInternal.h in Headers */,
+				DDDFE827284699EC006F1EE5 /* SafariServicesSPI.h in Headers */,
 				1A6FA21E1BD0435B00AAA650 /* WKFrameInfoPrivate.h in Headers */,
 				2D3A65E71A7C3AA700CAC637 /* WKFrameInfoRef.h in Headers */,
 				BCB9F6A51123DD0D00A137E0 /* WKFramePolicyListener.h in Headers */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to