Title: [268163] trunk/Source
Revision
268163
Author
[email protected]
Date
2020-10-07 17:23:53 -0700 (Wed, 07 Oct 2020)

Log Message

Update post-processing rules for headers to not unnecessarily change timestamps
https://bugs.webkit.org/show_bug.cgi?id=217371
<rdar://problem/69992230>

Reviewed by Darin Adler.

Under XCBuild, the scripts employed in custom build rules can be
invoked in innocuous situations. A common example is when the user is
building from the command-line and they change the `make` output from
stdout to a file, or vice-versa. Changing the output changes the
setting of the COLOR_DIAGNOSTICS environment variable, which is enough
to cause XCBuild to think something is different and that the custom
build rule needs to be invoked. For the script's part, nothing
significant has changed, yet it post-processes the header files,
causing their modification dates to change, causing downstream
rebuilds to occur.

Fix this problem by adopting an approach that doesn't modify the
post-processed header files unless their contents actually change.

Source/_javascript_Core:

* Scripts/postprocess-header-rule:

Source/ThirdParty/ANGLE:

* adjust-angle-include-paths-rule:

Source/ThirdParty/libwebrtc:

* libwebrtc.xcodeproj/project.pbxproj:

Source/WebKit:

No new tests -- this is a build change only.

* Scripts/postprocess-header-rule:

Source/WebKitLegacy:

* scripts/postprocess-header-rule:

Source/WTF:

* Scripts/GeneratePreferences.rb:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (268162 => 268163)


--- trunk/Source/_javascript_Core/ChangeLog	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-10-08 00:23:53 UTC (rev 268163)
@@ -1,3 +1,27 @@
+2020-10-07  Keith Rollin  <[email protected]>
+
+        Update post-processing rules for headers to not unnecessarily change timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=217371
+        <rdar://problem/69992230>
+
+        Reviewed by Darin Adler.
+
+        Under XCBuild, the scripts employed in custom build rules can be
+        invoked in innocuous situations. A common example is when the user is
+        building from the command-line and they change the `make` output from
+        stdout to a file, or vice-versa. Changing the output changes the
+        setting of the COLOR_DIAGNOSTICS environment variable, which is enough
+        to cause XCBuild to think something is different and that the custom
+        build rule needs to be invoked. For the script's part, nothing
+        significant has changed, yet it post-processes the header files,
+        causing their modification dates to change, causing downstream
+        rebuilds to occur.
+
+        Fix this problem by adopting an approach that doesn't modify the
+        post-processed header files unless their contents actually change.
+
+        * Scripts/postprocess-header-rule:
+
 2020-10-05  Yusuke Suzuki  <[email protected]>
 
         [JSC] More consistent PtrTagging for code types

Modified: trunk/Source/_javascript_Core/Scripts/postprocess-header-rule (268162 => 268163)


--- trunk/Source/_javascript_Core/Scripts/postprocess-header-rule	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/_javascript_Core/Scripts/postprocess-header-rule	2020-10-08 00:23:53 UTC (rev 268163)
@@ -44,6 +44,10 @@
 }
 
 function rewrite_headers () {
+    local SOURCE_FILE="${1}"
+    local WORK_FILE="${2}.tmp"
+    local DEST_FILE="${2}"
+
     if [[ "${PLATFORM_NAME}" == "macosx" ]]; then
         [[ -n ${OSX_VERSION} ]] || OSX_VERSION=${MACOSX_DEPLOYMENT_TARGET}
         [[ -n ${IOS_VERSION} ]] || IOS_VERSION="NA"
@@ -80,8 +84,9 @@
 
     SED_OPTIONS+=(${OTHER_SED_OPTIONS[*]})
 
-    ditto "${1}" "${2}"
-    sed -i .tmp -E "${SED_OPTIONS[@]}" "${2}" || exit $?
+    sed -E "${SED_OPTIONS[@]}" "${SOURCE_FILE}" > "${WORK_FILE}" || exit $?
+    cmp -s "${WORK_FILE}" "${DEST_FILE}" && rm -f "${WORK_FILE}" || mv "${WORK_FILE}" "${DEST_FILE}"
+    [[ "${SOURCE_FILE}" -nt "${DEST_FILE}" ]] && touch "${DEST_FILE}" || true
 }
 
 DEFINITIONS_PATH=usr/local/include/WebKitAdditions/Scripts/postprocess-framework-headers-definitions

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (268162 => 268163)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-10-08 00:23:53 UTC (rev 268163)
@@ -1,3 +1,27 @@
+2020-10-07  Keith Rollin  <[email protected]>
+
+        Update post-processing rules for headers to not unnecessarily change timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=217371
+        <rdar://problem/69992230>
+
+        Reviewed by Darin Adler.
+
+        Under XCBuild, the scripts employed in custom build rules can be
+        invoked in innocuous situations. A common example is when the user is
+        building from the command-line and they change the `make` output from
+        stdout to a file, or vice-versa. Changing the output changes the
+        setting of the COLOR_DIAGNOSTICS environment variable, which is enough
+        to cause XCBuild to think something is different and that the custom
+        build rule needs to be invoked. For the script's part, nothing
+        significant has changed, yet it post-processes the header files,
+        causing their modification dates to change, causing downstream
+        rebuilds to occur.
+
+        Fix this problem by adopting an approach that doesn't modify the
+        post-processed header files unless their contents actually change.
+
+        * adjust-angle-include-paths-rule:
+
 2020-10-02  Kimmo Kinnunen  <[email protected]>
 
         [iOS WK1] Crashes when using ANGLE WebGL from another thread

Modified: trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths-rule (268162 => 268163)


--- trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths-rule	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths-rule	2020-10-08 00:23:53 UTC (rev 268163)
@@ -21,6 +21,10 @@
 
 if [[ -n "${SCRIPT_HEADER_VISIBILITY}" ]]
 then
+    SOURCE_FILE="${SCRIPT_INPUT_FILE}"
+    WORK_FILE="${SCRIPT_OUTPUT_FILE_0}.tmp"
+    DEST_FILE="${SCRIPT_OUTPUT_FILE_0}"
+
     sed \
         -e 's/^#include [<"]EGL\/\(.*\)[>"]/#include <ANGLE\/\1>/' \
         -e 's/^#include [<"]GLES\/\(.*\)[>"]/#include <ANGLE\/\1>/' \
@@ -29,7 +33,8 @@
         -e 's/^#include [<"]KHR\/\(.*\)[>"]/#include <ANGLE\/\1>/' \
         -e 's/^#include [<"]export.h[>"]/#include <ANGLE\/export.h>/' \
         -e 's/^#include "\(eglext_angle\|gl2ext_angle\|ShaderVars\).h"/#include <ANGLE\/\1.h>/' \
-        "${SCRIPT_INPUT_FILE}" > "${SCRIPT_OUTPUT_FILE_0}"
-    echo "Postprocessed ANGLE header: ${SCRIPT_OUTPUT_FILE_0}"
+        "${SOURCE_FILE}" > "${WORK_FILE}"
+    cmp -s "${WORK_FILE}" "${DEST_FILE}" && rm -f "${WORK_FILE}" || mv "${WORK_FILE}" "${DEST_FILE}"
+    [[ "${SOURCE_FILE}" -nt "${DEST_FILE}" ]] && touch "${DEST_FILE}" || true
 fi
 exit 0

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (268162 => 268163)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-10-08 00:23:53 UTC (rev 268163)
@@ -1,3 +1,27 @@
+2020-10-07  Keith Rollin  <[email protected]>
+
+        Update post-processing rules for headers to not unnecessarily change timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=217371
+        <rdar://problem/69992230>
+
+        Reviewed by Darin Adler.
+
+        Under XCBuild, the scripts employed in custom build rules can be
+        invoked in innocuous situations. A common example is when the user is
+        building from the command-line and they change the `make` output from
+        stdout to a file, or vice-versa. Changing the output changes the
+        setting of the COLOR_DIAGNOSTICS environment variable, which is enough
+        to cause XCBuild to think something is different and that the custom
+        build rule needs to be invoked. For the script's part, nothing
+        significant has changed, yet it post-processes the header files,
+        causing their modification dates to change, causing downstream
+        rebuilds to occur.
+
+        Fix this problem by adopting an approach that doesn't modify the
+        post-processed header files unless their contents actually change.
+
+        * libwebrtc.xcodeproj/project.pbxproj:
+
 2020-09-24  Youenn Fablet  <[email protected]>
 
         Add libwebrtc.dylib version check

Modified: trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj (268162 => 268163)


--- trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj	2020-10-08 00:23:53 UTC (rev 268163)
@@ -3902,7 +3902,7 @@
 			outputFiles = (
 				"${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/${INPUT_FILE_BASE}.o",
 			);
-			script = "${BUILT_PRODUCTS_DIR}/yasm -fmacho64 -I ${SRCROOT}/Source/third_party/libvpx/source/config -I ${SRCROOT}/Source/third_party/libvpx/source/config/mac/x64 -I ${SRCROOT}/Source/third_party/libvpx/source/libvpx -o ${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/${INPUT_FILE_BASE}.o ${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.asm\n";
+			script = "SOURCE_DIR=\"${SRCROOT}/Source/third_party/libvpx/source\"\nSOURCE_FILE=\"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.asm\"\nOBJECT_FILE=\"${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/${INPUT_FILE_BASE}.o\"\n\"${BUILT_PRODUCTS_DIR}/yasm\" -fmacho64 -I \"${SOURCE_DIR}/config\" -I \"${SOURCE_DIR}/config/mac/x64\" -I \"${SOURCE_DIR}/libvpx\" -o \"${OBJECT_FILE}.tmp\" \"${SOURCE_FILE}\"\ncmp -s \"${OBJECT_FILE}.tmp\" \"${OBJECT_FILE}\" && rm -f \"${OBJECT_FILE}.tmp\" || mv \"${OBJECT_FILE}.tmp\" \"${OBJECT_FILE}\"\n[[ \"${SOURCE_FILE}\" -nt \"${OBJECT_FILE}\" ]] && touch \"${OBJECT_FILE}\" || true\n";
 		};
 /* End PBXBuildRule section */
 

Modified: trunk/Source/WTF/ChangeLog (268162 => 268163)


--- trunk/Source/WTF/ChangeLog	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/WTF/ChangeLog	2020-10-08 00:23:53 UTC (rev 268163)
@@ -1,3 +1,27 @@
+2020-10-07  Keith Rollin  <[email protected]>
+
+        Update post-processing rules for headers to not unnecessarily change timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=217371
+        <rdar://problem/69992230>
+
+        Reviewed by Darin Adler.
+
+        Under XCBuild, the scripts employed in custom build rules can be
+        invoked in innocuous situations. A common example is when the user is
+        building from the command-line and they change the `make` output from
+        stdout to a file, or vice-versa. Changing the output changes the
+        setting of the COLOR_DIAGNOSTICS environment variable, which is enough
+        to cause XCBuild to think something is different and that the custom
+        build rule needs to be invoked. For the script's part, nothing
+        significant has changed, yet it post-processes the header files,
+        causing their modification dates to change, causing downstream
+        rebuilds to occur.
+
+        Fix this problem by adopting an approach that doesn't modify the
+        post-processed header files unless their contents actually change.
+
+        * Scripts/GeneratePreferences.rb:
+
 2020-10-07  Devin Rousso  <[email protected]>
 
         Add missing `#define` for `PENCILKIT_TEXT_INPUT` flag

Modified: trunk/Source/WTF/Scripts/GeneratePreferences.rb (268162 => 268163)


--- trunk/Source/WTF/Scripts/GeneratePreferences.rb	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/WTF/Scripts/GeneratePreferences.rb	2020-10-08 00:23:53 UTC (rev 268163)
@@ -214,12 +214,19 @@
   def renderTemplate(templateFile, outputDirectory)
     puts "Generating output for template file: #{templateFile}"
 
-    resultFile = File.basename(templateFile, ".erb")
+    resultFile = File.join(outputDirectory, File.basename(templateFile, ".erb"))
+    tempResultFile = resultFile + ".tmp"
 
     output = ERB.new(File.read(templateFile), 0, "-").result(binding)
-    File.open(File.join(outputDirectory, resultFile), "w+") do |f|
+    File.open(tempResultFile, "w+") do |f|
       f.write(output)
     end
+    if (!File.exist?(resultFile) || IO::read(resultFile) != IO::read(tempResultFile))
+      FileUtils.move(tempResultFile, resultFile)
+    else
+      FileUtils.remove_file(tempResultFile)
+      FileUtils.uptodate?(resultFile, [templateFile]) or FileUtils.touch(resultFile)
+    end
   end
 end
 

Modified: trunk/Source/WebKit/ChangeLog (268162 => 268163)


--- trunk/Source/WebKit/ChangeLog	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/WebKit/ChangeLog	2020-10-08 00:23:53 UTC (rev 268163)
@@ -1,3 +1,29 @@
+2020-10-07  Keith Rollin  <[email protected]>
+
+        Update post-processing rules for headers to not unnecessarily change timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=217371
+        <rdar://problem/69992230>
+
+        Reviewed by Darin Adler.
+
+        Under XCBuild, the scripts employed in custom build rules can be
+        invoked in innocuous situations. A common example is when the user is
+        building from the command-line and they change the `make` output from
+        stdout to a file, or vice-versa. Changing the output changes the
+        setting of the COLOR_DIAGNOSTICS environment variable, which is enough
+        to cause XCBuild to think something is different and that the custom
+        build rule needs to be invoked. For the script's part, nothing
+        significant has changed, yet it post-processes the header files,
+        causing their modification dates to change, causing downstream
+        rebuilds to occur.
+
+        Fix this problem by adopting an approach that doesn't modify the
+        post-processed header files unless their contents actually change.
+
+        No new tests -- this is a build change only.
+
+        * Scripts/postprocess-header-rule:
+
 2020-10-07  Jiewen Tan  <[email protected]>
 
         [WebAuthn] Implement a dummy WebAuthenticationAgent

Modified: trunk/Source/WebKit/Scripts/postprocess-header-rule (268162 => 268163)


--- trunk/Source/WebKit/Scripts/postprocess-header-rule	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/WebKit/Scripts/postprocess-header-rule	2020-10-08 00:23:53 UTC (rev 268163)
@@ -39,10 +39,14 @@
 }
 
 function rewrite_headers () {
-    ditto "${1}" "${2}"
+    SOURCE_FILE="${1}"
+    WORK_FILE="${2}.tmp"
+    DEST_FILE="${2}"
 
-    if [[ ! -z `grep '#import <WebKitAdditions/.*\.h>' "${2}"` ]]; then
-        python "${SRCROOT}/mac/replace-webkit-additions-includes.py" "${2}" "${BUILT_PRODUCTS_DIR}" "${SDKROOT}" || exit $?
+    ditto "${SOURCE_FILE}" "${WORK_FILE}"
+
+    if [[ ! -z `grep '#import <WebKitAdditions/.*\.h>' "${WORK_FILE}"` ]]; then
+        python "${SRCROOT}/mac/replace-webkit-additions-includes.py" "${WORK_FILE}" "${BUILT_PRODUCTS_DIR}" "${SDKROOT}" || exit $?
     fi
 
     if [[ "${WK_FRAMEWORK_HEADER_POSTPROCESSING_DISABLED}" != "YES" ]]; then
@@ -75,16 +79,16 @@
 
         SED_OPTIONS+=(${OTHER_SED_OPTIONS[*]})
 
-        sed -i .tmp -E "${SED_OPTIONS[@]}" "${2}" || exit $?
+        sed -i '' -E "${SED_OPTIONS[@]}" "${WORK_FILE}" || exit $?
     fi
 
-    HEADER_NAME=$(basename "${2}")
+    HEADER_NAME=$(basename "${WORK_FILE}" '.tmp')
     if [[ "${HEADER_NAME}" == "WKBase.h" ]]; then
-        unifdef -B -D__APPLE__ -UBUILDING_GTK__ -UBUILDING_WPE__ -UUSE_SOUP -o "${2}".unifdef "${2}"
+        unifdef -B -D__APPLE__ -UBUILDING_GTK__ -UBUILDING_WPE__ -UUSE_SOUP -o "${WORK_FILE}".unifdef "${WORK_FILE}"
 
         case $? in
-            0) rm "${2}".unifdef ;;
-            1) mv "${2}"{.unifdef,} ;;
+            0) rm "${WORK_FILE}".unifdef ;;
+            1) mv "${WORK_FILE}"{.unifdef,} ;;
             *) exit 1
         esac
     fi
@@ -96,14 +100,17 @@
             UNIFDEF_OPTIONS="-DWK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED"
         fi
 
-        unifdef -B ${UNIFDEF_OPTIONS} -o "${2}".unifdef "${2}"
+        unifdef -B ${UNIFDEF_OPTIONS} -o "${WORK_FILE}".unifdef "${WORK_FILE}"
 
         case $? in
-            0) rm "${2}".unifdef ;;
-            1) mv "${2}"{.unifdef,} ;;
+            0) rm "${WORK_FILE}".unifdef ;;
+            1) mv "${WORK_FILE}"{.unifdef,} ;;
             *) exit 1
         esac
     fi
+
+    cmp -s "${WORK_FILE}" "${DEST_FILE}" && rm -f "${WORK_FILE}" || mv "${WORK_FILE}" "${DEST_FILE}"
+    [[ "${SOURCE_FILE}" -nt "${DEST_FILE}" ]] && touch "${DEST_FILE}" || true
 }
 
 DEFINITIONS_PATH=usr/local/include/WebKitAdditions/Scripts/postprocess-framework-headers-definitions

Modified: trunk/Source/WebKitLegacy/ChangeLog (268162 => 268163)


--- trunk/Source/WebKitLegacy/ChangeLog	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/WebKitLegacy/ChangeLog	2020-10-08 00:23:53 UTC (rev 268163)
@@ -1,3 +1,27 @@
+2020-10-07  Keith Rollin  <[email protected]>
+
+        Update post-processing rules for headers to not unnecessarily change timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=217371
+        <rdar://problem/69992230>
+
+        Reviewed by Darin Adler.
+
+        Under XCBuild, the scripts employed in custom build rules can be
+        invoked in innocuous situations. A common example is when the user is
+        building from the command-line and they change the `make` output from
+        stdout to a file, or vice-versa. Changing the output changes the
+        setting of the COLOR_DIAGNOSTICS environment variable, which is enough
+        to cause XCBuild to think something is different and that the custom
+        build rule needs to be invoked. For the script's part, nothing
+        significant has changed, yet it post-processes the header files,
+        causing their modification dates to change, causing downstream
+        rebuilds to occur.
+
+        Fix this problem by adopting an approach that doesn't modify the
+        post-processed header files unless their contents actually change.
+
+        * scripts/postprocess-header-rule:
+
 2020-09-28  Sam Weinig  <[email protected]>
 
         [Preferences] Move GeneratePreferences.rb and yaml configuration files to WTF to be shared

Modified: trunk/Source/WebKitLegacy/scripts/postprocess-header-rule (268162 => 268163)


--- trunk/Source/WebKitLegacy/scripts/postprocess-header-rule	2020-10-08 00:01:27 UTC (rev 268162)
+++ trunk/Source/WebKitLegacy/scripts/postprocess-header-rule	2020-10-08 00:23:53 UTC (rev 268163)
@@ -28,9 +28,12 @@
     exit 0
 fi
 
-ditto "${SCRIPT_INPUT_FILE}" "${SCRIPT_OUTPUT_FILE_0}"
-header="${SCRIPT_OUTPUT_FILE_0}"
+SOURCE_FILE="${SCRIPT_INPUT_FILE}"
+WORK_FILE="${SCRIPT_OUTPUT_FILE_0}.tmp"
+DEST_FILE="${SCRIPT_OUTPUT_FILE_0}"
 
+ditto "${SOURCE_FILE}" "${WORK_FILE}"
+
 if [[ ${USE_INTERNAL_SDK} == "YES" ]]; then
     USE_APPLE_INTERNAL_SDK=1
 else
@@ -59,22 +62,21 @@
     fi
 done
 
-unifdef -B ${unifdefOptions} -o "${header}.unifdef" "${header}"
+unifdef -B ${unifdefOptions} -o "${WORK_FILE}.unifdef" "${WORK_FILE}"
 case $? in
-    0) rm "${header}".unifdef ;;
-    1) mv "${header}"{.unifdef,} ;;
+    0) rm "${WORK_FILE}".unifdef ;;
+    1) mv "${WORK_FILE}"{.unifdef,} ;;
     *) exit 1 ;;
 esac
 
-if [[ "${header}" == "./WebKitAvailability.h" ]]; then
+HEADER_NAME=$(basename "${WORK_FILE}" '.tmp')
+if [[ "${HEADER_NAME}" == "WebKitAvailability.h" ]]; then
     exit 0
 fi
 
 if [[ ${WK_PLATFORM_NAME} != macosx ]]; then
-    sed -E -e "s/ *WEBKIT_((CLASS_|ENUM_)?(AVAILABLE|DEPRECATED))_MAC\([^)]+\)//g" < "${header}" > "${header}.sed"
-    if cmp -s "${header}" "${header}.sed"; then
-        rm "${header}.sed"
-    else
-        mv "${header}.sed" "${header}"
-    fi
+    sed -i '' -E -e "s/ *WEBKIT_((CLASS_|ENUM_)?(AVAILABLE|DEPRECATED))_MAC\([^)]+\)//g" "${WORK_FILE}"
 fi
+
+cmp -s "${WORK_FILE}" "${DEST_FILE}" && rm -f "${WORK_FILE}" || mv "${WORK_FILE}" "${DEST_FILE}"
+[[ "${SOURCE_FILE}" -nt "${DEST_FILE}" ]] && touch "${DEST_FILE}" || true
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to