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

Unified Diff: client/dom/scripts/dartgenerator.py

Issue 9348011: Use _GenerateLibFile for dartium libs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« no previous file with comments | « no previous file | client/dom/templates/dom/native/dom_impl.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dom/scripts/dartgenerator.py
diff --git a/client/dom/scripts/dartgenerator.py b/client/dom/scripts/dartgenerator.py
index c2408f40caa405a1afe7ef7b197dd21ddc004349..ec35f61a12fb2608a1a7f2af2296b932d8b738e8 100755
--- a/client/dom/scripts/dartgenerator.py
+++ b/client/dom/scripts/dartgenerator.py
@@ -878,15 +878,19 @@ class System(object):
TYPE=info.type_name,
PARAMS=info.ParametersImplementationDeclaration())
- def _GenerateLibFile(self, lib_template, lib_file_path, file_paths):
- """Generates a lib file from a template and a list of files."""
+ def _GenerateLibFile(self, lib_template, lib_file_path, file_paths,
+ **template_args):
+ """Generates a lib file from a template and a list of files.
+
+ Additional keyword arguments are passed to the template.
+ """
# Load template.
template = self._templates.Load(lib_template)
# Generate the .lib file.
lib_file_contents = self._emitters.FileEmitter(lib_file_path)
# Emit the list of #source directives.
- list_emitter = lib_file_contents.Emit(template)
+ list_emitter = lib_file_contents.Emit(template, **template_args)
lib_file_dir = os.path.dirname(lib_file_path)
for path in sorted(file_paths):
relpath = os.path.relpath(path, lib_file_dir)
@@ -2110,30 +2114,18 @@ class NativeImplementationSystem(System):
auxiliary_dir = os.path.relpath(self._auxiliary_dir, self._output_dir)
# Generate dom_public.dart.
- dom_public_path = os.path.join(self._output_dir, 'dom_public.dart')
-
- dom_public_imports_emitter = emitter.Emitter()
- for file in self._dom_public_files:
- path = os.path.relpath(file, os.path.dirname(dom_public_path))
- dom_public_imports_emitter.Emit('#source("$PATH");\n', PATH=path)
-
- dom_public_emitter = self._emitters.FileEmitter(dom_public_path)
- dom_public_emitter.Emit(self._templates.Load('dom_public.darttemplate'),
- AUXILIARY_DIR=auxiliary_dir,
- SOURCES=dom_public_imports_emitter.Fragments())
+ self._GenerateLibFile(
+ 'dom_public.darttemplate',
+ os.path.join(self._output_dir, 'dom_public.dart'),
+ self._dom_public_files,
+ AUXILIARY_DIR=auxiliary_dir);
# Generate dom_impl.dart.
- dom_impl_path = os.path.join(self._output_dir, 'dom_impl.dart')
-
- dom_impl_imports_emitter = emitter.Emitter()
- for file in self._dom_impl_files:
- path = os.path.relpath(file, os.path.dirname(dom_impl_path))
- dom_impl_imports_emitter.Emit('#source("$PATH");\n', PATH=path)
-
- dom_impl_emitter = self._emitters.FileEmitter(dom_impl_path)
- dom_impl_emitter.Emit(self._templates.Load('dom_impl.darttemplate'),
- AUXILIARY_DIR=auxiliary_dir,
- SOURCES=dom_impl_imports_emitter.Fragments())
+ self._GenerateLibFile(
+ 'dom_impl.darttemplate',
+ os.path.join(self._output_dir, 'dom_impl.dart'),
+ self._dom_impl_files,
+ AUXILIARY_DIR=auxiliary_dir);
def Finish(self):
pass
« no previous file with comments | « no previous file | client/dom/templates/dom/native/dom_impl.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698