)]}' { "commit": "ab9104586734cb45aa77c70ca5042edbcc9f6aa5", "tree": "c5db948005edfb90355608e46fbc471d30d30cd1", "parents": [ "5eb3845ec2d8296b4f41da4eca85302eb111fe69" ], "author": { "name": "David \u0027Digit\u0027 Turner", "email": "digit@google.com", "time": "Thu Mar 17 16:48:41 2022 +0100" }, "committer": { "name": "Commit Bot", "email": "commit-bot@chromium.org", "time": "Wed Apr 06 13:00:16 2022 +0000" }, "message": "Fix output directories for generated source files.\n\nThis CL fixes an annoying issue where the local build directory path\nleaks into the generated Ninja files when {{source_out_dir}} or\neven {{source_gen_dir}} are expanded.\n\nIn the case of a generated source file, its path will be source-absolute\nbut located in the build directory, for example:\n\n //out/Debug/gen/header.h\n //out/Debug/toolchain/gen/src/source.cc\n\nBefore this CL, the computed output directory would leak the \u0027out/Debug\u0027\nprefix, i.e. compute an output path, relative to `out/Debug` as:\n\n obj/out/Debug/gen/\n obj/out/Debug/toolchain/gen/src/\n\nAfter this CL, the build directory prefix is replaced with the\n\"BUILD_DIR\" string literal, and the result becomes:\n\n obj/BUILD_DIR/gen/\n obj/BUILD_DIR/toolchain/gen/src\n\nThis makes the commands more hermetic, especially with regards to remote\nbuilds which implement content-based caching, using the command hash as\na key.\n\nI tested that I could still build Fuchsia, Chromium and Pigweed with\nthis patch (as long as Pigwedd\u0027s build system is fixed with [1] to\nsupport upstream GN).\n\nNote that this CL is required to unblock the GN auto-roller for the\nFuchsia project: without it, the output directory leak checks will fail\nthe builds since the latest Rust-related changes adds a ton of\n`-Lnative\u003d\u003cpath-with-build-directory\u003e` to a very large number of\nRust link commands.\n\n[1] https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/90080\n\nChange-Id: I2dc811c295aa47dc412175bd74acc1333f8145e8\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/13240\nReviewed-by: Sylvain Defresne \u003csdefresne@chromium.org\u003e\nCommit-Queue: David Turner \u003cdigit@google.com\u003e\n", "tree_diff": [ { "type": "modify", "old_id": "6de3fbdf6c33fd4f03f71723c7f1a23f9033f151", "old_mode": 33188, "old_path": "src/gn/filesystem_utils.cc", "new_id": "7a7078edd800ef8a7c31bdad45a08bafd280044c", "new_mode": 33188, "new_path": "src/gn/filesystem_utils.cc" }, { "type": "modify", "old_id": "e4ec8006bd45f57bb246c0c6d790ee5b8911a978", "old_mode": 33188, "old_path": "src/gn/ninja_c_binary_target_writer_unittest.cc", "new_id": "b32d8c76a56fb72bb28dbe5f208c79925f83c42f", "new_mode": 33188, "new_path": "src/gn/ninja_c_binary_target_writer_unittest.cc" }, { "type": "modify", "old_id": "fc3c44692a746d6d452c6ef36ab3f76864281489", "old_mode": 33188, "old_path": "src/gn/substitution_writer_unittest.cc", "new_id": "eaa521ab9c335cfbf50d79a6c5e08415109803b5", "new_mode": 33188, "new_path": "src/gn/substitution_writer_unittest.cc" } ] }