Bug 1304136 - Use a single AccEventGen.py invocation; r?chmanchester draft
authorMike Shal <mshal@mozilla.com>
Sun, 18 Sep 2016 15:30:32 -0400
changeset 415620 302e533db27e037d19de4f73a8d466f5229d8053
parent 415619 36bd3ad0b11d6852232e2607135eca54bbea0d50
child 531654 7d7c91c7db46f5e6a123e4d8e5243071f8dc52c8
push id29918
push userbmo:mshal@mozilla.com
push dateTue, 20 Sep 2016 19:24:34 +0000
reviewerschmanchester
bugs1304136
milestone52.0a1
Bug 1304136 - Use a single AccEventGen.py invocation; r?chmanchester MozReview-Commit-ID: 84OjUxxK1lg
accessible/xpcom/AccEventGen.py
accessible/xpcom/moz.build
--- a/accessible/xpcom/AccEventGen.py
+++ b/accessible/xpcom/AccEventGen.py
@@ -214,15 +214,15 @@ def write_cpp(eventname, iface, fd):
 def get_conf(conf_file):
     conf = Configuration(conf_file)
     inc_dir = [
         mozpath.join(buildconfig.topsrcdir, 'accessible', 'interfaces'),
         mozpath.join(buildconfig.topsrcdir, 'xpcom', 'base'),
     ]
     return conf, inc_dir
 
-def gen_header_file(fd, conf_file, xpidllex, xpidlyacc):
+def gen_files(fd, conf_file, xpidllex, xpidlyacc):
+    deps = set()
     conf, inc_dir = get_conf(conf_file)
-    return print_header_file(fd, conf, inc_dir)
-
-def gen_cpp_file(fd, conf_file, xpidllex, xpidlyacc):
-    conf, inc_dir = get_conf(conf_file)
-    return print_cpp_file(fd, conf, inc_dir)
+    deps.update(print_header_file(fd, conf, inc_dir))
+    with open('xpcAccEvents.cpp', 'w') as cpp_fd:
+        deps.update(print_cpp_file(cpp_fd, conf, inc_dir))
+    return deps
--- a/accessible/xpcom/moz.build
+++ b/accessible/xpcom/moz.build
@@ -47,27 +47,20 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
     LOCAL_INCLUDES += [
         '/accessible/mac',
     ]
 else:
     LOCAL_INCLUDES += [
         '/accessible/other',
     ]
 
-GENERATED_FILES += [
-    'xpcAccEvents.cpp',
-    'xpcAccEvents.h',
-]
+GENERATED_FILES += [('xpcAccEvents.h', 'xpcAccEvents.cpp')]
 
-xpc_acc_events_h = GENERATED_FILES['xpcAccEvents.h']
-xpc_acc_events_h.script = 'AccEventGen.py:gen_header_file'
-xpc_acc_events_h.inputs += ['AccEvents.conf', '!/xpcom/idl-parser/xpidl/xpidllex.py', '!/xpcom/idl-parser/xpidl/xpidlyacc.py']
-
-xpc_acc_events_cpp = GENERATED_FILES['xpcAccEvents.cpp']
-xpc_acc_events_cpp.script = 'AccEventGen.py:gen_cpp_file'
-xpc_acc_events_cpp.inputs += ['AccEvents.conf', '!/xpcom/idl-parser/xpidl/xpidllex.py', '!/xpcom/idl-parser/xpidl/xpidlyacc.py']
+xpc_acc = GENERATED_FILES[('xpcAccEvents.h', 'xpcAccEvents.cpp')]
+xpc_acc.script = 'AccEventGen.py:gen_files'
+xpc_acc.inputs += ['AccEvents.conf', '!/xpcom/idl-parser/xpidl/xpidllex.py', '!/xpcom/idl-parser/xpidl/xpidlyacc.py']
 
 FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 if CONFIG['GNU_CXX']:
     CXXFLAGS += ['-Wno-error=shadow']