| Index: Source/devtools/scripts/modular_build.py
|
| diff --git a/Source/devtools/scripts/modular_build.py b/Source/devtools/scripts/modular_build.py
|
| index f3dd6999b1b6027780828954ea24a61205bdcebe..db27030b996eb7a0f022241f22a3e6a084f75dd6 100755
|
| --- a/Source/devtools/scripts/modular_build.py
|
| +++ b/Source/devtools/scripts/modular_build.py
|
| @@ -44,13 +44,15 @@ def concatenate_scripts(file_names, module_dir, output_dir, output):
|
|
|
|
|
| class Descriptors:
|
| - def __init__(self, application_dir, application_descriptor, module_descriptors, application_json):
|
| + def __init__(self, application_dir, application_descriptor, module_descriptors):
|
| self.application_dir = application_dir
|
| self.application = application_descriptor
|
| self.modules = module_descriptors
|
| - self.application_json = application_json
|
| self._cached_sorted_modules = None
|
|
|
| + def application_json(self):
|
| + return json.dumps(self.application.values())
|
| +
|
| def all_compiled_files(self):
|
| files = {}
|
| for name in self.modules:
|
| @@ -63,7 +65,7 @@ class Descriptors:
|
|
|
| def module_compiled_files(self, name):
|
| files = []
|
| - module = self.modules[name]
|
| + module = self.modules.get(name)
|
| skipped_files = set(module.get('skip_compilation', []))
|
| for script in module.get('scripts', []):
|
| if script not in skipped_files:
|
| @@ -133,23 +135,33 @@ class DescriptorLoader:
|
| self.application_dir = application_dir
|
|
|
| def load_application(self, application_descriptor_name):
|
| - application_descriptor_filename = path.join(self.application_dir, application_descriptor_name)
|
| - application_descriptor_json = read_file(application_descriptor_filename)
|
| - application_descriptor = {desc['name']: desc for desc in json.loads(application_descriptor_json)}
|
| -
|
| - module_descriptors = {}
|
| - for (module_name, module) in application_descriptor.items():
|
| - if module_descriptors.get(module_name):
|
| - bail_error('Duplicate definition of module "%s" in %s' % (module_name, application_descriptor_filename))
|
| - module_json_filename = path.join(self.application_dir, module_name, 'module.json')
|
| - module_descriptors[module_name] = self._read_module_descriptor(module_name, application_descriptor_filename)
|
| -
|
| - for module in module_descriptors.values():
|
| - deps = module.get('dependencies', [])
|
| - for dep in deps:
|
| - if dep not in application_descriptor:
|
| - bail_error('Module "%s" (dependency of "%s") not listed in application descriptor %s' % (dep, module['name'], application_descriptor_filename))
|
| - return Descriptors(self.application_dir, application_descriptor, module_descriptors, application_descriptor_json)
|
| + return self.load_applications([application_descriptor_name])
|
| +
|
| + def load_applications(self, application_descriptor_names):
|
| + merged_application_descriptor = {}
|
| + all_module_descriptors = {}
|
| + for application_descriptor_name in application_descriptor_names:
|
| + module_descriptors = {}
|
| + application_descriptor_filename = path.join(self.application_dir, application_descriptor_name)
|
| + application_descriptor_json = read_file(application_descriptor_filename)
|
| + application_descriptor = {desc['name']: desc for desc in json.loads(application_descriptor_json)}
|
| + for name in application_descriptor:
|
| + merged_application_descriptor[name] = application_descriptor[name]
|
| +
|
| + for (module_name, module) in application_descriptor.items():
|
| + if module_descriptors.get(module_name):
|
| + bail_error('Duplicate definition of module "%s" in %s' % (module_name, application_descriptor_filename))
|
| + if not all_module_descriptors.get(module_name):
|
| + module_descriptors[module_name] = self._read_module_descriptor(module_name, application_descriptor_filename)
|
| + all_module_descriptors[module_name] = module_descriptors[module_name]
|
| +
|
| + for module in module_descriptors.values():
|
| + deps = module.get('dependencies', [])
|
| + for dep in deps:
|
| + if dep not in application_descriptor:
|
| + bail_error('Module "%s" (dependency of "%s") not listed in application descriptor %s' % (dep, module['name'], application_descriptor_filename))
|
| +
|
| + return Descriptors(self.application_dir, merged_application_descriptor, all_module_descriptors)
|
|
|
| def _read_module_descriptor(self, module_name, application_descriptor_filename):
|
| json_filename = path.join(self.application_dir, module_name, 'module.json')
|
|
|