зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1459721 - part 8 - pass full paths for IDL files to xpidl-process.py; r=chmanchester
The build system knows at build-backend time where to find each IDL file; making xpidl-process.py rediscover this by requiring xpidl-process.py to search through directories to find input IDL files is silly. To rememdy this, we're going to modify things so full paths are passed into the script. Those paths can then be used directly, with no searching.
This commit is contained in:
Родитель
33635829ac
Коммит
9bd5c61497
|
@ -41,7 +41,6 @@ code_gen_deps := $(topsrcdir)/xpcom/reflect/xptinfo/perfecthash.py
|
|||
$(PYTHON_PATH) $(PLY_INCLUDE) -I$(topsrcdir)/xpcom/idl-parser -I$(DEPTH)/xpcom/idl-parser/xpidl \
|
||||
$(process_py) --cache-dir $(DEPTH)/xpcom/idl-parser/xpidl --depsdir $(idl_deps_dir) \
|
||||
--bindings-conf $(topsrcdir)/dom/bindings/Bindings.conf \
|
||||
$(foreach dir,$($(basename $(notdir $@))_dirs),--input-dir $(dir)) \
|
||||
$(foreach dir,$(all_idl_dirs),-I $(dir)) \
|
||||
$(dist_include_dir) $(dist_xpcrs_dir) $(@D) \
|
||||
$(basename $(notdir $@)) $($(basename $(notdir $@))_deps)
|
||||
|
|
|
@ -28,7 +28,7 @@ from mozbuild.util import FileAvoidWrite
|
|||
|
||||
|
||||
def process(input_dirs, inc_paths, bindings_conf, cache_dir, header_dir,
|
||||
xpcrs_dir, xpt_dir, deps_dir, module, stems):
|
||||
xpcrs_dir, xpt_dir, deps_dir, module, idl_files):
|
||||
p = IDLParser(outputdir=cache_dir)
|
||||
|
||||
xpts = []
|
||||
|
@ -43,17 +43,10 @@ def process(input_dirs, inc_paths, bindings_conf, cache_dir, header_dir,
|
|||
# up to date, we will not re-process XPIDL files if the processor changes.
|
||||
rule.add_dependencies(iter_modules_in_path(topsrcdir))
|
||||
|
||||
def read_stem(stem):
|
||||
idl = '%s.idl' % stem
|
||||
for p in input_dirs:
|
||||
idl_file = os.path.join(topsrcdir, p, idl)
|
||||
if os.path.exists(idl_file):
|
||||
return idl_file, open(idl_file).read()
|
||||
|
||||
raise Exception('Could not find stem file for %s' % idl)
|
||||
|
||||
for stem in stems:
|
||||
path, idl_data = read_stem(stem)
|
||||
for path in idl_files:
|
||||
basename = os.path.basename(path)
|
||||
stem, _ = os.path.splitext(basename)
|
||||
idl_data = open(path).read()
|
||||
|
||||
idl = p.parse(idl_data, filename=path)
|
||||
idl.resolve(inc_paths, p, webidlconfig)
|
||||
|
@ -111,7 +104,7 @@ def main(argv):
|
|||
parser.add_argument('module',
|
||||
help='Final module name to use for linked output xpt file.')
|
||||
parser.add_argument('idls', nargs='+',
|
||||
help='Source .idl file(s). Specified as stems only.')
|
||||
help='Source .idl file(s).')
|
||||
parser.add_argument('-I', dest='incpath', action='append', default=[],
|
||||
help='Extra directories where to look for included .idl files.')
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class XPIDLManager(object):
|
|||
# can be found. Yes, we have XPIDL modules with files from
|
||||
# multiple directories.
|
||||
t = self.modules.setdefault(entry['module'], (set(), set()))
|
||||
t[0].add(entry['root'])
|
||||
t[0].add(entry['source'])
|
||||
t[1].add(dirname)
|
||||
|
||||
class BinariesCollection(object):
|
||||
|
|
|
@ -1056,7 +1056,6 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
sources, directories = modules[module]
|
||||
all_directories |= directories
|
||||
deps = sorted(sources)
|
||||
directories = sorted(directories)
|
||||
|
||||
# It may seem strange to have the .idl files listed as
|
||||
# prerequisites both here and in the auto-generated .pp files.
|
||||
|
@ -1070,8 +1069,6 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
# an mtime newer than the .xpt, it will trigger xpt generation.
|
||||
mk.add_statement('%s_deps = %s' % (module, ' '.join(deps)))
|
||||
|
||||
mk.add_statement('%s_dirs = %s' % (module, ' '.join(directories)))
|
||||
|
||||
build_files.add_optional_exists('%s.xpt' % module)
|
||||
|
||||
mk.add_statement('all_idl_dirs = %s' % ' '.join(sorted(all_directories)))
|
||||
|
|
|
@ -790,7 +790,7 @@ class TupBackend(CommonBackend):
|
|||
all_idl_directories.update(*map(lambda x: x[1], manager.modules.itervalues()))
|
||||
|
||||
all_xpts = []
|
||||
for module, (idls, directories) in sorted(manager.modules.iteritems()):
|
||||
for module, (idls, _) in sorted(manager.modules.iteritems()):
|
||||
cmd = [
|
||||
'$(PYTHON_PATH)',
|
||||
'$(PLY_INCLUDE)',
|
||||
|
@ -801,8 +801,6 @@ class TupBackend(CommonBackend):
|
|||
'--bindings-conf', '$(topsrcdir)/dom/bindings/Bindings.conf',
|
||||
]
|
||||
|
||||
for d in directories:
|
||||
cmd.extend(['--input-dir', d])
|
||||
for d in all_idl_directories:
|
||||
cmd.extend(['-I', d])
|
||||
|
||||
|
@ -816,9 +814,10 @@ class TupBackend(CommonBackend):
|
|||
|
||||
all_xpts.append('$(MOZ_OBJ_ROOT)/%s/%s.xpt' % (backend_file.relobjdir, module))
|
||||
outputs = ['%s.xpt' % module]
|
||||
outputs.extend(['$(MOZ_OBJ_ROOT)/dist/include/%s.h' % f for f in sorted(idls)])
|
||||
outputs.extend(['$(MOZ_OBJ_ROOT)/dist/xpcrs/rt/%s.rs' % f for f in sorted(idls)])
|
||||
outputs.extend(['$(MOZ_OBJ_ROOT)/dist/xpcrs/bt/%s.rs' % f for f in sorted(idls)])
|
||||
stems = sorted(mozpath.splitext(mozpath.basename(idl))[0] for idl in idls)
|
||||
outputs.extend(['$(MOZ_OBJ_ROOT)/dist/include/%s.h' % f for f in stems])
|
||||
outputs.extend(['$(MOZ_OBJ_ROOT)/dist/xpcrs/rt/%s.rs' % f for f in stems])
|
||||
outputs.extend(['$(MOZ_OBJ_ROOT)/dist/xpcrs/bt/%s.rs' % f for f in stems])
|
||||
backend_file.rule(
|
||||
inputs=[
|
||||
'$(MOZ_OBJ_ROOT)/xpcom/idl-parser/xpidl/xpidllex.py',
|
||||
|
|
Загрузка…
Ссылка в новой задаче