)]}'
{
  "commit": "0e41dcd9b564dc1b48a4bc10e4a88eeb8724eea7",
  "tree": "e7b554096849c8712484501152b1c88911d46cae",
  "parents": [
    "e04c7ff10dc0955050fbdbae6b46d856663d7d1f"
  ],
  "author": {
    "name": "Lukasz Anforowicz",
    "email": "lukasza@chromium.org",
    "time": "Tue Nov 24 20:05:55 2026 +0000"
  },
  "committer": {
    "name": "gn-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "email": "gn-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Wed Nov 25 06:56:03 2026 -0800"
  },
  "message": "rust: Omit non-Rust link deps from rlib order-only deps\n\nCompiling an rlib does not invoke a linker, so non-Rust native\ndependencies (source_set object files, static libraries, shared\nlibraries, and Rust cdylibs) are not used by rustc and are already\npropagated via inherited libraries to final linking targets.\n\nhttps://gn-review.googlesource.com/c/gn/+/27000 removed non-Rust\nlinkable_deps (static_library, shared_library, and Rust cdylib) from an\nrlib\u0027s command line and implicit deps (`|`), avoiding rlib invalidation\non C/C++ relinks and removing edges when no source_set or group sits in\nthe path. However, it was not sufficient to unblock rlibs in the Ninja\ngraph:\n- source_set targets are classified as non_linkable_deps, so\n  GetOrderOnlyDepsFromNonLinkableDeps still emitted\n  `|| phony/.../\u003ctarget\u003e.linkdeps` on the rlib. A source_set\u0027s\n  `.linkdeps` depends on all of its `.o` files and transitively on the\n  order-only deps of its non_linkable_deps (including upstream `.a` and\n  `.so`/`.TOC` targets).\n- group targets are also classified as non_linkable_deps, and\n  ResolvedTargetData::GetOrderOnlyDeps(group) expanded all targets in\n  the group, still emitting `||` edges to `.linkdeps`, `.a`, and\n  `.so`/`.TOC` outputs.\n\nFilter rlib order-only deps in NinjaRustBinaryTargetWriter to skip\nnon-Rust source_sets, non-Rust native libraries, and Rust cdylibs\n(including when reached through groups), while preserving hard deps\n(via input deps) and data_deps (direct and through groups).\n\nMeasured on Chromium `origin/main` (`e118cca65f028`) in a Linux\ncomponent build (`is_component_build \u003d true`, `is_debug \u003d false`)\ncomparing Chromium\u0027s GN (`ddc6c4ae`, which includes CL 27000) against\n`ddc6c4ae` + this CL, 469 of 523 `.rlib` targets drop native order-only\ndeps:\n- `//third_party/crabbyavif:crabbyavif`: `.o`/`.a`/`.so`/`.TOC` inputs\n  drop from 256 to 1 (1 host proc-macro `.so`; 255 -\u003e 0 C/C++ outputs);\n  Ninja build steps drop from 340 to 84.\n- `//net/base:filename_util`: inputs drop from 3857 to 445; steps drop\n  from 4219 to 709.\n- `//base/test:scoped_feature_list`: inputs drop from 3429 to 445;\n  steps drop from 3972 to 808.\n- //components/safe_browsing/content/renderer/phishing_classifier/rust:scorer_bridge\n  inputs drop from 11895 to 482; steps drop from 13184 to 1580.\n- `//base/logging/rust_logger:rust_logger` (after\n  https://crrev.com/c/8823780): inputs drop from 5 to 2 (removing\n  `libcxx_cppdeps_lib.a`, `cxx.o`, and `libclang_rt.builtins.a` pulled\n  through a group; 3 -\u003e 0 C/C++ outputs); steps drop from 106 to 103.\n\nThis was measured with:\n\n```\n$ third_party/ninja/ninja -C out/rel -t inputs \\\n    third_party/crabbyavif:crabbyavif | \\\n    grep -E \u0027\\.(o|a|so|TOC)$\u0027 | wc -l\n1\n$ third_party/ninja/ninja -C out/rel -t commands \\\n    third_party/crabbyavif:crabbyavif | wc -l\n84\n```\n\nBug: gn:563098656\nChange-Id: I8c1a87c48e7abeaa486d5630591baf4fcb58288e\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/29140\nReviewed-by: David Turner \u003cdigit@google.com\u003e\nReviewed-by: Takuto Ikuta \u003ctikuta@google.com\u003e\nCommit-Queue: David Turner \u003cdigit@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c263c755019cede6315a6077482c4a5c99e32a45",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_rust_binary_target_writer.cc",
      "new_id": "3b1f3e4fa032170944da3144ad63038c2ccd1115",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_rust_binary_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "4f5282e9712a36b0a09341c6ee242356e18586e0",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_rust_binary_target_writer_unittest.cc",
      "new_id": "569a3ccc7d698ba89280e5d3eb0647cc0a98bb14",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_rust_binary_target_writer_unittest.cc"
    }
  ]
}
