)]}'
{
  "commit": "c0d4f8b735e8357d5e81730d722ecd4d5f36025d",
  "tree": "31d5a8e953b338c9fa6a68b1604d7125952fa125",
  "parents": [
    "ff14fc1112e0a8dd2c3910fb89539741cb3d3f23"
  ],
  "author": {
    "name": "Adrian Taylor",
    "email": "adetaylor@chromium.org",
    "time": "Fri Mar 25 15:05:57 2022 -0700"
  },
  "committer": {
    "name": "Commit Bot",
    "email": "commit-bot@chromium.org",
    "time": "Fri Mar 25 22:24:21 2022 +0000"
  },
  "message": "Make more variables available to scripts.\n\nThis change makes certain extra variables available to \u0027action\u0027 target types,\ni.e. scripts. Those variables are:\n* defines\n* include_dirs\n* rustenv\nThey are deduced from any configs applied to the target, so\nconfigs also now applies to \u0027action\u0027 targets.\n\nThese variables are normally exclusively used by compilers, and no compiler-\nspecific variables have been made available to scripts previously. Here\u0027s\nwhy they\u0027re needed.\n\nrustenv:\n\nThis variable represents environment variables passed to the Rust\nbuild, and in the Chromium tree this is assembled using various transitive\n\u0027config\u0027s. These environment variables are typically used to allow `env!`\ndirectives within the Rust code to work properly; often (but not always)\nthis is to support pre-existing third party Rust code (\"crates\").\n\nSuch pre-existing third party Rust code also expects the same environment\nvariables to be present when the crates\u0027 build scripts are run. In a gn\nenvironment, these build scripts are run using an \u0027action\u0027, and therefore\nwe need to make this rustenv value available to \u0027action\u0027 targets.\n\nThis is described in https://chromium/1304254.\n\ndefines/include_dirs:\n\nIn Rust development it is common to produce Rust bindings to pre-existing\nC/C++ headers. This is not built into rustc, but is instead a facility\nprovided by separate codegen tools - the most commonly known example being\nbindgen (https://rust-lang.github.io/rust-bindgen/). In a gn environment,\nthese tools are run as a gn \u0027action\u0027 target.\n\nSuch tools involve parsing C/C++ headers (using something like libclang).\nIn order to parse headers properly, such tools obviously need to be aware\nof the full list of -I and -D flags active in the current environment.\nIn Chromium, such -I and -D flags are assembled using a graph of complex\ntransitive gn \u0027config\u0027s, and there\u0027s no realistic prospect of hard-coding\nequivalent command lines.\n\n\u0027bindgen\u0027 therefore absolutely has to have access to the \u0027include_dirs\u0027\nand \u0027defines\u0027 set using gn configs. One solution here is to define a\nwhole new toolchain where we inform GN that bindgen is a compiler - this\nsolution is outlined in https://chromium/1296241 - however this is not\nideal. To parse (say) just base/cpu_info.h, we would need to depend upon\n  //base(//toolchains/fake_bindgen_toolchain)\nwhich will run a command to \u0027compile\u0027 every .cc file within //base.\nThis can be 10,000s of extra ninja rules, and even if most of them\nare just a \u0027touch\u0027 command, this is still a great deal of extra complexity.\n\nBug: chromium/1272780, chromium/1296155, chromium/1296241, chromium/1304254\nChange-Id: Ib60067b310d8508f61d04fe7ddc537a5d2c2917f\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/13220\nReviewed-by: Brett Wilson \u003cbrettw@chromium.org\u003e\nCommit-Queue: Brett Wilson \u003cbrettw@chromium.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "566b3ed8b9b6c3f4135d5a441ec44483bceaa6a8",
      "old_mode": 33188,
      "old_path": "docs/reference.md",
      "new_id": "51dcecc38df370760e0e91821b586f2fd7bf434b",
      "new_mode": 33188,
      "new_path": "docs/reference.md"
    },
    {
      "type": "modify",
      "old_id": "73fa28895a74e36b503dd70c0000ecfc9f639124",
      "old_mode": 33188,
      "old_path": "src/gn/action_target_generator.cc",
      "new_id": "ff667655e114e09e3f4d70bcec7e3032d1ddbde5",
      "new_mode": 33188,
      "new_path": "src/gn/action_target_generator.cc"
    },
    {
      "type": "modify",
      "old_id": "ea47ce9da9c6459a100153fa6926dd96e9f39f3f",
      "old_mode": 33188,
      "old_path": "src/gn/c_substitution_type.cc",
      "new_id": "971d87a46ff60dfd7ea9cc91b3c405e79ecca079",
      "new_mode": 33188,
      "new_path": "src/gn/c_substitution_type.cc"
    },
    {
      "type": "modify",
      "old_id": "1f4e90e06a387f857f5707b593dd9bbc8a0a91f4",
      "old_mode": 33188,
      "old_path": "src/gn/c_substitution_type.h",
      "new_id": "d0d1f8c416761f7806073ff157309b8a744646ea",
      "new_mode": 33188,
      "new_path": "src/gn/c_substitution_type.h"
    },
    {
      "type": "modify",
      "old_id": "16f2a1a90e9bd9beaf854cf2eb73ab754f130f60",
      "old_mode": 33188,
      "old_path": "src/gn/compile_commands_writer.cc",
      "new_id": "c65d37843939836bd3a60bd4ae5cb12bb881e911",
      "new_mode": 33188,
      "new_path": "src/gn/compile_commands_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "7120b3f751290b43551f80d196cf6150e51ee042",
      "old_mode": 33188,
      "old_path": "src/gn/functions_target.cc",
      "new_id": "74f53e915f62bfd5e5789917c9abc5e900f9cfd3",
      "new_mode": 33188,
      "new_path": "src/gn/functions_target.cc"
    },
    {
      "type": "modify",
      "old_id": "bfceef90b8fb02365877fbe41905c016d7423f69",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_action_target_writer.cc",
      "new_id": "e717d33c40922d154c2e384a695b884aa8b03580",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_action_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "ef91f4e1024f9485b1229aa064fe6c7e234f5df9",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_action_target_writer.h",
      "new_id": "58b9489a9d012406f82fa9ff3b4ef33a83fd8f02",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_action_target_writer.h"
    },
    {
      "type": "modify",
      "old_id": "80b125b8f30cc56743851a5e0aa47f663173d7ff",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_action_target_writer_unittest.cc",
      "new_id": "d363b5e528b438b5e3f827063aaccee82c67761a",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_action_target_writer_unittest.cc"
    },
    {
      "type": "modify",
      "old_id": "5f3afcb9f2ebd622a85d2adb9c834b33d4a88c70",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_c_binary_target_writer.cc",
      "new_id": "052f03a4b48397b309427afdf5cb60d0dcdd0252",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_c_binary_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "2aafe92ae99209412efd7b46f3e685e186a07a2a",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_c_binary_target_writer_unittest.cc",
      "new_id": "e4ec8006bd45f57bb246c0c6d790ee5b8911a978",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_c_binary_target_writer_unittest.cc"
    },
    {
      "type": "modify",
      "old_id": "0fd26c0bf4754ea4f0e24b3c4afdb1cadbbde425",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_rust_binary_target_writer.cc",
      "new_id": "f3ff21fc4d50023bebebc1e0f32c1a0c46c122a2",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_rust_binary_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "b542fb26fdd083c8c587d1e11f2b3b6ca847cdaa",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_target_command_util.cc",
      "new_id": "a691ae35614cadbd82c7515d81a9736e774845c8",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_target_command_util.cc"
    },
    {
      "type": "modify",
      "old_id": "b0179a1cf13b20967810a2e70177d32a9c3f0b86",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_target_command_util.h",
      "new_id": "93666fbaa3cdc6171da6d7ee988ef56f6cff3e3d",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_target_command_util.h"
    },
    {
      "type": "modify",
      "old_id": "efcf9912ef8fd1d3fd40e4987bbf6ec98f25977c",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_target_writer.cc",
      "new_id": "0f2514b4f439361184a15f03fbe1181d1dec6c19",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "7a339ab5e82926e279088293be8ac20249c2a26f",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_target_writer.h",
      "new_id": "3d38a14f584c640ed8143a0259f76d40a00c2e12",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_target_writer.h"
    },
    {
      "type": "modify",
      "old_id": "69e6cf6a1dbe1064865b9419a84972f6917b794d",
      "old_mode": 33188,
      "old_path": "src/gn/rust_substitution_type.cc",
      "new_id": "5423d0dc7bf035ea15a8cea66877040f05112200",
      "new_mode": 33188,
      "new_path": "src/gn/rust_substitution_type.cc"
    },
    {
      "type": "modify",
      "old_id": "36ba953843631700f9954471667eeb94b8a53cbb",
      "old_mode": 33188,
      "old_path": "src/gn/rust_substitution_type.h",
      "new_id": "5a6ac6cece538d318e5926c7827fcbba7225c90b",
      "new_mode": 33188,
      "new_path": "src/gn/rust_substitution_type.h"
    },
    {
      "type": "modify",
      "old_id": "21311c665e272f5a83ea5b4108867cab28d3d7fe",
      "old_mode": 33188,
      "old_path": "src/gn/substitution_list.cc",
      "new_id": "aed66a060cde59477f3998fddead69ad1ac9ec8f",
      "new_mode": 33188,
      "new_path": "src/gn/substitution_list.cc"
    },
    {
      "type": "modify",
      "old_id": "559b25d1747d3eb97474b0d3a5b8edd8acec9c87",
      "old_mode": 33188,
      "old_path": "src/gn/substitution_list.h",
      "new_id": "0dbf206412d91d29a49fd16319fb1e9781abaca1",
      "new_mode": 33188,
      "new_path": "src/gn/substitution_list.h"
    },
    {
      "type": "modify",
      "old_id": "06c21b36ef172073745cb8928ff50ad779c99d4f",
      "old_mode": 33188,
      "old_path": "src/gn/substitution_type.cc",
      "new_id": "723bf8a4469953dd9e234ac892efc6ff5d22b516",
      "new_mode": 33188,
      "new_path": "src/gn/substitution_type.cc"
    },
    {
      "type": "modify",
      "old_id": "fba20e07ee59c26b1c1ee12f75698ca57c068dfa",
      "old_mode": 33188,
      "old_path": "src/gn/variables.cc",
      "new_id": "ca64776b8529d218a0bf2b4ec52b1737c011d1d3",
      "new_mode": 33188,
      "new_path": "src/gn/variables.cc"
    }
  ]
}
