Title: [262474] trunk/Source/ThirdParty/ANGLE
Revision
262474
Author
krol...@apple.com
Date
2020-06-02 20:59:46 -0700 (Tue, 02 Jun 2020)

Log Message

Change ANGLE's header postprocessing script to not rely on timestamps
https://bugs.webkit.org/show_bug.cgi?id=212623
<rdar://problem/63856997>

Reviewed by David Kilzer.
Reviewed by Kennneth Russell.

Some WebKit builds involve multiple passes, where each pass is a
superset of the previous pass. In the cases where each pass produces
the same files, it is required that files be produced in exactly the
same way in each of those passes. A build process that relies on a
file containing a timestamp trips up that prerequisite.

adjust-angle-include-paths.sh uses such a mechanism, using a timestamp
file to determine if any exported headers need to be post-processed.
Since this violates our prerequisite, we need a different approach.
Instead of using a timestamp, always perform the post-processing, but
write the output to a temporary location. Then see if it differs from
what's in the actual final destination. If the two files diff, then
copy the one from the temporary location to the final destination.

This approach does cause more work in the area of post-processing.
However, this post-processing is actually very cheap. And avoiding the
post-processing is not actually the original goal of the timestamp.
The actual goal is to avoid touching the modification dates of the
exported headers, which would then cause a lot of downstream
rebuilding. The new approach with the temporary files also achieves
that goal.

* CMakeLists.txt:
* adjust-angle-include-paths.sh:

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/CMakeLists.txt (262473 => 262474)


--- trunk/Source/ThirdParty/ANGLE/CMakeLists.txt	2020-06-03 03:48:52 UTC (rev 262473)
+++ trunk/Source/ThirdParty/ANGLE/CMakeLists.txt	2020-06-03 03:59:46 UTC (rev 262474)
@@ -150,17 +150,14 @@
         FLATTENED
     )
 
-    add_custom_command(
-        OUTPUT ${ANGLE_FRAMEWORK_HEADERS_DIR}/ANGLE/angle.timestamp
+    add_custom_target(ANGLE-webgl-headers
         DEPENDS LibGLESv2EntryPointsHeaders ANGLEWebGLHeaders
         COMMAND BUILT_PRODUCTS_DIR=${ANGLE_FRAMEWORK_HEADERS_DIR}/
+            DERIVED_FILE_DIR=${BUILT_PRODUCTS_DIR}
             PUBLIC_HEADERS_FOLDER_PATH=ANGLE
             ${CMAKE_CURRENT_SOURCE_DIR}/adjust-angle-include-paths.sh
         VERBATIM
     )
-    add_custom_target(ANGLE-webgl-headers
-        DEPENDS ${ANGLE_FRAMEWORK_HEADERS_DIR}/ANGLE/angle.timestamp
-    )
     add_dependencies(ANGLEFramework ANGLE-webgl-headers)
 endif ()
 

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (262473 => 262474)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-06-03 03:48:52 UTC (rev 262473)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-06-03 03:59:46 UTC (rev 262474)
@@ -1,3 +1,37 @@
+2020-06-02  Keith Rollin  <krol...@apple.com>
+
+        Change ANGLE's header postprocessing script to not rely on timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=212623
+        <rdar://problem/63856997>
+
+        Reviewed by David Kilzer.
+        Reviewed by Kennneth Russell.
+
+        Some WebKit builds involve multiple passes, where each pass is a
+        superset of the previous pass. In the cases where each pass produces
+        the same files, it is required that files be produced in exactly the
+        same way in each of those passes. A build process that relies on a
+        file containing a timestamp trips up that prerequisite.
+
+        adjust-angle-include-paths.sh uses such a mechanism, using a timestamp
+        file to determine if any exported headers need to be post-processed.
+        Since this violates our prerequisite, we need a different approach.
+        Instead of using a timestamp, always perform the post-processing, but
+        write the output to a temporary location. Then see if it differs from
+        what's in the actual final destination. If the two files diff, then
+        copy the one from the temporary location to the final destination.
+
+        This approach does cause more work in the area of post-processing.
+        However, this post-processing is actually very cheap. And avoiding the
+        post-processing is not actually the original goal of the timestamp.
+        The actual goal is to avoid touching the modification dates of the
+        exported headers, which would then cause a lot of downstream
+        rebuilding. The new approach with the temporary files also achieves
+        that goal.
+
+        * CMakeLists.txt:
+        * adjust-angle-include-paths.sh:
+
 2020-06-02  Kenneth Russell  <k...@chromium.org>
 
         Revise PVRTC compressed texture validation in ANGLE backend for WebGL

Modified: trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh (262473 => 262474)


--- trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh	2020-06-03 03:48:52 UTC (rev 262473)
+++ trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh	2020-06-03 03:59:46 UTC (rev 262474)
@@ -27,15 +27,12 @@
     output_dir=${BUILT_PRODUCTS_DIR}${PUBLIC_HEADERS_FOLDER_PATH}
 fi
 
-if [ $(uname) == "Linux" ]; then
-    inplace_opt=(-i)
-else
-    inplace_opt=(-i "")
-fi
+mkdir -p "${DERIVED_FILE_DIR}"
+BASE_NAME=$(basename "$0")
+TEMP_FILE=$(mktemp "${DERIVED_FILE_DIR}/${BASE_NAME}.XXXXXX")
 
 for i in $output_dir/*.h ; do
-    if [ ! -f $output_dir/angle.timestamp ] || [ $i -nt $output_dir/angle.timestamp ] ; then
-        sed -e '
+    sed -e '
 s/^#include [<"]EGL\/\(.*\)[>"]/#include <ANGLE\/\1>/
 s/^#include [<"]GLES\/\(.*\)[>"]/#include <ANGLE\/\1>/
 s/^#include [<"]GLES2\/\(.*\)[>"]/#include <ANGLE\/\1>/
@@ -43,9 +40,12 @@
 s/^#include [<"]KHR\/\(.*\)[>"]/#include <ANGLE\/\1>/
 s/^#include [<"]export.h[>"]/#include <ANGLE\/export.h>/
 s/^#include "\(eglext_angle\|gl2ext_angle\|ShaderVars\).h"/#include <ANGLE\/\1.h>/
-' "${inplace_opt[@]}" $i
+' < "$i" > "${TEMP_FILE}"
+    if ! diff -q "${TEMP_FILE}" "$i" &> /dev/null ; then
+        cp "${TEMP_FILE}" "$i"
         echo Postprocessed ANGLE header `basename $i`
     fi
 done
 
-date > $output_dir/angle.timestamp
+rm -f "${TEMP_FILE}" &> /dev/null
+exit 0
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to