Skip to content

Commit

Permalink
The --export-compile-commands option for build-webkit is broken.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264239

Reviewed by Elliott Williams.

The build-webkit with --export-compile-commands on macOS does not produce
compile_commands.json. In bug 235686 [1], we added the support of exporting
compile_commands.json to the make build. This change brings the same
support into the build-webkit script.

[1] https://webkit.org/b/235686

* Tools/Scripts/build-webkit:
* Tools/Scripts/webkitdirs.pm:
(XcodeExportCompileCommandsOptions):
* Tools/Scripts/webkitperl/BuildSubproject.pm:

Canonical link: https://commits.webkit.org/270348@main
  • Loading branch information
shivamidow committed Nov 7, 2023
1 parent 52bceb7 commit 0579d0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tools/Scripts/build-webkit
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ if (isWinCairo() || isPlayStation()) {
push @local_options, XcodeCoverageSupportOptions() if $coverageSupport;
push @local_options, XcodeStaticAnalyzerOption() if $shouldRunStaticAnalyzer;
push @local_options, "WK_LTO_MODE=$ltoMode" if ($ltoMode ne "default");
push @local_options, XcodeExportCompileCommandsOptions() if $exportCompileCommands;
# FIXME: Move this setting to xcconfigs once all local Xcode builds of WebKit
# happen in the workspace. When this is only passed on the command line, it
# invalidates build results made in the IDE (rdar://88135402).
Expand Down
6 changes: 6 additions & 0 deletions Tools/Scripts/webkitdirs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ BEGIN {
@ISA = qw(Exporter);
@EXPORT = qw(
&XcodeCoverageSupportOptions
&XcodeExportCompileCommandsOptions
&XcodeOptionString
&XcodeOptionStringNoConfig
&XcodeOptions
Expand Down Expand Up @@ -1294,6 +1295,11 @@ sub XcodeCoverageSupportOptions()
return ("-xcconfig", sourceDir() . "/Tools/coverage/coverage.xcconfig");
}

sub XcodeExportCompileCommandsOptions()
{
return ("OTHER_CFLAGS=\$(inherited) -gen-cdb-fragment-path \$(BUILT_PRODUCTS_DIR)/compile_commands", "GCC_PRECOMPILE_PREFIX_HEADER=NO", "CLANG_ENABLE_MODULE_DEBUGGING=NO", "COMPILER_INDEX_STORE_ENABLE=NO");
}

sub XcodeStaticAnalyzerOption()
{
return "RUN_CLANG_STATIC_ANALYZER=YES";
Expand Down
1 change: 1 addition & 0 deletions Tools/Scripts/webkitperl/BuildSubproject.pm
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ if (isAppleCocoaWebKit()) {
my @additionalSupportOptions = ();
push @additionalSupportOptions, XcodeCoverageSupportOptions() if $coverageSupport;
push @additionalSupportOptions, XcodeStaticAnalyzerOption() if $shouldRunStaticAnalyzer;
push @additionalSupportOptions, XcodeExportCompileCommandsOptions() if $exportCompileCommands;

push @options, ($forceCLoop ? "ENABLE_JIT=ENABLE_JIT=0" : "ENABLE_JIT=ENABLE_JIT");
push @options, ($forceCLoop ? "ENABLE_C_LOOP=ENABLE_C_LOOP" : "ENABLE_C_LOOP=ENABLE_C_LOOP=0");
Expand Down

0 comments on commit 0579d0e

Please sign in to comment.