Bug 949875 - Delay import some WebIDL modules; r=glandium

This prevents excessive dependencies on config.status. Those extra
dependencies make WebIDL developer workflow inefficient.

--HG--
extra : rebase_source : d656410da544d4d29eb926293d8be355cd3736db
This commit is contained in:
Gregory Szorc 2013-12-13 15:12:29 +09:00
parent 8a9e7dc4c1
commit b585c8be7a

View File

@ -24,14 +24,8 @@ from mozbuild.util import FileAvoidWrite
import mozpack.path as mozpath
import WebIDL
from Codegen import (
CGBindingRoot,
CGEventRoot,
CGExampleRoot,
GlobalGenRoots,
)
from Configuration import Configuration
# There are various imports in this file in functions to avoid adding
# dependencies to config.status. See bug 949875.
class BuildResult(object):
@ -300,11 +294,16 @@ class WebIDLCodegenManager(LoggingMixin):
def generate_example_files(self, interface):
"""Generates example files for a given interface."""
from Codegen import CGExampleRoot
root = CGExampleRoot(self.config, interface)
return self._maybe_write_codegen(root, *self._example_paths(interface))
def _parse_webidl(self):
import WebIDL
from Configuration import Configuration
self.log(logging.INFO, 'webidl_parse',
{'count': len(self._input_paths)},
'Parsing {count} WebIDL files.')
@ -323,6 +322,8 @@ class WebIDLCodegenManager(LoggingMixin):
self._input_hashes = hashes
def _write_global_derived(self):
from Codegen import GlobalGenRoots
things = [('declare', f) for f in self.GLOBAL_DECLARE_FILES]
things.extend(('define', f) for f in self.GLOBAL_DEFINE_FILES)
@ -448,6 +449,11 @@ class WebIDLCodegenManager(LoggingMixin):
return paths
def _generate_build_files_for_webidl(self, filename):
from Codegen import (
CGBindingRoot,
CGEventRoot,
)
self.log(logging.INFO, 'webidl_generate_build_for_input',
{'filename': filename},
'Generating WebIDL files derived from {filename}')