Bug 196173

Summary: Need a way to include WebKitAdditions code in WebKit API headers
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: WebKit APIAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bdakin, commit-queue, mitz, thorton, webkit-bug-importer
Priority: P2 Keywords: DoNotImportToRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 196284    
Attachments:
Description Flags
There has got to be a better way :(
none
Patch
thorton: review+
Patch for landing none

Description Wenson Hsieh 2019-03-22 23:54:52 PDT
SSIA
Comment 1 Wenson Hsieh 2019-03-23 00:01:46 PDT
Created attachment 365804 [details]
There has got to be a better way :(
Comment 2 Wenson Hsieh 2019-03-23 00:03:48 PDT
Work towards: <rdar://problem/47228232>
Comment 3 Wenson Hsieh 2019-03-23 16:25:26 PDT
Created attachment 365820 [details]
Patch
Comment 4 Wenson Hsieh 2019-03-23 16:38:25 PDT
This approach, while hacky, should at least fulfill these requirements:
- When building with a non-internal SDK, we don't produce framework headers with invalid content (e.g. #if USE(APPLE_INTERNAL_SDK)).
- When building with an internal SDK, we produce framework headers that contain the internal bits from WebKitAdditions.
- When building with an internal SDK, the symbols defined in the WebKitAdditions pieces can be referenced in implementation files.
Comment 5 Tim Horton 2019-03-27 11:21:40 PDT
Comment on attachment 365820 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=365820&action=review

This is 😡 but OK. For now.

> Source/WebKit/mac/replace-webkit-additions-includes.py:35
> +        file_in_build_directory = open("%s/%s" % (built_products_directory, additions_path), "r")

os.path.join (in a bunch of places)

> Source/WebKit/mac/replace-webkit-additions-includes.py:75
> +                print "(%s): failed to write to file: %s" % (argv[0], header_path)

print as a function? what happens with python3? do we care? I don't know?
Comment 6 Wenson Hsieh 2019-03-27 14:20:47 PDT
Comment on attachment 365820 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=365820&action=review

>> Source/WebKit/mac/replace-webkit-additions-includes.py:35
>> +        file_in_build_directory = open("%s/%s" % (built_products_directory, additions_path), "r")
> 
> os.path.join (in a bunch of places)

👍🏻

> Source/WebKit/mac/replace-webkit-additions-includes.py:50
> +    header_path = argv[1]
> +    built_products_directory = argv[2]
> +    sdk_root_directory = argv[3]

I also added sanity checks here to return early and print usage if the wrong number of arguments is supplied.

>> Source/WebKit/mac/replace-webkit-additions-includes.py:75
>> +                print "(%s): failed to write to file: %s" % (argv[0], header_path)
> 
> print as a function? what happens with python3? do we care? I don't know?

Good catch, we should be compatible with python3!

I ran this with `/usr/bin/env python3` for good measure, and verified that everything behaves as expected.
Comment 7 Wenson Hsieh 2019-03-27 15:50:32 PDT
Created attachment 366117 [details]
Patch for landing
Comment 8 WebKit Commit Bot 2019-03-27 16:34:15 PDT
Comment on attachment 366117 [details]
Patch for landing

Clearing flags on attachment: 366117

Committed r243569: <https://trac.webkit.org/changeset/243569>