Bug 215439 - Remove the need for defining USE_NEW_BUILD_SYSTEM
Summary: Remove the need for defining USE_NEW_BUILD_SYSTEM
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: Keith Rollin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-12 21:18 PDT by Keith Rollin
Modified: 2020-08-12 23:09 PDT (History)
4 users (show)

See Also:


Attachments
Patch (38.99 KB, patch)
2020-08-12 21:56 PDT, Keith Rollin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Rollin 2020-08-12 21:18:28 PDT
When building WebKit for XCBuild, we currently require that the external build system (such as the Makefile, build-webkit, etc.) defines the USE_NEW_BUILD_SYSTEM=YES build setting. This build setting controls parts of our build instructions that are sensitive to when XCBuild or the Legacy build system are being used. Notably, we need to know when to use our custom “copy and modify” scripts with copying certain header files (used with the Legacy build system) vs. using the enhanced Copy Headers build phase that’s enabled with APPLY_RULES_IN_COPY_HEADERS=YES (introduced with and used by XCBuild). The choice of which method to copy headers is used is controlled by USE_NEW_BUILD_SYSTEM.

There is no built-in build setting that we can probe to help us determine which approach to take when copying and modifying headers, which is why we need to define USE_NEW_BUILD_SYSTEM ourselves. But it turns out that we can *detect* which build system is being used by taking advantage of a subtle difference between the two systems. As noted in:

https://developer.apple.com/documentation/xcode-release-notes/build-system-release-notes-for-xcode-10

“When an .xcconfig file contains multiple assignments of the same build setting, later assignments using $(inherited) or $(<setting_name>) will inherit from earlier assignments in the .xcconfig. The legacy build system caused every use of $(inherited) or $(<setting_name>) skip any other values defined within the .xcconfig. To detect whether your .xcconfig is affected by this improvement, run defaults write com.apple.dt.XCBuild EnableCompatibilityWarningsForXCBuildTransition -bool YES in Terminal to cause Xcode to generate a warning about this situation. (40283621)”

This difference can be exploited as follows:

WK_WHICH_BUILD_SYSTEM = not_
WK_WHICH_BUILD_SYSTEM = $(inherited)legacy
WK_USE_NEW_BUILD_SYSTEM = $(WK_USE_NEW_BUILD_SYSTEM_$(WK_WHICH_BUILD_SYSTEM))
WK_USE_NEW_BUILD_SYSTEM_legacy = NO
WK_USE_NEW_BUILD_SYSTEM_not_legacy = YES

We can then use WK_USE_NEW_BUILD_SYSTEM where we used to use the externally-defined USE_NEW_BUILD_SYSTEM.

--

<rdar://problem/66937583>
Comment 1 Keith Rollin 2020-08-12 21:56:24 PDT
Created attachment 406496 [details]
Patch
Comment 2 EWS 2020-08-12 23:09:34 PDT
Committed r265602: <https://trac.webkit.org/changeset/265602>

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