Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit a1d8765

Browse files
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/JavaScriptCore: * 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: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@268163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent c5b15e9 commit a1d8765

File tree

12 files changed

+202
-30
lines changed

12 files changed

+202
-30
lines changed

Source/JavaScriptCore/ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2020-10-07 Keith Rollin <[email protected]>
2+
3+
Update post-processing rules for headers to not unnecessarily change timestamps
4+
https://bugs.webkit.org/show_bug.cgi?id=217371
5+
<rdar://problem/69992230>
6+
7+
Reviewed by Darin Adler.
8+
9+
Under XCBuild, the scripts employed in custom build rules can be
10+
invoked in innocuous situations. A common example is when the user is
11+
building from the command-line and they change the `make` output from
12+
stdout to a file, or vice-versa. Changing the output changes the
13+
setting of the COLOR_DIAGNOSTICS environment variable, which is enough
14+
to cause XCBuild to think something is different and that the custom
15+
build rule needs to be invoked. For the script's part, nothing
16+
significant has changed, yet it post-processes the header files,
17+
causing their modification dates to change, causing downstream
18+
rebuilds to occur.
19+
20+
Fix this problem by adopting an approach that doesn't modify the
21+
post-processed header files unless their contents actually change.
22+
23+
* Scripts/postprocess-header-rule:
24+
125
2020-10-05 Yusuke Suzuki <[email protected]>
226

327
[JSC] More consistent PtrTagging for code types

Source/JavaScriptCore/Scripts/postprocess-header-rule

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ function process_definitions () {
4444
}
4545

4646
function rewrite_headers () {
47+
local SOURCE_FILE="${1}"
48+
local WORK_FILE="${2}.tmp"
49+
local DEST_FILE="${2}"
50+
4751
if [[ "${PLATFORM_NAME}" == "macosx" ]]; then
4852
[[ -n ${OSX_VERSION} ]] || OSX_VERSION=${MACOSX_DEPLOYMENT_TARGET}
4953
[[ -n ${IOS_VERSION} ]] || IOS_VERSION="NA"
@@ -80,8 +84,9 @@ function rewrite_headers () {
8084

8185
SED_OPTIONS+=(${OTHER_SED_OPTIONS[*]})
8286

83-
ditto "${1}" "${2}"
84-
sed -i .tmp -E "${SED_OPTIONS[@]}" "${2}" || exit $?
87+
sed -E "${SED_OPTIONS[@]}" "${SOURCE_FILE}" > "${WORK_FILE}" || exit $?
88+
cmp -s "${WORK_FILE}" "${DEST_FILE}" && rm -f "${WORK_FILE}" || mv "${WORK_FILE}" "${DEST_FILE}"
89+
[[ "${SOURCE_FILE}" -nt "${DEST_FILE}" ]] && touch "${DEST_FILE}" || true
8590
}
8691

8792
DEFINITIONS_PATH=usr/local/include/WebKitAdditions/Scripts/postprocess-framework-headers-definitions

Source/ThirdParty/ANGLE/ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2020-10-07 Keith Rollin <[email protected]>
2+
3+
Update post-processing rules for headers to not unnecessarily change timestamps
4+
https://bugs.webkit.org/show_bug.cgi?id=217371
5+
<rdar://problem/69992230>
6+
7+
Reviewed by Darin Adler.
8+
9+
Under XCBuild, the scripts employed in custom build rules can be
10+
invoked in innocuous situations. A common example is when the user is
11+
building from the command-line and they change the `make` output from
12+
stdout to a file, or vice-versa. Changing the output changes the
13+
setting of the COLOR_DIAGNOSTICS environment variable, which is enough
14+
to cause XCBuild to think something is different and that the custom
15+
build rule needs to be invoked. For the script's part, nothing
16+
significant has changed, yet it post-processes the header files,
17+
causing their modification dates to change, causing downstream
18+
rebuilds to occur.
19+
20+
Fix this problem by adopting an approach that doesn't modify the
21+
post-processed header files unless their contents actually change.
22+
23+
* adjust-angle-include-paths-rule:
24+
125
2020-10-02 Kimmo Kinnunen <[email protected]>
226

327
[iOS WK1] Crashes when using ANGLE WebGL from another thread

Source/ThirdParty/ANGLE/adjust-angle-include-paths-rule

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
if [[ -n "${SCRIPT_HEADER_VISIBILITY}" ]]
2323
then
24+
SOURCE_FILE="${SCRIPT_INPUT_FILE}"
25+
WORK_FILE="${SCRIPT_OUTPUT_FILE_0}.tmp"
26+
DEST_FILE="${SCRIPT_OUTPUT_FILE_0}"
27+
2428
sed \
2529
-e 's/^#include [<"]EGL\/\(.*\)[>"]/#include <ANGLE\/\1>/' \
2630
-e 's/^#include [<"]GLES\/\(.*\)[>"]/#include <ANGLE\/\1>/' \
@@ -29,7 +33,8 @@ then
2933
-e 's/^#include [<"]KHR\/\(.*\)[>"]/#include <ANGLE\/\1>/' \
3034
-e 's/^#include [<"]export.h[>"]/#include <ANGLE\/export.h>/' \
3135
-e 's/^#include "\(eglext_angle\|gl2ext_angle\|ShaderVars\).h"/#include <ANGLE\/\1.h>/' \
32-
"${SCRIPT_INPUT_FILE}" > "${SCRIPT_OUTPUT_FILE_0}"
33-
echo "Postprocessed ANGLE header: ${SCRIPT_OUTPUT_FILE_0}"
36+
"${SOURCE_FILE}" > "${WORK_FILE}"
37+
cmp -s "${WORK_FILE}" "${DEST_FILE}" && rm -f "${WORK_FILE}" || mv "${WORK_FILE}" "${DEST_FILE}"
38+
[[ "${SOURCE_FILE}" -nt "${DEST_FILE}" ]] && touch "${DEST_FILE}" || true
3439
fi
3540
exit 0

Source/ThirdParty/libwebrtc/ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2020-10-07 Keith Rollin <[email protected]>
2+
3+
Update post-processing rules for headers to not unnecessarily change timestamps
4+
https://bugs.webkit.org/show_bug.cgi?id=217371
5+
<rdar://problem/69992230>
6+
7+
Reviewed by Darin Adler.
8+
9+
Under XCBuild, the scripts employed in custom build rules can be
10+
invoked in innocuous situations. A common example is when the user is
11+
building from the command-line and they change the `make` output from
12+
stdout to a file, or vice-versa. Changing the output changes the
13+
setting of the COLOR_DIAGNOSTICS environment variable, which is enough
14+
to cause XCBuild to think something is different and that the custom
15+
build rule needs to be invoked. For the script's part, nothing
16+
significant has changed, yet it post-processes the header files,
17+
causing their modification dates to change, causing downstream
18+
rebuilds to occur.
19+
20+
Fix this problem by adopting an approach that doesn't modify the
21+
post-processed header files unless their contents actually change.
22+
23+
* libwebrtc.xcodeproj/project.pbxproj:
24+
125
2020-09-24 Youenn Fablet <[email protected]>
226

327
Add libwebrtc.dylib version check

Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3902,7 +3902,7 @@
39023902
outputFiles = (
39033903
"${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/${INPUT_FILE_BASE}.o",
39043904
);
3905-
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";
3905+
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";
39063906
};
39073907
/* End PBXBuildRule section */
39083908

Source/WTF/ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2020-10-07 Keith Rollin <[email protected]>
2+
3+
Update post-processing rules for headers to not unnecessarily change timestamps
4+
https://bugs.webkit.org/show_bug.cgi?id=217371
5+
<rdar://problem/69992230>
6+
7+
Reviewed by Darin Adler.
8+
9+
Under XCBuild, the scripts employed in custom build rules can be
10+
invoked in innocuous situations. A common example is when the user is
11+
building from the command-line and they change the `make` output from
12+
stdout to a file, or vice-versa. Changing the output changes the
13+
setting of the COLOR_DIAGNOSTICS environment variable, which is enough
14+
to cause XCBuild to think something is different and that the custom
15+
build rule needs to be invoked. For the script's part, nothing
16+
significant has changed, yet it post-processes the header files,
17+
causing their modification dates to change, causing downstream
18+
rebuilds to occur.
19+
20+
Fix this problem by adopting an approach that doesn't modify the
21+
post-processed header files unless their contents actually change.
22+
23+
* Scripts/GeneratePreferences.rb:
24+
125
2020-10-07 Devin Rousso <[email protected]>
226

327
Add missing `#define` for `PENCILKIT_TEXT_INPUT` flag

Source/WTF/Scripts/GeneratePreferences.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,19 @@ def initializeParsedPreferences(parsedPreferences)
214214
def renderTemplate(templateFile, outputDirectory)
215215
puts "Generating output for template file: #{templateFile}"
216216

217-
resultFile = File.basename(templateFile, ".erb")
217+
resultFile = File.join(outputDirectory, File.basename(templateFile, ".erb"))
218+
tempResultFile = resultFile + ".tmp"
218219

219220
output = ERB.new(File.read(templateFile), 0, "-").result(binding)
220-
File.open(File.join(outputDirectory, resultFile), "w+") do |f|
221+
File.open(tempResultFile, "w+") do |f|
221222
f.write(output)
222223
end
224+
if (!File.exist?(resultFile) || IO::read(resultFile) != IO::read(tempResultFile))
225+
FileUtils.move(tempResultFile, resultFile)
226+
else
227+
FileUtils.remove_file(tempResultFile)
228+
FileUtils.uptodate?(resultFile, [templateFile]) or FileUtils.touch(resultFile)
229+
end
223230
end
224231
end
225232

Source/WebKit/ChangeLog

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
2020-10-07 Keith Rollin <[email protected]>
2+
3+
Update post-processing rules for headers to not unnecessarily change timestamps
4+
https://bugs.webkit.org/show_bug.cgi?id=217371
5+
<rdar://problem/69992230>
6+
7+
Reviewed by Darin Adler.
8+
9+
Under XCBuild, the scripts employed in custom build rules can be
10+
invoked in innocuous situations. A common example is when the user is
11+
building from the command-line and they change the `make` output from
12+
stdout to a file, or vice-versa. Changing the output changes the
13+
setting of the COLOR_DIAGNOSTICS environment variable, which is enough
14+
to cause XCBuild to think something is different and that the custom
15+
build rule needs to be invoked. For the script's part, nothing
16+
significant has changed, yet it post-processes the header files,
17+
causing their modification dates to change, causing downstream
18+
rebuilds to occur.
19+
20+
Fix this problem by adopting an approach that doesn't modify the
21+
post-processed header files unless their contents actually change.
22+
23+
No new tests -- this is a build change only.
24+
25+
* Scripts/postprocess-header-rule:
26+
127
2020-10-07 Jiewen Tan <[email protected]>
228

329
[WebAuthn] Implement a dummy WebAuthenticationAgent

Source/WebKit/Scripts/postprocess-header-rule

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ function process_definitions () {
3939
}
4040

4141
function rewrite_headers () {
42-
ditto "${1}" "${2}"
42+
SOURCE_FILE="${1}"
43+
WORK_FILE="${2}.tmp"
44+
DEST_FILE="${2}"
4345

44-
if [[ ! -z `grep '#import <WebKitAdditions/.*\.h>' "${2}"` ]]; then
45-
python "${SRCROOT}/mac/replace-webkit-additions-includes.py" "${2}" "${BUILT_PRODUCTS_DIR}" "${SDKROOT}" || exit $?
46+
ditto "${SOURCE_FILE}" "${WORK_FILE}"
47+
48+
if [[ ! -z `grep '#import <WebKitAdditions/.*\.h>' "${WORK_FILE}"` ]]; then
49+
python "${SRCROOT}/mac/replace-webkit-additions-includes.py" "${WORK_FILE}" "${BUILT_PRODUCTS_DIR}" "${SDKROOT}" || exit $?
4650
fi
4751

4852
if [[ "${WK_FRAMEWORK_HEADER_POSTPROCESSING_DISABLED}" != "YES" ]]; then
@@ -75,16 +79,16 @@ function rewrite_headers () {
7579

7680
SED_OPTIONS+=(${OTHER_SED_OPTIONS[*]})
7781

78-
sed -i .tmp -E "${SED_OPTIONS[@]}" "${2}" || exit $?
82+
sed -i '' -E "${SED_OPTIONS[@]}" "${WORK_FILE}" || exit $?
7983
fi
8084

81-
HEADER_NAME=$(basename "${2}")
85+
HEADER_NAME=$(basename "${WORK_FILE}" '.tmp')
8286
if [[ "${HEADER_NAME}" == "WKBase.h" ]]; then
83-
unifdef -B -D__APPLE__ -UBUILDING_GTK__ -UBUILDING_WPE__ -UUSE_SOUP -o "${2}".unifdef "${2}"
87+
unifdef -B -D__APPLE__ -UBUILDING_GTK__ -UBUILDING_WPE__ -UUSE_SOUP -o "${WORK_FILE}".unifdef "${WORK_FILE}"
8488

8589
case $? in
86-
0) rm "${2}".unifdef ;;
87-
1) mv "${2}"{.unifdef,} ;;
90+
0) rm "${WORK_FILE}".unifdef ;;
91+
1) mv "${WORK_FILE}"{.unifdef,} ;;
8892
*) exit 1
8993
esac
9094
fi
@@ -96,14 +100,17 @@ function rewrite_headers () {
96100
UNIFDEF_OPTIONS="-DWK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED"
97101
fi
98102

99-
unifdef -B ${UNIFDEF_OPTIONS} -o "${2}".unifdef "${2}"
103+
unifdef -B ${UNIFDEF_OPTIONS} -o "${WORK_FILE}".unifdef "${WORK_FILE}"
100104

101105
case $? in
102-
0) rm "${2}".unifdef ;;
103-
1) mv "${2}"{.unifdef,} ;;
106+
0) rm "${WORK_FILE}".unifdef ;;
107+
1) mv "${WORK_FILE}"{.unifdef,} ;;
104108
*) exit 1
105109
esac
106110
fi
111+
112+
cmp -s "${WORK_FILE}" "${DEST_FILE}" && rm -f "${WORK_FILE}" || mv "${WORK_FILE}" "${DEST_FILE}"
113+
[[ "${SOURCE_FILE}" -nt "${DEST_FILE}" ]] && touch "${DEST_FILE}" || true
107114
}
108115

109116
DEFINITIONS_PATH=usr/local/include/WebKitAdditions/Scripts/postprocess-framework-headers-definitions

0 commit comments

Comments
 (0)