Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 22027c3bc06fd3fbe4caf05651c03aa2071a5a9b
      
https://github.com/WebKit/WebKit/commit/22027c3bc06fd3fbe4caf05651c03aa2071a5a9b
  Author: Elliott Williams <[email protected]>
  Date:   2026-02-25 (Wed, 25 Feb 2026)

  Changed paths:
    M Tools/Scripts/libraries/webkitapipy/webkitapipy/allow.py
    M Tools/Scripts/libraries/webkitapipy/webkitapipy/allow_unittest.py
    M Tools/Scripts/libraries/webkitapipy/webkitapipy/macho.py
    M Tools/Scripts/libraries/webkitapipy/webkitapipy/program.py
    M Tools/Scripts/libraries/webkitapipy/webkitapipy/sdkdb.py
    M Tools/Scripts/libraries/webkitapipy/webkitapipy/sdkdb_unittest.py

  Log Message:
  -----------
  [webkitapipy] Support conditional allowlist entries based on OS / SDK version
https://bugs.webkit.org/show_bug.cgi?id=302293
rdar://164435576

Reviewed by Sam Sneddon. Reland of 308228@main with accidental allowlist
code changes (from a forthcoming PR) removed.

There are some cases where a more general OS or SDK version check is
superior to conditionalizing an allowlist entry based on a
wtf/Platform.h flag:

- Staged API adoption is based on forward-declaring API that has yet to
  appear in the builds of the SDK. Until it does, it will look like SPI
  to the tool. But its usability (and whether or not it is API) is not based
  on a WebKit feature flag, it's based on the SDK vesrion.

- API from frameworks that WebKit builds with internally (such as
  AuthenticationServices.framework) may have already shipped in new
  SDKs, but when building against older SDKs appears as SPI. Again, the
  SDK is what determines whether the usage looks like SPI.

To support these use cases, add optional "request-os" and "requires-sdk" version
requirement keys to the allowlist format. Each is a list of strings with
the form "<platform> <operator> <version>". For example:

    [[staging]]
    classes = [MyNewClass]
    requires = [ENABLE_MY_NEW_FEATURE]
    requires-sdk = ["iOS < 26.2"]

Special wildcard syntactic sugar is available for the purpose of
avoiding writing a misleading marketing version. A requirement like:

    iOS < 26.0

may be written as:

    iOS <= 25.*

At parse time the wildcard expression is transformed into its logical
equivalent.

In the SDKDB cache, this is implemented by extending the existing
"conditional chain" mechanism used for Platform flags. Conditionals now
have a value (WTF-style defines are all value "1"), and each link in the
chain has an associated operator.

* Tools/Scripts/libraries/webkitapipy/webkitapipy/allow.py:
(AllowedSPI):
(AllowedSPI.RequiredVersion):
(_transform_wildcard_version):
(AllowList.from_dict):

* Tools/Scripts/libraries/webkitapipy/webkitapipy/allow_unittest.py:
(TestAllowList.test_repeated_requirements):
(TestAllowList.test_no_string):
(TestAllowList):
(TestAllowList.test_invalid_version_requirements):
(TestAllowList.test_required_fields):

(TestAllowList.test_wildcard_version):
* Tools/Scripts/libraries/webkitapipy/webkitapipy/macho.py: Read the
  platform and versions from each binary's Mach-O header.
(APIReport):
(APIReport.from_binary):
(APIReport._from_dyld_info):
(APIReport._populate_from_dyld_info):
* Tools/Scripts/libraries/webkitapipy/webkitapipy/program.py:
* Tools/Scripts/libraries/webkitapipy/webkitapipy/sdkdb.py:
(apply_operator_sql):
(semver_to_int): Used to store version numbers as 6-digit integers, for
  easy comparison, similar to what OS headers do.
(SDKDB._initialize_db):
(SDKDB._initialize_temporary_schema):
(SDKDB._add_allowlist):
(SDKDB.add_conditions): New entrypoint for add_defines which takes
  key-value pairs instead of just keys.
(SDKDB._add_imports):
(SDKDB.audit):
(SDKDB.add_defines): Deleted.

* Tools/Scripts/libraries/webkitapipy/webkitapipy/sdkdb_unittest.py:
(TestSDKDB.test_entries_removed_when_binary_updated):
(TestSDKDB.test_audit_allowed_conditional):
(TestSDKDB.test_audit_missing_name_conditional):
(TestSDKDB.test_audit_missing_name_negated_conditional):
(TestSDKDB.test_audit_allowed_negated_conditional):
(TestSDKDB.test_audit_allowed_multiple_conditions):
(TestSDKDB.test_audit_missing_name_multiple_conditions):
(TestSDKDB.test_audit_missing_name_multiple_conditions_negation):
(TestSDKDB):
(TestSDKDB.test_audit_minos_conditions):
(TestSDKDB.test_audit_api_in_loaded_and_unloaded_library):
(TestSDKDB.test_audit_allow_different_fully_qualified_methods_same_name):
(TestSDKDB.test_audit_unnecessary_allow_unqualified_methods_same_name):

Canonical link: https://commits.webkit.org/308247@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to