Bug 754625 - Use idl-parser from $(LIBXUL_DIST)/sdk/bin and only remove lex and yacc files in header.py --regen. r=khuey
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 14 May 2012 17:19:39 +0200
changeset 98369 9e5b25074f9fd76c4095e5cf9518ee6cc16e45ba
parent 98368 2b84084855c38856cc500bd6138d5e3c21073147
child 98370 3bd6844f2898d2c83bf64ab68fa2626b73adcd5f
push id173
push userlsblakk@mozilla.com
push dateFri, 24 Aug 2012 15:39:16 +0000
treeherdermozilla-release@bcc45eb1fb41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs754625
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 754625 - Use idl-parser from $(LIBXUL_DIST)/sdk/bin and only remove lex and yacc files in header.py --regen. r=khuey
config/rules.mk
js/src/config/rules.mk
js/xpconnect/src/Makefile.in
js/xpconnect/src/dictionary_helper_gen.py
toolkit/mozapps/installer/packager.mk
xpcom/idl-parser/Makefile.in
xpcom/idl-parser/header.py
xpcom/typelib/xpidl/Makefile.in
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1404,45 +1404,43 @@ export:: FORCE
 	@echo "so we have a module name to use when creating MODULE.xpt."
 	@echo; sleep 2; false
 endif
 
 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include;
 # warn against overriding existing .h file.
 
 XPIDL_DEPS = \
-  $(topsrcdir)/xpcom/idl-parser/header.py \
-  $(topsrcdir)/xpcom/idl-parser/typelib.py \
-  $(topsrcdir)/xpcom/idl-parser/xpidl.py \
+  $(LIBXUL_DIST)/sdk/bin/header.py \
+  $(LIBXUL_DIST)/sdk/bin/typelib.py \
+  $(LIBXUL_DIST)/sdk/bin/xpidl.py \
   $(NULL)
 
 xpidl-preqs = \
   $(call mkdir_deps,$(XPIDL_GEN_DIR)) \
   $(call mkdir_deps,$(MDDEPDIR)) \
   $(NULL)
 
 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
 	$(REPORT_BUILD)
 	$(PYTHON_PATH) \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
-	  $(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser/cache $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
+	  $(LIBXUL_DIST)/sdk/bin/header.py $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
 	@if test -n "$(findstring $*.h, $(EXPORTS))"; \
 	  then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
 
 ifndef NO_GEN_XPT
 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
 	$(REPORT_BUILD)
 	$(PYTHON_PATH) \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
 	  -I$(topsrcdir)/xpcom/typelib/xpt/tools \
-	  $(topsrcdir)/xpcom/idl-parser/typelib.py --cachedir=$(DEPTH)/xpcom/idl-parser/cache $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
+	  $(LIBXUL_DIST)/sdk/bin/typelib.py $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
 
 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -1404,45 +1404,43 @@ export:: FORCE
 	@echo "so we have a module name to use when creating MODULE.xpt."
 	@echo; sleep 2; false
 endif
 
 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include;
 # warn against overriding existing .h file.
 
 XPIDL_DEPS = \
-  $(topsrcdir)/xpcom/idl-parser/header.py \
-  $(topsrcdir)/xpcom/idl-parser/typelib.py \
-  $(topsrcdir)/xpcom/idl-parser/xpidl.py \
+  $(LIBXUL_DIST)/sdk/bin/header.py \
+  $(LIBXUL_DIST)/sdk/bin/typelib.py \
+  $(LIBXUL_DIST)/sdk/bin/xpidl.py \
   $(NULL)
 
 xpidl-preqs = \
   $(call mkdir_deps,$(XPIDL_GEN_DIR)) \
   $(call mkdir_deps,$(MDDEPDIR)) \
   $(NULL)
 
 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
 	$(REPORT_BUILD)
 	$(PYTHON_PATH) \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
-	  $(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser/cache $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
+	  $(LIBXUL_DIST)/sdk/bin/header.py $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
 	@if test -n "$(findstring $*.h, $(EXPORTS))"; \
 	  then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
 
 ifndef NO_GEN_XPT
 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
 	$(REPORT_BUILD)
 	$(PYTHON_PATH) \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
 	  -I$(topsrcdir)/xpcom/typelib/xpt/tools \
-	  $(topsrcdir)/xpcom/idl-parser/typelib.py --cachedir=$(DEPTH)/xpcom/idl-parser/cache $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
+	  $(LIBXUL_DIST)/sdk/bin/typelib.py $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
 
 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
--- a/js/xpconnect/src/Makefile.in
+++ b/js/xpconnect/src/Makefile.in
@@ -142,97 +142,92 @@ endif
 nsXPConnect.$(OBJ_SUFFIX): dom_quickstubs.h
 
 XPCJSRuntime.$(OBJ_SUFFIX): dom_quickstubs.h
 
 dom_quickstubs.h: dom_quickstubs.cpp
 
 dom_quickstubs.cpp: $(srcdir)/dom_quickstubs.qsconf \
                     $(srcdir)/qsgen.py \
-                    $(topsrcdir)/xpcom/idl-parser/header.py \
-                    $(topsrcdir)/xpcom/idl-parser/xpidl.py \
+                    $(LIBXUL_DIST)/sdk/bin/header.py \
+                    $(LIBXUL_DIST)/sdk/bin/xpidl.py \
                     $(DEPTH)/js/src/js-confdefs.h
 	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
+	  -I$(LIBXUL_DIST)/sdk/bin \
 	  $(srcdir)/qsgen.py \
 	  --idlpath=$(DEPTH)/dist/idl \
-	  --cachedir=$(DEPTH)/xpcom/idl-parser/cache \
 	  --header-output dom_quickstubs.h \
 	  --stub-output dom_quickstubs.cpp \
 	  --makedepend-output $(MDDEPDIR)/dom_qsgen.pp \
 	  $(ENABLE_TRACEABLE_FLAGS) \
 	  $(srcdir)/dom_quickstubs.qsconf
 
 dombindings.$(OBJ_SUFFIX): dombindings_gen.h \
                            dombindings_gen.cpp
 
 dombindings_gen.h: $(srcdir)/dombindings.conf \
                    $(srcdir)/dombindingsgen.py \
                    $(srcdir)/codegen.py \
-                   $(topsrcdir)/xpcom/idl-parser/header.py \
-                   $(topsrcdir)/xpcom/idl-parser/xpidl.py \
+                   $(LIBXUL_DIST)/sdk/bin/header.py \
+                   $(LIBXUL_DIST)/sdk/bin/xpidl.py \
                    $(DEPTH)/js/src/js-confdefs.h
 	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
+	  -I$(LIBXUL_DIST)/sdk/bin \
 	  $(srcdir)/dombindingsgen.py \
 	  --idlpath=$(DEPTH)/dist/idl \
-	  --cachedir=$(DEPTH)/xpcom/idl-parser/cache \
 	  --header-output dombindings_gen.h \
 	  $(srcdir)/dombindings.conf
 
 exports:: dombindings_gen.h
 
 dombindings_gen.cpp: $(srcdir)/dombindings.conf \
                      $(srcdir)/dombindingsgen.py \
                      $(srcdir)/codegen.py \
-                     $(topsrcdir)/xpcom/idl-parser/header.py \
-                     $(topsrcdir)/xpcom/idl-parser/xpidl.py \
+                     $(LIBXUL_DIST)/sdk/bin/header.py \
+                     $(LIBXUL_DIST)/sdk/bin/xpidl.py \
                      $(DEPTH)/js/src/js-confdefs.h
 	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
+	  -I$(LIBXUL_DIST)/sdk/bin \
 	  $(srcdir)/dombindingsgen.py \
 	  --idlpath=$(DEPTH)/dist/idl \
-	  --cachedir=$(DEPTH)/xpcom/idl-parser/cache \
 	  --stub-output dombindings_gen.cpp \
 	  --makedepend-output $(MDDEPDIR)/dombindingsgen.pp \
 	  $(srcdir)/dombindings.conf
 
 DictionaryHelpers.$(OBJ_SUFFIX): DictionaryHelpers.h \
                                  DictionaryHelpers.cpp
 
 DictionaryHelpers.h: $(srcdir)/dictionary_helper_gen.conf \
                      $(srcdir)/dictionary_helper_gen.py \
                      $(srcdir)/codegen.py \
-                     $(topsrcdir)/xpcom/idl-parser/header.py \
-                     $(topsrcdir)/xpcom/idl-parser/xpidl.py \
+                     $(LIBXUL_DIST)/sdk/bin/header.py \
+                     $(LIBXUL_DIST)/sdk/bin/xpidl.py \
                      $(DEPTH)/js/src/js-confdefs.h
 	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
+	  -I$(LIBXUL_DIST)/sdk/bin \
 	  $(srcdir)/dictionary_helper_gen.py \
 	  -I $(DEPTH)/dist/idl \
-	  --cachedir=$(DEPTH)/xpcom/idl-parser/cache \
 	  --header-output DictionaryHelpers.h \
 	  $(srcdir)/dictionary_helper_gen.conf
 
 DictionaryHelpers.cpp: $(srcdir)/dictionary_helper_gen.conf \
                        $(srcdir)/dictionary_helper_gen.py \
                        $(srcdir)/codegen.py \
-                       $(topsrcdir)/xpcom/idl-parser/header.py \
-                       $(topsrcdir)/xpcom/idl-parser/xpidl.py \
+                       $(LIBXUL_DIST)/sdk/bin/header.py \
+                       $(LIBXUL_DIST)/sdk/bin/xpidl.py \
                        $(DEPTH)/js/src/js-confdefs.h
 	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
+	  -I$(LIBXUL_DIST)/sdk/bin \
 	  $(srcdir)/dictionary_helper_gen.py \
 	  -I $(DEPTH)/dist/idl \
-	  --cachedir=$(DEPTH)/xpcom/idl-parser/cache \
 	  --header-output DictionaryHelpers.h \
 	  --stub-output DictionaryHelpers.cpp \
 	  --makedepend-output $(MDDEPDIR)/dictionary_helper_gen.pp \
 	  $(srcdir)/dictionary_helper_gen.conf
 
 _EXTRA_EXPORT_FILES = \
   DictionaryHelpers.h \
   $(NULL)
--- a/js/xpconnect/src/dictionary_helper_gen.py
+++ b/js/xpconnect/src/dictionary_helper_gen.py
@@ -455,17 +455,17 @@ if __name__ == '__main__':
                  help="Directory to search for imported files")
     o.add_option('-o', "--stub-output",
                  type='string', dest='stub_output', default=None,
                  help="Quick stub C++ source output file", metavar="FILE")
     o.add_option('--header-output', type='string', default=None,
                  help="Quick stub header output file", metavar="FILE")
     o.add_option('--makedepend-output', type='string', default=None,
                  help="gnumake dependencies output file", metavar="FILE")
-    o.add_option('--cachedir', dest='cachedir', default='',
+    o.add_option('--cachedir', dest='cachedir', default=None,
                  help="Directory in which to cache lex/parse tables.")
     (options, filenames) = o.parse_args()
     if len(filenames) != 1:
         o.error("Exactly one config filename is needed.")
     filename = filenames[0]
 
     if options.cachedir is not None:
         if not os.path.isdir(options.cachedir):
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -926,16 +926,17 @@ ifdef INSTALL_SDK # Here comes the hard 
 	(cd $(DIST)/idl && tar $(TAR_CREATE_FLAGS) - .) | \
 	  (cd $(DESTDIR)$(idldir) && tar -xf -)
 # SDK directory is the libs + a bunch of symlinks
 	$(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/lib
 	$(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/bin
 	if test -f $(DIST)/include/xpcom-config.h; then \
 	  $(SYSINSTALL) $(IFLAGS1) $(DIST)/include/xpcom-config.h $(DESTDIR)$(sdkdir); \
 	fi
+	find $(DIST)/sdk -name "*.pyc" | xargs rm
 	(cd $(DIST)/sdk/lib && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/lib && tar -xf -)
 	(cd $(DIST)/sdk/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/bin && tar -xf -)
 	$(RM) -f $(DESTDIR)$(sdkdir)/lib $(DESTDIR)$(sdkdir)/bin $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/sdk/idl $(DESTDIR)$(sdkdir)/idl
 	ln -s $(sdkdir)/sdk/lib $(DESTDIR)$(sdkdir)/lib
 	ln -s $(installdir) $(DESTDIR)$(sdkdir)/bin
 	ln -s $(includedir) $(DESTDIR)$(sdkdir)/include
 	ln -s $(idldir) $(DESTDIR)$(sdkdir)/idl
 endif # INSTALL_SDK
@@ -946,16 +947,17 @@ make-sdk:
 	$(RM) -rf $(DIST)/$(MOZ_APP_NAME)-sdk
 	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/bin
 	(cd $(DIST)/sdk-stage && tar $(TAR_CREATE_FLAGS) - .) | \
 	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/bin && tar -xf -)
 	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin
 	(cd $(DIST)/host/bin && tar $(TAR_CREATE_FLAGS) - .) | \
 	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin && tar -xf -)
 	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/sdk
+	find $(DIST)/sdk -name "*.pyc" | xargs rm
 	(cd $(DIST)/sdk && tar $(TAR_CREATE_FLAGS) - .) | \
 	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/sdk && tar -xf -)
 	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/include
 	(cd $(DIST)/include && tar $(TAR_CREATE_FLAGS) - .) | \
 	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/include && tar -xf -)
 	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/idl
 	(cd $(DIST)/idl && tar $(TAR_CREATE_FLAGS) - .) | \
 	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/idl && tar -xf -)
--- a/xpcom/idl-parser/Makefile.in
+++ b/xpcom/idl-parser/Makefile.in
@@ -55,24 +55,23 @@ PLY_PROGS = \
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 # Generate the PLY lexer and parser.
 export:: $(PARSER_SRCS) $(PLY_PROGS)
 	$(PYTHON_PATH) \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
-	  $(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser/cache --regen
+	  $(srcdir)/header.py --cachedir=. --regen
 
 check::
 	$(PYTHON_PATH) \
 	  $(PLY_INCLUDE) \
-	  -I$(topsrcdir)/xpcom/idl-parser \
-	  $(topsrcdir)/xpcom/idl-parser/runtests.py
+	  -I. \
+	  $(srcdir)/runtests.py
 
 GARBAGE += \
   xpidllex.py \
   xpidllex.pyc \
   xpidlyacc.py \
   xpidlyacc.pyc \
   xpidl_debug \
   $(NULL)
--- a/xpcom/idl-parser/header.py
+++ b/xpcom/idl-parser/header.py
@@ -500,19 +500,17 @@ if __name__ == '__main__':
         sys.path.append(options.cachedir)
 
     # The only thing special about a regen is that there are no input files.
     if options.regen:
         if options.cachedir is None:
             print >>sys.stderr, "--regen useless without --cachedir"
         # Delete the lex/yacc files.  Ply is too stupid to regenerate them
         # properly
-        deadfiles = os.path.join(options.cachedir, "*.py*")
-        for filename in glob.glob(deadfiles):
-            print filename
+        for filename in [os.path.join(options.cachedir, f) for f in ["xpidllex.py", "xpidlyacc.py"]]:
             os.remove(filename)
 
     # Instantiate the parser.
     p = xpidl.IDLParser(outputdir=options.cachedir)
 
     if options.regen:
         sys.exit(0)
 
--- a/xpcom/typelib/xpidl/Makefile.in
+++ b/xpcom/typelib/xpidl/Makefile.in
@@ -43,18 +43,18 @@ VPATH		= @srcdir@
 include $(topsrcdir)/config/config.mk
 
 MODULE		= xpcom
 
 SDK_BINARY = \
   $(topsrcdir)/xpcom/idl-parser/xpidl.py \
   $(topsrcdir)/xpcom/idl-parser/header.py \
   $(topsrcdir)/xpcom/idl-parser/typelib.py \
-  $(DEPTH)/xpcom/idl-parser/cache/xpidllex.py \
-  $(DEPTH)/xpcom/idl-parser/cache/xpidlyacc.py \
+  $(DEPTH)/xpcom/idl-parser/xpidllex.py \
+  $(DEPTH)/xpcom/idl-parser/xpidlyacc.py \
   $(NULL)
 
 ifndef MOZ_SYSTEM_PLY
 $(SDK_BIN_DIR)/ply::
 	$(NSINSTALL) -D $@
 
 PLY_SRCS = \
   $(topsrcdir)/other-licenses/ply/ply/__init__.py \