⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243569 in webkit


Ignore:
Timestamp:
Mar 27, 2019, 4:34:04 PM (7 years ago)
Author:
Wenson Hsieh
Message:

Need a way to include WebKitAdditions code in WebKit API headers
https://bugs.webkit.org/show_bug.cgi?id=196173

Reviewed by Tim Horton.

Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
using #imports of the form:

`
#if USE(APPLE_INTERNAL_SDK)
#import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
#endif
`

The resulting header in the built products directory will contain the contents of the imported file inserted in
place of the #if USE(APPLE_INTERNAL_SDK) … #endif block; however, when building with the Apple internal SDK,
the additions header content will be imported by the usual means.

  • mac/postprocess-framework-headers.sh:
  • mac/replace-webkit-additions-includes.py: Added.

Add a step when post-processing framework headers to replace instances of #if USE(APPLE_INTERNAL_SDK) … #endif
with the text content of the additions files. The replacement script first searches in the built products
directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.

(read_content_from_webkit_additions):
(main):

Location:
trunk/Source/WebKit
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243567 r243569  
     12019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Need a way to include WebKitAdditions code in WebKit API headers
     4        https://bugs.webkit.org/show_bug.cgi?id=196173
     5
     6        Reviewed by Tim Horton.
     7
     8        Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
     9        using `#import`s of the form:
     10
     11        ```
     12        #if USE(APPLE_INTERNAL_SDK)
     13        #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
     14        #endif
     15        ```
     16
     17        The resulting header in the built products directory will contain the contents of the imported file inserted in
     18        place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
     19        the additions header content will be imported by the usual means.
     20
     21        * mac/postprocess-framework-headers.sh:
     22        * mac/replace-webkit-additions-includes.py: Added.
     23
     24        Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
     25        with the text content of the additions files. The replacement script first searches in the built products
     26        directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
     27        are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
     28
     29        (read_content_from_webkit_additions):
     30        (main):
     31
    1322019-03-27  Andy Estes  <aestes@apple.com>
    233
  • trunk/Source/WebKit/mac/postprocess-framework-headers.sh

    r229958 r243569  
    4949}
    5050
     51function replace_webkit_additions_includes () {
     52    if [[ -z `grep '#import <WebKitAdditions/.*\.h>' "${1}"` ]]; then
     53        return 0
     54    fi
     55    python "$(dirname $0)/replace-webkit-additions-includes.py" "${1}" "${BUILT_PRODUCTS_DIR}" "${SDKROOT}"
     56    return $?
     57}
     58
    5159function rewrite_headers () {
    5260    if [[ "${WK_PLATFORM_NAME}" == "macosx" ]]; then
     
    8290        if [[ "$HEADER_PATH" -nt $TIMESTAMP_PATH ]]; then
    8391            ditto "${HEADER_PATH}" "${TARGET_TEMP_DIR}/${HEADER_PATH##*/}"
     92            replace_webkit_additions_includes "${TARGET_TEMP_DIR}/${HEADER_PATH##*/}"
    8493            sed -i .tmp -E "${SED_OPTIONS[@]}" "${TARGET_TEMP_DIR}/${HEADER_PATH##*/}" || exit $?
    8594            mv "${TARGET_TEMP_DIR}/${HEADER_PATH##*/}" "$HEADER_PATH"
Note: See TracChangeset for help on using the changeset viewer.