Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2417)

Unified Diff: build/android/gyp/jinja_template.py

Issue 2362613002: generate_gradle.py: Allow multiple --target and add --all (Closed)
Patch Set: comments, docs, & default targets Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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):

Powered by Google App Engine
This is Rietveld 408576698