commit | eabc4de478e68adce5a645261aadbb00f2994f14 | [log] [tgz] |
---|---|---|
author | David 'Digit' Turner <[email protected]> | Tue Mar 04 12:27:31 2025 +0100 |
committer | GN LUCI <[email protected]> | Tue Mar 04 04:57:52 2025 -0800 |
tree | 1a08c95ca62e9066dbf00ba95a61c6fea0ce6a1e | |
parent | 96297ebb3e922384d8eb4ac82752edaeded6e780 [diff] |
Always generate a .toolchain file even if it is empty. This removes a regression that was introduced in [1], where a GN toolchain that only has empty group() targets would not generate a .toolchain file anymore. This would result a Ninja failure when the top-level build.ninja file would try to load it. E.g.: ``` 2.56s Error: failed to load build.ninja: open clang_x86/toolchain.ninja: no such file or directory ``` See [2] for complete example. [1] https://gn-review.googlesource.com/c/gn/+/18280 [2] https://ci.chromium.org/ui/p/chromium/builders/ci/android-archive-rel/53404/overview Change-Id: I5c380c426b823103a3ff7f79d6d806ed7026b21e Reviewed-on: https://gn-review.googlesource.com/c/gn/+/18320 Commit-Queue: David Turner <[email protected]> Reviewed-by: Takuto Ikuta <[email protected]>
diff --git a/src/gn/command_gen.cc b/src/gn/command_gen.cc index f997086..e373c89 100644 --- a/src/gn/command_gen.cc +++ b/src/gn/command_gen.cc
@@ -111,10 +111,12 @@ { std::lock_guard<std::mutex> lock(write_info->lock); - if (!rule.empty()) { - write_info->rules[target->toolchain()].emplace_back(target, - std::move(rule)); - } + // Even if rule is empty, add it to the map to ensure a corresponding + // .toolchain file will be generated, otherwise Ninja will complain + // when the build.ninja file tries to load a non-existent .toolchain + // file. + write_info->rules[target->toolchain()].emplace_back(target, + std::move(rule)); if (write_info->want_ninja_outputs) { write_info->ninja_outputs_map.emplace(target,