Skip to content

Commit

Permalink
[Xcode] Add timestamp outputs for verifier script phases
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=261229
rdar://115076525

Reviewed by Alexey Proskuryakov.

This prevents them from re-running on every build, and from causing
module verification to re-run on every build.

Additionally, fix up some input dependencies to these scripts. "Check
For Framework Include Consistency" and "Check For Inappropriate Macros
in External Headers" should only re-run when headers change, so have
them depend on the all-product-headers.yaml VFS file generated by Xcode.

Where possible, move "Check For Inappropriate Files In Framework" phases
to run *outside* of its framework target. This script looks for
arbitrary files in the framework bundle, including those not tracked by
the build system. As a result, it's not possible to express input
dependencies, and continuing to run it as part of the framework build
causes the module verifier to re-run needlessly (XCBuild conservatively
assumes that any script phase without outputs declared may be modifying
framework headers).

* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj:
* Tools/Scripts/check-for-inappropriate-macros-in-external-headers:
* Tools/Scripts/check-for-webkit-framework-include-consistency:

Canonical link: https://commits.webkit.org/267740@main
  • Loading branch information
emw-apple committed Sep 7, 2023
1 parent 99c5b71 commit c57c928
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 43 deletions.
43 changes: 23 additions & 20 deletions Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
buildPhases = (
5DF7E1CC188E6B87003F9A46 /* Copy jsc into JavaScriptCore.framework */,
539966E3237CD6740033B0D2 /* Create Versions/Current/Helpers symlink */,
DDFA47232AA93E1D00C7C788 /* Check For Inappropriate Files In Framework */,
);
dependencies = (
932F5BE70822A1C700736975 /* PBXTargetDependency */,
Expand Down Expand Up @@ -12074,7 +12075,6 @@
932F5BD20822A1C700736975 /* Frameworks */,
5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */,
3713F014142905240036387F /* Check For Inappropriate Objective-C Class Names */,
532424B0254905D900A6975B /* Check For Inappropriate Files In Framework */,
A55DEAA416703DF7003DB841 /* Check For Inappropriate Macros in External Headers */,
1A02D9A81B34A882000D1522 /* Add Symlink in /System/Library/PrivateFrameworks */,
53609F9021DFFA9C008FA60A /* Check .xcfilelists */,
Expand Down Expand Up @@ -12224,29 +12224,12 @@
);
name = "Check For Inappropriate Objective-C Class Names";
outputPaths = (
"$(TARGET_TEMP_DIR)/check-for-inappropriate-objc-class-names.timestamp",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nif [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-objc-class-names ]; then\n ../../Tools/Scripts/check-for-inappropriate-objc-class-names JS WTF\nfi\n";
};
532424B0254905D900A6975B /* Check For Inappropriate Files In Framework */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Check For Inappropriate Files In Framework";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n";
};
5325BDC521DFF2BA00A0DEE1 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -12434,10 +12417,11 @@
files = (
);
inputPaths = (
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
"$(CPP_HEADERMAP_PRODUCT_HEADERS_VFS_FILE)",
);
name = "Check For Inappropriate Macros in External Headers";
outputPaths = (
"$(TARGET_TEMP_DIR)/check-for-inappropriate-macros-in-external-headers.timestamp",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -12484,6 +12468,25 @@
shellPath = /bin/sh;
shellScript = "rm -vf \"${OBJROOT}/EagerLinkingTBDs/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/${CONTENTS_FOLDER_PATH}/${EXECUTABLE_PREFIX}${PRODUCT_NAME}${EXECUTABLE_VARIANT_SUFFIX}.tbd\" &&\ntouch \"${SCRIPT_OUTPUT_FILE_0}\"\n";
};
DDFA47232AA93E1D00C7C788 /* Check For Inappropriate Files In Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Check For Inappropriate Files In Framework";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n export PRODUCT_NAME=JavaScriptCore\n if [ -z \"${WK_FRAMEWORK_VERSION_PREFIX}\" ]; then\n export SHALLOW_BUNDLE=YES\n fi\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n";
};
E1AC2E2C20F7B95800B0897D /* Unlock Keychain */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42506,19 +42506,18 @@
};
5DF50887116F3077005202AB /* Check For Inappropriate Files In Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
);
name = "Check For Inappropriate Files In Framework";
outputPaths = (
"$(TARGET_TEMP_DIR)/CheckForInappropriateFilesInFramework.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n\ntouch \"${TARGET_TEMP_DIR}/CheckForInappropriateFilesInFramework.txt\"\n";
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n";
};
6577FFC7276AC9AD0011AEC8 /* Create Symlink to Alt Root Path */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
43 changes: 25 additions & 18 deletions Source/WebKit/WebKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
buildConfigurationList = 1A50DB48110A3C27000D3FE5 /* Build configuration list for PBXAggregateTarget "Framework, XPC Services, and daemons" */;
buildPhases = (
BCFFCA8A160D6DEA003DF315 /* Add XPCServices symlink */,
DDFA47222AA93C7F00C7C788 /* Check For Inappropriate Files In Framework */,
);
dependencies = (
517B5F6D275B07C3002DC22D /* PBXTargetDependency */,
Expand Down Expand Up @@ -15830,7 +15831,6 @@
5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */,
3713F0231429063D0036387F /* Check For Inappropriate Objective-C Class Names */,
5DF408C6131DD49700130071 /* Check For Framework Include Consistency */,
5DF408D1131DDBEC00130071 /* Check For Inappropriate Files In Framework */,
A55DEAA61670402E003DB841 /* Check For Inappropriate Macros in External Headers */,
1A2180161B5454620046AEC4 /* Add Symlink in /System/Library/PrivateFrameworks */,
5379C7AC21E5288500E4A8F6 /* Check .xcfilelists */,
Expand Down Expand Up @@ -16193,6 +16193,7 @@
);
name = "Check For Inappropriate Objective-C Class Names";
outputPaths = (
"$(TARGET_TEMP_DIR)/check-for-inappropriate-objc-class-names.timestamp",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -16475,30 +16476,16 @@
files = (
);
inputPaths = (
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
"$(CPP_HEADERMAP_PRODUCT_HEADERS_VFS_FILE)",
);
name = "Check For Framework Include Consistency";
outputPaths = (
"$(TARGET_TEMP_DIR)/check-for-webkit-framework-include-consistency.timestamp",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-webkit-framework-include-consistency ]; then\n ../../Tools/Scripts/check-for-webkit-framework-include-consistency || exit $?\nfi\n";
};
5DF408D1131DDBEC00130071 /* Check For Inappropriate Files In Framework */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
);
name = "Check For Inappropriate Files In Framework";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n";
};
6508960F28482C6A00A91844 /* Copy launchd plist and create symlink */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 8;
Expand Down Expand Up @@ -16832,10 +16819,11 @@
files = (
);
inputPaths = (
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
"$(CPP_HEADERMAP_PRODUCT_HEADERS_VFS_FILE)",
);
name = "Check For Inappropriate Macros in External Headers";
outputPaths = (
"$(TARGET_TEMP_DIR)/check-for-inappropriate-macros-in-external-headers.timestamp",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -16919,6 +16907,25 @@
shellPath = /bin/sh;
shellScript = "\"${SCRIPT_INPUT_FILE_0}\"\n";
};
DDFA47222AA93C7F00C7C788 /* Check For Inappropriate Files In Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Check For Inappropriate Files In Framework";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n export PRODUCT_NAME=WebKit\n if [ -z \"${WK_FRAMEWORK_VERSION_PREFIX}\" ]; then\n export SHALLOW_BUNDLE=YES\n fi\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n";
};
E1AC2E2C20F7B95800B0897D /* Unlock Keychain */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
6 changes: 4 additions & 2 deletions Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3196,13 +3196,15 @@
);
name = "Check For Inappropriate Objective-C Class Names";
outputPaths = (
"$(TARGET_TEMP_DIR)/check-for-inappropriate-objc-class-names.timestamp",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-objc-class-names ]; then\n ../../Tools/Scripts/check-for-inappropriate-objc-class-names DOM Web _Web || exit $?\nfi";
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-objc-class-names ]; then\n ../../Tools/Scripts/check-for-inappropriate-objc-class-names DOM Web _Web || exit $?\nfi\n";
};
532424B1254905FE00A6975B /* Check For Inappropriate Files In Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -3217,7 +3219,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\n# For a while, these files were incorrectly included in the builds (see\n# https://bugs.webkit.org/show_bug.cgi?id=218268). Manually delete them\n# from anyone's build directory so that the check performed by\n# check-for-inappropriate-files-in-framework won't fail. This step can be\n# removed after a reasonable amount of time has passed and we can assume\n# everyone's performed a clean build by now.\n\nFRAMEWORK_DIR=\"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.framework\"\nRESOURCES_DIR=\"${FRAMEWORK_DIR}/Resources\"\n\nrm -f \"${RESOURCES_DIR}/Sources.txt\"\nrm -f \"${RESOURCES_DIR}/SourcesCocoa.txt\"\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n\nexit 0\n";
shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ] || [ \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-files-in-framework ]; then\n ../../Tools/Scripts/check-for-inappropriate-files-in-framework || exit $?\nfi\n\nexit 0\n";
};
537CF83A22EFBFB100C6EBB3 /* Check .xcfilelists */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env ruby

require 'fileutils'

# Copyright (C) 2012 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -75,3 +77,4 @@ ARGV.each do |path|
end

exit 1 if $error_printed
FileUtils.touch "#{ENV['TARGET_TEMP_DIR']}/#{File.basename($0)}.timestamp"
4 changes: 4 additions & 0 deletions Tools/Scripts/check-for-webkit-framework-include-consistency
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env ruby

require 'fileutils'

# Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -107,3 +109,5 @@ $HEADERS_BY_TYPE.each do |header_type, headers|
end

exit 1 if $error_printed

FileUtils.touch "#{ENV['TARGET_TEMP_DIR']}/#{File.basename($0)}.timestamp"

0 comments on commit c57c928

Please sign in to comment.