Index: build/android/gyp/jinja_template.py |
diff --git a/build/android/gyp/jinja_template.py b/build/android/gyp/jinja_template.py |
index 3fa477fe654fff43a28c1b2613fe06548667b656..c8176bdd7854b02bf3f0b0c5683d3b08d71bd6df 100755 |
--- a/build/android/gyp/jinja_template.py |
+++ b/build/android/gyp/jinja_template.py |
@@ -44,10 +44,14 @@ class JinjaProcessor(object): |
self.env.line_comment_prefix = '##' |
self.env.trim_blocks = True |
self.env.lstrip_blocks = True |
+ self._template_cache = {} # Map of path -> Template |
def Render(self, input_filename, variables=None): |
input_rel_path = os.path.relpath(input_filename, self.loader_base_dir) |
- template = self.env.get_template(input_rel_path) |
+ template = self._template_cache.get(input_rel_path) |
+ if not template: |
+ template = self.env.get_template(input_rel_path) |
+ self._template_cache[input_rel_path] = template |
return template.render(variables or self.variables) |
def GetLoadedTemplates(self): |