Index: Tools/Scripts/webkitpy/bindings/main.py |
diff --git a/Tools/Scripts/webkitpy/bindings/main.py b/Tools/Scripts/webkitpy/bindings/main.py |
index 8a88f51adf9494d9d223bb42b139b71ab6831a4e..7fa1c9c2fa7fd66fbd2394c3f53d025c545d7d23 100644 |
--- a/Tools/Scripts/webkitpy/bindings/main.py |
+++ b/Tools/Scripts/webkitpy/bindings/main.py |
@@ -26,6 +26,7 @@ from contextlib import contextmanager |
import filecmp |
import fnmatch |
import os |
+import re |
import shutil |
import sys |
import tempfile |
@@ -91,6 +92,16 @@ def TemporaryDirectory(): |
shutil.rmtree(name) |
+COMPONENT_PATH_PATTERN = re.compile(r'/(core|modules)(/|$)') |
haraken
2014/09/10 11:16:50
How about using re.compile(r'/(core|modules|tests)
tasak
2014/09/11 02:52:01
So are you talking about the below fallback code?
|
+ |
+ |
+def detect_component_dir(path): |
+ match = COMPONENT_PATH_PATTERN.search(os.path.dirname(path)) |
+ if match: |
bashi
2014/09/10 11:22:54
When this check fails?
tasak
2014/09/11 02:52:01
Currently all code passes.
However, I this, we ne
tasak
2014/09/11 05:55:23
Now raise AssertionError if the check fails.
|
+ return match.group(1) |
+ return 'tests' |
+ |
+ |
def generate_interface_dependencies(): |
def idl_paths_recursive(directory): |
# This is slow, especially on Windows, due to os.walk making |
@@ -122,8 +133,15 @@ def generate_interface_dependencies(): |
# for each new component) and doesn't test the code generator any better |
# than using a single component. |
for idl_filename in idl_paths_recursive(source_path): |
- compute_info_individual(idl_filename, 'tests') |
+ compute_info_individual(idl_filename, detect_component_dir(idl_filename)) |
info_individuals = [info_individual()] |
+ # TestDictionary.{h,cpp} are placed under Source/bindings/tests/idls/core. |
bashi
2014/09/10 11:22:54
This is a bit hacky. Passing output_directory (not
tasak
2014/09/11 02:52:01
I'm not sure why CodeGeneratorDictionaryImpl does
|
+ # However, IdlCompiler generates TestDictionary.{h,cpp} by using relative_dir. |
+ # So the files will be generated under output_dir/core/bindings/tests/idls/core. |
+ # To avoid this issue, we need to clear relative_dir here. |
+ for info in info_individuals: |
+ for value in info['interfaces_info'].itervalues(): |
+ value['relative_dir'] = '' |
compute_interfaces_info_overall(info_individuals) |