[webkit-dev] OK to flatten WTF's header directory?

Elliott Williams emw at apple.com
Thu Feb 3 17:16:58 PST 2022


Thanks for the detailed response! I should be clear that I don’t have a strong opinion for or against flattened headers, I’m just interested in ironing out a perceived inconsistency.

> On Feb 3, 2022, at 15:31, Darin Adler <darin at apple.com> wrote:
> 
> Long ago, I originally created the forwarding headers to bridge the gap between framework-style includes that those of us at Apple wanted to do, where headers are flattened and you write #include <FrameworkName/HeaderName.h>, and Unix-style installed libraries, where things are not flattened. I wanted us to be able to write include statements in WebKit in the traditional non-Apple-framework style so they would work on those other platforms, and the forwarding headers were originally just for the Apple platforms, making those includes work with the framework structure provided automatically by the Apple framework build system.

IIUC, what we have today is the opposite situation. JavaScriptCore, WebCore, et al. have flattened headers, and it’s the _other platforms_ whose build systems do extra work to accommodate flattened includes. WTF and PAL are the exceptions.

> This proposal, to flatten the WTF headers, seems to be a step in of the opposite direction, making the non-Apple platforms do something akin to framework-style including. Not sure I understand the pros and cons are of that.

The factors motivating me are…

- Consistency with other targets: It’s not clear to me why JSC and WebCore have flattened their headers but WTF hasn’t.
- Pleasing Xcode’s build system, which _really_ wants a target’s headers to always be copied to the same directory. Right now, WTF hacks around this by using an rsync script to copy its headers because Xcode’s native copy files phase doesn’t provide enough flexibility.

Build system limitations shouldn’t influence ergonomic decisions, so perhaps you should disregard the latter.

> I am currently suffering when working on WebKit development because of the copies of headers made by the build system. I can’t count the number of times I’ve edited a WTF header and then later realized I had edited the copy, not the original. I would very much like a solution that resolved that problem. I use Xcode features, and it seems the copies are what Xcode thinks are the “real” headers.

If what you’ve experienced is unique to WTF, I’d be suspicious of the non-standard approach we’ve taken to copying WTF’s headers I mentioned above.



More information about the webkit-dev mailing list