[mojo] Allow bindings generation with explicit relative include paths

If an imported mojo module AND its target directory are located outside
of the normal tree structure from the rest of the files, it will cause
the generated code to have a different-than-expected include path. This
change allows each -I directive to have an optional 'depth' modifier so
that all paths are correctly relativized. Omitting the modifier is a
no-op and preserves current behavior.

Example scenario:

project_a/src/A.mojom
project_b/src/B.mojom (import "A.mojom")

mojom_bindings_generator.py \
  -g c++ \
  -d project_a/src \
  -o project_a/gen \
  project_a/src/A.mojom
# Normal invocation

mojom_bindings_generator.py \
  -I project_a/src \
  -g c++ \
  -d project_b/src \
  -o project_b/gen \
  project_b/src/B.mojom
# This causes A's generated import to be
# "../../../project_a/src/A.mojom.h"

mojom_bindings_generator.py \
  -I project_a/src:project_a/src \
  -g c++ \
  -d project_b/src \
  -o project_b/gen \
  project_b/src/B.mojom
# The addition of the depth modified to the include
# causes A's generated import to be "A.mojom.h"

Review-Url: https://codereview.chromium.org/2171033002
Cr-Commit-Position: refs/heads/master@{#407914}
1 file changed