Bug 238384 - [Big Sur] WK2 failing to build with `error: reference to 'WebDocumentView' is ambiguous`
Summary: [Big Sur] WK2 failing to build with `error: reference to 'WebDocumentView' is...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Elliott Williams
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-25 10:30 PDT by Elliott Williams
Modified: 2022-03-25 21:46 PDT (History)
2 users (show)

See Also:


Attachments
Patch (5.88 KB, patch)
2022-03-25 10:48 PDT, Elliott Williams
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Williams 2022-03-25 10:30:17 PDT
Since r291809, it's possible to import the same header from two different paths: once from its original source location and once from the SDK or build products, causing build failures due to duplicate types.

This is because of WebKit's autogenerated headermap. It resolves migrated headers to the source locations IF they are imported through the <WebKit/…> prefix. If they are imported from <WebKitLegacy/…>, the headermap has no entry and they are resolved using normal search paths. Prior to r291809, migrated headers were never added to any headermaps, because they were produced by Make and Xcode was unaware of them.
Comment 1 Radar WebKit Bug Importer 2022-03-25 10:31:01 PDT
<rdar://problem/90844690>
Comment 2 Elliott Williams 2022-03-25 10:48:04 PDT
Created attachment 455783 [details]
Patch
Comment 3 Elliott Williams 2022-03-25 10:51:19 PDT
Comment on attachment 455783 [details]
Patch

Since the build rule script changes are hard to read, here they are expanded:

    +set -e
     if [ "${WK_PLATFORM_NAME}" != macosx ]; then
         echo "#import <WebKitLegacy/${INPUT_FILE_NAME}>" > "${SCRIPT_OUTPUT_FILE_0}"
     else
         "${SCRIPT_INPUT_FILE_0}"
     fi
    +echo "#import <WebKit/${INPUT_FILE_NAME}>" > "${SCRIPT_OUTPUT_FILE_1}"
    +echo "#import <WebKit/${INPUT_FILE_NAME}>" > "${SCRIPT_OUTPUT_FILE_2}"

There are now two build rules, because any source file migrated from WebCore need special treatment. Since they've been migrated twice, they have two valid imports, <WebCore/foo> and <WebKitLegacy/foo>, that should be forwarded to <WebKit/foo>.
Comment 4 EWS 2022-03-25 15:56:24 PDT
Committed r291900 (248893@main): <https://commits.webkit.org/248893@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 455783 [details].