Bug 1455799 - Make an explicit webidl export target; r?chmanchester
By including codegen.pp and having a target for codegen.pp, we were
relying on make to build out-of-date include files and re-exec itself
after they are built. However, make produces an error if the file does
not exist, which is why this include was changed to a -include in
bug
1378965. Unfortunately this means that make ignores not only a
non-existent file, but also any errors in regenerating the target from
the webidl py_action.
Instead we can make a separate stub file target for webidl generation,
and include the codegen.pp that's generated as a side-effect of the
py_action. This way make will fail properly if the webidl generation
fails, and there is no error message about a missing codegen.pp on the
first build.
MozReview-Commit-ID: GjB8zDuMfnL
--- a/dom/bindings/Makefile.in
+++ b/dom/bindings/Makefile.in
@@ -23,29 +23,33 @@ include $(topsrcdir)/config/rules.mk
# changes to .webidl or .py files should result in code generation being
# performed. But we do pull in file-lists.jon to catch file additions.
codegen_dependencies := \
file-lists.json \
$(nonstatic_webidl_files) \
$(GLOBAL_DEPS) \
$(NULL)
+export:: webidl.stub
+
+# codegen.pp is created as a side-effect of the webidl action
-include codegen.pp
-codegen.pp: $(codegen_dependencies)
+webidl.stub: $(codegen_dependencies)
$(call py_action,webidl,$(srcdir))
@$(TOUCH) $@
.PHONY: compiletests
compiletests:
$(call SUBMAKE,libs,test)
endif
GARBAGE += \
+ webidl.stub \
codegen.pp \
codegen.json \
parser.out \
WebIDLGrammar.pkl \
$(wildcard *.h) \
$(wildcard *Binding.cpp) \
$(wildcard *Event.cpp) \
$(wildcard *-event.cpp) \
--- a/dom/bindings/mozwebidlcodegen/__init__.py
+++ b/dom/bindings/mozwebidlcodegen/__init__.py
@@ -585,17 +585,17 @@ def create_build_system_manager(topsrcdi
webidl_root,
inputs,
os.path.join(dist_dir, 'include', 'mozilla', 'dom'),
obj_dir,
os.path.join(obj_dir, 'codegen.json'),
cache_dir=cache_dir,
# The make rules include a codegen.pp file containing dependencies.
make_deps_path=os.path.join(obj_dir, 'codegen.pp'),
- make_deps_target='codegen.pp',
+ make_deps_target='webidl.stub',
)
class BuildSystemWebIDL(MozbuildObject):
@property
def manager(self):
if not hasattr(self, '_webidl_manager'):
self._webidl_manager = create_build_system_manager(