summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-21 16:34:16 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-21 16:34:16 +0000
commitaf7ad48b8d19889185461362b73803bd1e015cc5 (patch)
tree9c3255d20a262255782958be05fb6ca050b159a5 /mojo
parent10129aa31afc695d9866fe20a985132fc7bce6e9 (diff)
downloadchromium_src-af7ad48b8d19889185461362b73803bd1e015cc5.zip
chromium_src-af7ad48b8d19889185461362b73803bd1e015cc5.tar.gz
chromium_src-af7ad48b8d19889185461362b73803bd1e015cc5.tar.bz2
Mojo: Restore the Mojom generator's ability to use different include paths.
This was lost in the transition to jinja. (Actually, this also adds the ability to use "no" include path -- i.e., "foo.h" instead of "./foo.h".) R=darin@chromium.org, mpcomplete@chromium.org Review URL: https://codereview.chromium.org/140903007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/public/bindings/generators/cpp_templates/module.cc.tmpl2
-rw-r--r--mojo/public/bindings/generators/cpp_templates/module.h.tmpl2
-rw-r--r--mojo/public/bindings/generators/mojom_cpp_generator.py10
3 files changed, 12 insertions, 2 deletions
diff --git a/mojo/public/bindings/generators/cpp_templates/module.cc.tmpl b/mojo/public/bindings/generators/cpp_templates/module.cc.tmpl
index c5a0fb3..7bedd5f 100644
--- a/mojo/public/bindings/generators/cpp_templates/module.cc.tmpl
+++ b/mojo/public/bindings/generators/cpp_templates/module.cc.tmpl
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "./{{module_name|camel_to_underscores}}.h"
+#include "{{include_prefix}}{{module_name|camel_to_underscores}}.h"
#include "mojo/public/bindings/lib/bindings_serialization.h"
#include "mojo/public/bindings/lib/message_builder.h"
diff --git a/mojo/public/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/bindings/generators/cpp_templates/module.h.tmpl
index bc5ff63..776d367 100644
--- a/mojo/public/bindings/generators/cpp_templates/module.h.tmpl
+++ b/mojo/public/bindings/generators/cpp_templates/module.h.tmpl
@@ -10,7 +10,7 @@
#include "mojo/public/bindings/lib/bindings.h"
#include "mojo/public/bindings/lib/message.h"
-#include "./{{module_name|camel_to_underscores}}_internal.h"
+#include "{{include_prefix}}{{module_name|camel_to_underscores}}_internal.h"
namespace {{namespace}} {
diff --git a/mojo/public/bindings/generators/mojom_cpp_generator.py b/mojo/public/bindings/generators/mojom_cpp_generator.py
index 003cbd6..c548db35 100644
--- a/mojo/public/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/bindings/generators/mojom_cpp_generator.py
@@ -120,6 +120,7 @@ class CppGenerator(mojom_generator.Generator):
"enums": self.module.enums,
"structs": self.GetStructs(),
"interfaces": self.module.interfaces,
+ "include_prefix": self.GetIncludePrefix(),
}
@UseJinja("cpp_templates/module_internal.h.tmpl", filters=cpp_filters)
@@ -130,6 +131,7 @@ class CppGenerator(mojom_generator.Generator):
"enums": self.module.enums,
"structs": self.GetStructs(),
"interfaces": self.module.interfaces,
+ "include_prefix": self.GetIncludePrefix(),
}
@UseJinja("cpp_templates/module.cc.tmpl", filters=cpp_filters)
@@ -140,6 +142,7 @@ class CppGenerator(mojom_generator.Generator):
"enums": self.module.enums,
"structs": self.GetStructs(),
"interfaces": self.module.interfaces,
+ "include_prefix": self.GetIncludePrefix(),
}
def GenerateFiles(self):
@@ -147,3 +150,10 @@ class CppGenerator(mojom_generator.Generator):
self.Write(self.GenerateModuleInternalHeader(),
"%s_internal.h" % self.module.name)
self.Write(self.GenerateModuleSource(), "%s.cc" % self.module.name)
+
+ def GetIncludePrefix(self):
+ if not self.header_dir:
+ return ""
+ if self.header_dir[-1] == "/":
+ return self.header_dir
+ return self.header_dir + "/"