From f3922da41459fcdb6f590abc29cc706bd397a4e1 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Fri, 30 Oct 2026 18:08:34 +0000 Subject: [PATCH] build: only set `V8_EMBEDDER_STRING` where needed Passing `V8_EMBEDDER_STRING` on the command line to every compilation unit invalidates the ccache for those sources when `v8_embedder_string` is bumped in `common.gypi` meaning that almost all of `deps/v8` has to be rebuilt. Only set the macro where it is needed so that embedder string bumps have minimal affects on ccache reuse. Signed-off-by: Richard Lau --- tools/v8_gypfiles/features.gypi | 3 --- tools/v8_gypfiles/v8.gyp | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi index 305c81eab34d..e782bc40642d 100644 --- a/tools/v8_gypfiles/features.gypi +++ b/tools/v8_gypfiles/features.gypi @@ -339,9 +339,6 @@ 'target_defaults': { 'conditions': [ - ['v8_embedder_string!=""', { - 'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',], - }], ['v8_enable_disassembler==1', { 'defines': ['ENABLE_DISASSEMBLER',], }], diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 71b6772bc345..e3ab38b543e2 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -558,6 +558,23 @@ ], }, }, # v8_version + { + 'target_name': 'v8_version_string', + 'type': 'static_library', + 'toolsets': ['host', 'target'], + 'dependencies': [ + 'v8_headers', + 'v8_libbase', + ], + 'sources': [ + '<(V8_ROOT)/src/utils/version.cc', + ], + 'conditions': [ + ['v8_embedder_string!=""', { + 'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',], + }], + ], + }, # v8_version_string { 'target_name': 'v8_config_headers', 'type': 'none', @@ -1106,6 +1123,7 @@ 'v8_libbase', 'v8_shared_internal_headers', 'v8_version', + 'v8_version_string', 'cppgc_base', 'generate_bytecode_builtins_list', 'run_torque', @@ -1128,6 +1146,9 @@ '<@(inspector_all_sources)', ], + 'sources!': [ + '<(V8_ROOT)/src/utils/version.cc', # now compiled in v8_version_string target + ], 'conditions': [ ['v8_use_perfetto==1', { 'sources': [