From 6f4af478ec36587d3f01399004627697850dae54 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Mon, 12 Jan 2026 11:55:02 -0500 Subject: [PATCH] build: infer cargo mode with gyp var build_type directly --- configure.py | 6 ------ deps/crates/crates.gyp | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index c83a7ec8c18207..d415eec2dd854d 100755 --- a/configure.py +++ b/configure.py @@ -1864,11 +1864,6 @@ def configure_library(lib, output, pkgname=None): output['libraries'] += pkg_libs.split() -def configure_rust(o, configs): - set_configuration_variable(configs, 'cargo_build_mode', release='release', debug='debug') - set_configuration_variable(configs, 'cargo_build_flags', release=['--release'], debug=[]) - - def configure_v8(o, configs): set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0) @@ -2468,7 +2463,6 @@ def make_bin_override(): configure_static(output) configure_inspector(output) configure_section_file(output) -configure_rust(output, configurations) # remove builtins that have been disabled if options.without_amaro: diff --git a/deps/crates/crates.gyp b/deps/crates/crates.gyp index 405b8d2f452773..75b02191549e7e 100644 --- a/deps/crates/crates.gyp +++ b/deps/crates/crates.gyp @@ -1,8 +1,20 @@ { 'variables': { 'cargo_vendor_dir': './vendor', - 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/>(cargo_build_mode)/<(STATIC_LIB_PREFIX)node_crates<(STATIC_LIB_SUFFIX)', }, + 'conditions': [ + ['build_type == "Release"', { + 'variables': { + 'cargo_build_flags': ['--release'], + 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/release/<(STATIC_LIB_PREFIX)node_crates<(STATIC_LIB_SUFFIX)', + }, + }, { + 'variables': { + 'cargo_build_flags': [], + 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/debug/<(STATIC_LIB_PREFIX)node_crates<(STATIC_LIB_SUFFIX)', + }, + }] + ], 'targets': [ { 'target_name': 'node_crates', @@ -38,7 +50,7 @@ 'action': [ 'cargo', 'rustc', - '>@(cargo_build_flags)', + '<@(cargo_build_flags)', '--frozen', '--target-dir', '<(SHARED_INTERMEDIATE_DIR)'