Skip to content
Permalink
Browse files
Do WebKitAdditions header replacement only when a specific environmen…
…t variable is set

https://bugs.webkit.org/show_bug.cgi?id=240210
<rdar://92885915>

Reviewed by Tim Horton.

* Source/WebKit/Configurations/WebKit.xcconfig:
* Source/WebKit/mac/replace-webkit-additions-includes.py:
(check_should_do_replacement):
(main):
(is_supported_os): Deleted.

Canonical link: https://commits.webkit.org/250400@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed May 8, 2022
1 parent 80a54d2 commit 64cdede660d9eaea128fd151281f4715851c4fe2
Showing with 5 additions and 20 deletions.
  1. +1 −0 Source/WebKit/Configurations/WebKit.xcconfig
  2. +4 −20 Source/WebKit/mac/replace-webkit-additions-includes.py
@@ -23,6 +23,7 @@

#include "BaseTarget.xcconfig"
#include "WebKitTargetConditionals.xcconfig"
#include? "<DEVELOPER_DIR>/AppleInternal/XcodeConfig/AppleFeatures.xcconfig"

PRODUCT_NAME = WebKit;
PRODUCT_BUNDLE_IDENTIFIER = com.apple.$(PRODUCT_NAME:rfc1034identifier);
@@ -42,24 +42,9 @@ def read_content_from_webkit_additions(built_products_directory, sdk_root_direct
return ""


def is_supported_os():
os_version_string = os.environ.get("MACOSX_DEPLOYMENT_TARGET")
if os_version_string is not None:
os_version = float('.'.join(os_version_string.split('.')[:2]))
return os_version >= 13.0
os_version_string = os.environ.get("IPHONEOS_DEPLOYMENT_TARGET")
if os_version_string is not None:
os_version = float('.'.join(os_version_string.split('.')[:2]))
return os_version >= 16.0
os_version_string = os.environ.get("WATCHOS_DEPLOYMENT_TARGET")
if os_version_string is not None:
os_version = float('.'.join(os_version_string.split('.')[:2]))
return os_version >= 9.0
os_version_string = os.environ.get("TVOS_DEPLOYMENT_TARGET")
if os_version_string is not None:
os_version = float('.'.join(os_version_string.split('.')[:2]))
return os_version >= 16.0
return True
def check_should_do_replacement(built_products_directory, sdk_root_directory):
feature_name = read_content_from_webkit_additions(built_products_directory, sdk_root_directory, 'FeatureNeededForHeaderReplacement').strip()
return os.environ.get(feature_name) == '1'


def main(argv=None):
@@ -81,8 +66,7 @@ def main(argv=None):
print("(%s): SDK root directory unspecified" % argv[0], file=sys.stderr)
return 1

# We currently only support WebKitAdditions in Framework headers on macOS 13+ and iOS 16+.
should_do_replacement = is_supported_os()
should_do_replacement = check_should_do_replacement(built_products_directory, sdk_root_directory)

additions_import_pattern = re.compile(r"\#if 0 // API_WEBKIT_ADDITIONS_REPLACEMENT\n#import <WebKitAdditions/(.*)>\n#endif")
header_contents = sys.stdin.read()

0 comments on commit 64cdede

Please sign in to comment.