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

Unified Diff: Source/devtools/scripts/modular_build.py

Issue 662393007: DevTools: Make compile_frontend.py check code from all applications (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comment Created 6 years, 2 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 | « Source/devtools/scripts/concatenate_application_code.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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')
« no previous file with comments | « Source/devtools/scripts/concatenate_application_code.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698