Extract mojom parser from bindings generator
This extracts the mojom parsing logic from mojom_bindings_generator.py into a new mojom_parser.py script within the mojom tool directory. Apart from simply moving the parsing logic to a new script, this also changes how the parse result is persisted by an intermediate build step for subsequent build steps to consume. Prior to this change, the parsing step emitted a ".p" file for each processed .mojom file. This was nothing more than a serialized version of the parsed AST with [EnableIf] feature filtering applied. Every subsequent step for the mojom in question would load this AST, then recursively process its import dependencies while loading their ASTs in turn, before finally processing all of the aggregated data (resolving references, computing field packing data, etc) to produce a Module object suitable for bindings generation. This CL rolls most of that processing into the parsing step (with more to follow in future CLs), and the resulting computed Module object is persisted to a ".mojom-module" file. To generate bindings for a given .mojom file, the generator can simply call Module.Load() on the corresponding .mojom-module produced by the parser. The loaded Module is sufficient to inform code generation with no need to resolve dependencies, process other modules, or perform other complex computations on the model. Each mojom-module is thus entirely self-contained, replicating the full contents of all transitive import dependencies. This means the build consumes more disk space with intermediate build artifacts, but it also means generation steps are faster and simpler. This CL should result in no net changes to the final build outputs. Bug: 1060471 Change-Id: Ic21b737409ac1329f0f8a8751bf021f2de4768a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128966 Commit-Queue: Ken Rockot <rockot@google.com> Reviewed-by:Oksana Zhuravlova <oksamyt@chromium.org> Cr-Commit-Position: refs/heads/master@{#755952}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment