Bug 196173 - Need a way to include WebKitAdditions code in WebKit API headers
Summary: Need a way to include WebKitAdditions code in WebKit API headers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: DoNotImportToRadar
Depends on:
Blocks: 196284
  Show dependency treegraph
 
Reported: 2019-03-22 23:54 PDT by Wenson Hsieh
Modified: 2019-03-29 15:27 PDT (History)
6 users (show)

See Also:


Attachments
There has got to be a better way :( (3.08 KB, patch)
2019-03-23 00:01 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Patch (6.90 KB, patch)
2019-03-23 16:25 PDT, Wenson Hsieh
thorton: review+
Details | Formatted Diff | Diff
Patch for landing (7.07 KB, patch)
2019-03-27 15:50 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>