libchrome: downgrade mojom types at arc build time

This is to prepare for synchronizing .mojom files with those in
chromium/src which are in new syntax.

Add the mojom downgrading python script from crrev.com/c/2082513.
In soong/bindings_generator.go, define new ModuleFactory executing it
and register as new Module generate_mojom_downgraded_files.

The change will be cherry-picked to ARC branches to use in Android.bp:
downgraded .mojom files are generated from the original .mojom files
using the new module, then they would (replace the original .mojom files
to) be used as input to generate bindings.
Files in old syntax will be output as is.

Note that previously, when generating the bindings, it is assumed that
the input .mojom files are located under the module's local source
directory, which is then given as value of argument depth to
mojo/public/tools/bindings/mojom_bindings_generator.py.
The mojom_bindings_generator.py computes the relative path (hence
output path) accordingly.
Since this is no longer true, the source root would now be computed per
input .mojom file.

Bug: 149070836, chromium:1035484
Test: local build; compare downgraded mojom files and generated bindings

Change-Id: I86a6c67c5ae7056f3c9f617a1c5a9c954c10aa0d
2 files changed