Title: [290335] trunk/Source
Revision
290335
Author
e...@apple.com
Date
2022-02-22 15:07:26 -0800 (Tue, 22 Feb 2022)

Log Message

Source/WebCore/PAL:
Replace legacy-build-copy-nested-headers.py with an xcodebuild invocation.
https://bugs.webkit.org/show_bug.cgi?id=237011

Reviewed by Alexey Proskuryakov.

r290260 added a script to approximate how XCBuild copies headers to nested directories, for
use in legacy builds. Instead of that script, invoke `xcodebuild -UseNewBuildSystem=YES`
directly to copy nested headers to the build products directory. By taking the same
header-copying codepath, legacy builds can handle header edge cases (e.g. multiple headers
with the same basename) exactly as XCBuild does.

The child xcodebuild process saves incremental data to TARGET_TEMP_DIR, so it can rebuild
incrementally without clobbering the legacy build system's incremental data.

Apple production builds do not use the legacy build system, so this change is
engineering-only.

* PAL.xcodeproj/project.pbxproj:

Source/WTF:
Replace legacy-build-copy-nested-headers.py with an xcodebuild invocation
https://bugs.webkit.org/show_bug.cgi?id=237011

Reviewed by Alexey Proskuryakov.

* Scripts/legacy-build-copy-nested-headers.py: Removed.
* WTF.xcodeproj/project.pbxproj: Remove reference to legacy-build-copy-nested-headers.py.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (290334 => 290335)


--- trunk/Source/WTF/ChangeLog	2022-02-22 23:02:31 UTC (rev 290334)
+++ trunk/Source/WTF/ChangeLog	2022-02-22 23:07:26 UTC (rev 290335)
@@ -1,3 +1,13 @@
+2022-02-22  Elliott Williams  <e...@apple.com>
+
+        Replace legacy-build-copy-nested-headers.py with an xcodebuild invocation
+        https://bugs.webkit.org/show_bug.cgi?id=237011
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/legacy-build-copy-nested-headers.py: Removed.
+        * WTF.xcodeproj/project.pbxproj: Remove reference to legacy-build-copy-nested-headers.py.
+
 2022-02-22  Angelos Oikonomopoulos  <ange...@igalia.com>
 
         Ruby ERB.new compatibility fix

Deleted: trunk/Source/WTF/Scripts/legacy-build-copy-nested-headers.py (290334 => 290335)


--- trunk/Source/WTF/Scripts/legacy-build-copy-nested-headers.py	2022-02-22 23:02:31 UTC (rev 290334)
+++ trunk/Source/WTF/Scripts/legacy-build-copy-nested-headers.py	2022-02-22 23:07:26 UTC (rev 290335)
@@ -1,40 +0,0 @@
-#!/usr/bin/env python3
-"""
-Xcode's legacy build system lacks a way to create *nested* header directories, i.e. copying headers to a build product
-while preserving the directory hierarchy of those headers. This script compensates by copying headers from a "flattened"
-directory (denoted by ${HEADER_OUTPUT_DIR}) to a "nested" directory hierarchy (starting at
-${WK_NESTED_HEADER_OUTPUT_DIR}).
-"""
-
-import os
-import shutil
-import sys
-from pathlib import Path
-
-if os.environ.get('WK_USE_NEW_BUILD_SYSTEM') == 'YES':
-    # XCBuild uses build rules to do this natively; this script is for backwards
-    # compatibility only.
-    sys.exit(0)
-
-flattened_headers_folder = Path('{HEADER_OUTPUT_DIR}'.format_map(os.environ))
-nested_headers_folder = Path('{WK_NESTED_HEADER_OUTPUT_DIR}'.format_map(os.environ))
-header_srcroot = Path('{WK_HEADER_SRCROOT}'.format_map(os.environ))
-
-for header in header_srcroot.rglob('*.h'):
-    flattened = flattened_headers_folder / header.name
-    nested = nested_headers_folder / header.relative_to(header_srcroot)
-    if not flattened.exists():
-        # This header exists in the project's sources, but isn't being copied by
-        # Xcode. Skip it.
-        continue
-    if nested.exists() and os.path.getmtime(nested) >= os.path.getmtime(header):
-        # This header has already been copied. Skip it.
-        continue
-
-    # Copy the header out of SRCROOT, *NOT* the flattened headers folder.
-    # Headers with the same basename might have overwritten each other in the
-    # flattened directory, so there's no guarantee that a flattened header is
-    # actually the header we want.
-    print(header, '->', nested)
-    nested.parent.mkdir(parents=True, exist_ok=True)
-    shutil.copyfile(header, nested)

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (290334 => 290335)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2022-02-22 23:02:31 UTC (rev 290334)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2022-02-22 23:07:26 UTC (rev 290335)
@@ -161,7 +161,6 @@
 		CEA072AA236FFBF70018839C /* CrashReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEA072A9236FFBF70018839C /* CrashReporter.cpp */; };
 		DCEE22011CEA7551000C2396 /* BlockObjCExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DCEE21FD1CEA7551000C2396 /* BlockObjCExceptions.mm */; };
 		DD03059327B5DA0D00344002 /* SignedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 862A8D32278DE74A0014120C /* SignedPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		DD20DE7127BDB9950093D175 /* legacy-build-copy-nested-headers.py in Headers <wtf/Scripts> */ = {isa = PBXBuildFile; fileRef = DD20DE7027BDB9850093D175 /* legacy-build-copy-nested-headers.py */; };
 		DD3DC85E27A4BF8E007E5B61 /* WeakHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B67F3F12228D5310030DE9C /* WeakHashSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		DD3DC85F27A4BF8E007E5B61 /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B6151A825A004123FF /* HashMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		DD3DC86027A4BF8E007E5B61 /* Observer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD48A87024C8A21600F5800C /* Observer.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -997,7 +996,6 @@
 			files = (
 				DD3DCA0827A4E197007E5B61 /* generate-unified-source-bundles.rb in Headers <wtf/Scripts> */,
 				DD3DCA0927A4E197007E5B61 /* GeneratePreferences.rb in Headers <wtf/Scripts> */,
-				DD20DE7127BDB9950093D175 /* legacy-build-copy-nested-headers.py in Headers <wtf/Scripts> */,
 			);
 			name = "Headers <wtf/Scripts>";
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1739,7 +1737,6 @@
 		DCEE21FC1CEA7551000C2396 /* BlockObjCExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockObjCExceptions.h; sourceTree = "<group>"; };
 		DCEE21FD1CEA7551000C2396 /* BlockObjCExceptions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BlockObjCExceptions.mm; sourceTree = "<group>"; };
 		DCEE22041CEB9869000C2396 /* BackwardsGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackwardsGraph.h; sourceTree = "<group>"; };
-		DD20DE7027BDB9850093D175 /* legacy-build-copy-nested-headers.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "legacy-build-copy-nested-headers.py"; sourceTree = "<group>"; };
 		DD3DC9C127A4C4BD007E5B61 /* spi */ = {isa = PBXFileReference; lastKnownFileType = folder; path = spi; sourceTree = "<group>"; };
 		DD3DCA0127A4E176007E5B61 /* WebPreferencesDebug.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = WebPreferencesDebug.yaml; sourceTree = "<group>"; };
 		DD3DCA0227A4E176007E5B61 /* WebPreferencesExperimental.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = WebPreferencesExperimental.yaml; sourceTree = "<group>"; };
@@ -2761,7 +2758,6 @@
 				DD3DCA0027A4E176007E5B61 /* Preferences */,
 				DD3DCA0527A4E176007E5B61 /* generate-unified-source-bundles.rb */,
 				DD3DCA0627A4E176007E5B61 /* GeneratePreferences.rb */,
-				DD20DE7027BDB9850093D175 /* legacy-build-copy-nested-headers.py */,
 			);
 			path = Scripts;
 			sourceTree = "<group>";

Modified: trunk/Source/WebCore/PAL/ChangeLog (290334 => 290335)


--- trunk/Source/WebCore/PAL/ChangeLog	2022-02-22 23:02:31 UTC (rev 290334)
+++ trunk/Source/WebCore/PAL/ChangeLog	2022-02-22 23:07:26 UTC (rev 290335)
@@ -1,3 +1,24 @@
+2022-02-22  Elliott Williams  <e...@apple.com>
+
+        Replace legacy-build-copy-nested-headers.py with an xcodebuild invocation.
+        https://bugs.webkit.org/show_bug.cgi?id=237011
+
+        Reviewed by Alexey Proskuryakov.
+
+        r290260 added a script to approximate how XCBuild copies headers to nested directories, for
+        use in legacy builds. Instead of that script, invoke `xcodebuild -UseNewBuildSystem=YES`
+        directly to copy nested headers to the build products directory. By taking the same
+        header-copying codepath, legacy builds can handle header edge cases (e.g. multiple headers
+        with the same basename) exactly as XCBuild does.
+
+        The child xcodebuild process saves incremental data to TARGET_TEMP_DIR, so it can rebuild
+        incrementally without clobbering the legacy build system's incremental data.
+
+        Apple production builds do not use the legacy build system, so this change is
+        engineering-only.
+
+        * PAL.xcodeproj/project.pbxproj:
+
 2022-02-21  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [WebGPU] Fix build

Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (290334 => 290335)


--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2022-02-22 23:02:31 UTC (rev 290334)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2022-02-22 23:07:26 UTC (rev 290335)
@@ -2041,7 +2041,6 @@
 			inputFileListPaths = (
 			);
 			inputPaths = (
-				"$(WTF_BUILD_SCRIPTS_DIR)/legacy-build-copy-nested-headers.py",
 			);
 			name = "(Legacy Build System) Nest Headers";
 			outputFileListPaths = (
@@ -2050,7 +2049,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "HEADER_OUTPUT_DIR=\"${BUILT_PRODUCTS_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}\" \\\n    WK_NESTED_HEADER_OUTPUT_DIR=\"${BUILT_PRODUCTS_DIR}/${PRIVATE_HEADERS_FOLDER_PATH_not_legacy}\" \\\n    WK_HEADER_SRCROOT=\"${SRCROOT}/pal\" \\\n    \"${SCRIPT_INPUT_FILE_0}\"\n";
+			shellScript = "[ \"${WK_USE_NEW_BUILD_SYSTEM}\" = YES ] && exit 0\nxcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" installhdrs SYMROOT=\"${TARGET_TEMP_DIR}/LegacyNestHeaders-build\" DSTROOT=\"${BUILT_PRODUCTS_DIR}\" SDKROOT=\"${SDKROOT}\" -UseNewBuildSystem=YES\n";
 		};
 /* End PBXShellScriptBuildPhase section */
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to