Skip to content

Commit

Permalink
[Xcode] WK_WORKSPACE_DIR build setting computed incorrectly when WebK…
Browse files Browse the repository at this point in the history
…it is checked out in a directory named "Source"

rdar://128549939
https://bugs.webkit.org/show_bug.cgi?id=274534

Reviewed by Alexey Proskuryakov.

WK_WORKSPACE_DIR is computed by walking up the file hierarchy and
looking for a "Source" or "Tools" directory to indicate that the next
parent is the root directory of the repo. But it doesn't terminate when
it finds a match. So, if there is a "Source" or "Tools" directory above
the repo, it may be found and screw up the definition of
WK_WORKSPACE_DIR. For example, if WebKit is checked out at
/Users/emw/Source/WebKit, we end up with:

    WK_WORKSPACE_DIR=/Users/emw/Source/WebKit/Users/emw

In the public build, this manifests as a failure to find the correct
additions SDK inside $(WK_WORKSPACE_DIR)/WebKitLibraries/SDKs/.

Fix by rewriting the WK_WORKSPACE_DIR declaration to use ":default",
such that parent directories will only be considered if a child
directory did not match.

* Configurations/WebKitProjectPaths.xcconfig:

Canonical link: https://commits.webkit.org/279224@main
  • Loading branch information
emw-apple committed May 23, 2024
1 parent ed0a8af commit d67f50b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Configurations/WebKitProjectPaths.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH = $(BUILT_PRODUCTS_DIR)$(WK_LIBRARY_HEADE
WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH[config=Production] = $(SDK_DIR)$(WK_LIBRARY_HEADERS_FOLDER_PATH)/WebKitAdditions;

// The root directory of the workspace / WebKit repo is determined by how many directories up "Source" or "Tools" is from the SRCROOT.
WK_WORKSPACE_DIR = $(WK_WORKSPACE_DIR_1_$(SRCROOT:dir:standardizepath:file):standardizepath)$(WK_WORKSPACE_DIR_2_$(SRCROOT:dir:standardizepath:dir:standardizepath:file):standardizepath)$(WK_WORKSPACE_DIR_3_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath)$(WK_WORKSPACE_DIR_4_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath)$(WK_WORKSPACE_DIR_5_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath)$(WK_WORKSPACE_DIR_6_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath);
WK_WORKSPACE_DIR = $(WK_WORKSPACE_DIR_1_$(SRCROOT:dir:standardizepath:file):standardizepath:default=$(WK_WORKSPACE_DIR_2_$(SRCROOT:dir:standardizepath:dir:standardizepath:file):standardizepath:default=$(WK_WORKSPACE_DIR_3_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath:default=$(WK_WORKSPACE_DIR_4_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath:default=$(WK_WORKSPACE_DIR_5_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath:default=$(WK_WORKSPACE_DIR_6_$(SRCROOT:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:dir:standardizepath:file):standardizepath))))));
WK_WORKSPACE_DIR_1_Source = $(SRCROOT)/../..;
WK_WORKSPACE_DIR_1_Tools = $(SRCROOT)/../..;
WK_WORKSPACE_DIR_2_Source = $(SRCROOT)/../../..;
Expand Down

0 comments on commit d67f50b

Please sign in to comment.