| OLD | NEW |
| (Empty) |
| 1 Generated Files | |
| 2 ================== | |
| 3 | |
| 4 The intermediate representation passed from the Mojom parser (the frontend | |
| 5 of the Mojom compiler) to the code generators (the backend of the Mojom | |
| 6 Compiler) is a `MojomFileGraph` described in mojom_types.mojom and | |
| 7 mojom_files.mojom in mojo/public/interfaces/bindings. Thus the Mojom compiler | |
| 8 uses Mojo serialization to serialize the intermediate representation. | |
| 9 | |
| 10 This situation potentially entails a circular dependency because it means that | |
| 11 in order to build the Mojom compiler it is necessary to use code that has been | |
| 12 generated by the Mojom compiler. In order to break this circular dependency we | |
| 13 check in the generated code needed by the compiler rather than generating it | |
| 14 while building the compiler. | |
| 15 | |
| 16 This directory contains the checked-in generated Go code used by the frontend | |
| 17 of the compiler: | |
| 18 mojom_files/mojom_files.mojom.go and | |
| 19 mojom_types/mojom_types.mojom.go. | |
| 20 | |
| 21 The backend of the Mojom compiler is written in Python and the corresponding | |
| 22 generated Python files may be found in | |
| 23 mojo/public/tools/bindings/pylib/mojom/generate/generated/mojom_files_mojom.py | |
| 24 and | |
| 25 mojo/public/tools/bindings/pylib/mojom/generate/generated/mojom_types_mojom.py | |
| 26 | |
| 27 ### Instructions for updating these files | |
| 28 1) Make changes to mojom_types.mojom and mojom_files.mojom. This may be done | |
| 29 either in the same patch as everything below or in its own initial patch. | |
| 30 2) Compile these files to produce new generated files: | |
| 31 ninja -C out/Debug mojo/public/interfaces/bindings. | |
| 32 3) Copy the newly generated mojom_files.mojom.go and mojom_types.mojom.go | |
| 33 into the appropriate locations in this directory. | |
| 34 4) mojom_files.mojom.go needs to be manually patched in a minor way. In the | |
| 35 import section at the top replace "mojo/public/interfaces/bindings/mojom_types" | |
| 36 with "mojom/mojom_tool/generated/mojom_types". | |
| 37 5) Update the Go code in the serialization module of the parser to compensate | |
| 38 for the changes if necessary. (Not necessary if the changes in step 1 were | |
| 39 backward compatible.) | |
| 40 6) Perform the analog of steps 3, 4, 5 for the Python code in the backend of | |
| 41 the compiler. See | |
| 42 mojo/public/tools/bindings/pylib/mojom/generate/generated/README.md | |
| 43 for instructions. | |
| 44 7) Land a patch containing your changes from steps 3 through 6. | |
| OLD | NEW |