From 36edc5fa8b2da5aa00b8c2c68b25ffd64219d0ba Mon Sep 17 00:00:00 2001 From: Jeremy Leconte Date: Mon, 1 Sep 2025 15:32:46 +0200 Subject: [PATCH] Fix assert(current_toolchain == default_toolchain) failure on win bots. Bug: libyuv:440517010 Change-Id: Ida12cce239448dae40524b4b629981116eeadacd Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/6904242 Commit-Queue: Jeremy Leconte Reviewed-by: Mirko Bonadei --- BUILD.gn | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 4a2dbf182..954ac3a66 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -494,12 +494,16 @@ if (libyuv_include_tests) { } if (!build_with_chromium) { - # Write debug logs to gn_logs.txt. - # This is also required for Siso builds. - import("//build/gn_logs.gni") - lines = [ - "Generated during 'gn gen' by //BUILD.gn.", - "", - ] + build_gn_logs - write_file("$root_build_dir/gn_logs.txt", lines) + # GN evaluates each .gn file once per toolchain, so restricting to default + # toolchain will ensure write_file() is called only once. + if (current_toolchain == default_toolchain) { + # Write debug logs to gn_logs.txt. + # This is also required for Siso builds. + import("//build/gn_logs.gni") + lines = [ + "Generated during 'gn gen' by //BUILD.gn.", + "", + ] + build_gn_logs + write_file("$root_build_dir/gn_logs.txt", lines) + } }