Bug 850380 - Derecursify and optimize XPIDL processing and move into precompile tier; r=glandium

This commit is contained in:
Gregory Szorc 2013-08-14 08:40:25 -07:00
Родитель e97edf2412
Коммит d87c91cf0c
73 изменённых файлов: 447 добавлений и 485 удалений

Просмотреть файл

@ -7,7 +7,3 @@
DIRS += ['src']
TEST_DIRS += ['tests']
XPIDL_FLAGS += [
'-I$(topsrcdir)/browser/components/',
]

Просмотреть файл

@ -4,10 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_FLAGS += [
'-I$(topsrcdir)/browser/components',
]
EXTRA_COMPONENTS += [
'BrowserPlaces.manifest',
'PlacesProtocolHandler.js',

Просмотреть файл

@ -365,7 +365,6 @@ MY_RULES := $(DEPTH)/config/myrules.mk
# Default command macros; can be overridden in <arch>.mk.
#
CCC = $(CXX)
XPIDL_LINK = $(PYTHON) $(LIBXUL_DIST)/sdk/bin/xpt.py link
# Java macros
JAVA_GEN_DIR = _javagen
@ -522,12 +521,8 @@ endif
endif
# Default location of include files
IDL_DIR = $(DIST)/idl
XPIDL_FLAGS += -I$(srcdir) -I$(IDL_DIR)
ifdef LIBXUL_SDK
XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
endif
IDL_PARSER_DIR = $(topsrcdir)/xpcom/idl-parser
IDL_PARSER_CACHE_DIR = $(DEPTH)/xpcom/idl-parser
SDK_LIB_DIR = $(DIST)/sdk/lib
SDK_BIN_DIR = $(DIST)/sdk/bin

Просмотреть файл

@ -15,17 +15,19 @@ SUPPRESS_DEFAULT_RULES := 1
include $(topsrcdir)/config/rules.mk
# We don't print the build status messages unless we're in a top level build
# otherwise the output is unexpected and it confuses downstream parsers.
define make_subtier_dir
@echo "BUILDSTATUS SUBTIER_START precompile $(1)"
$(MAKE) -C $(2) $(3)
+$(MAKE) -C $(2) $(3)
@echo "BUILDSTATUS SUBTIER_FINISH precompile $(1)"
endef
export::
@echo "BUILDSTATUS SUBTIERS IPDL WebIDL"
@echo "BUILDSTATUS SUBTIERS IPDL WebIDL XPIDL"
export:: ipdl webidl xpidl-parser
export:: ipdl webidl xpidl-parser xpidl
ipdl:
$(call make_subtier_dir,IPDL,$(DEPTH)/ipc/ipdl,ipdl)
@ -35,3 +37,7 @@ webidl:
xpidl-parser:
$(call make_subtier_dir,XPIDLParser,$(DEPTH)/xpcom/idl-parser,xpidl-parser)
xpidl: xpidl-parser
$(call py_action,process_install_manifest,$(DIST)/idl $(DEPTH)/_build_manifests/install/dist_idl)
$(call make_subtier_dir,XPIDL,$(DEPTH)/config/makefiles/xpidl,xpidl)

Просмотреть файл

@ -0,0 +1,67 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH := @DEPTH@
topsrcdir := @top_srcdir@
srcdir := @srcdir@
VPATH := @srcdir@
include $(DEPTH)/config/autoconf.mk
SUPPRESS_DEFAULT_RULES := 1
STANDALONE_MAKEFILE := 1
include $(topsrcdir)/config/rules.mk
# Building XPIDLs effectively consists of two steps:
#
# 1) Staging all .idl files to a common directory.
# 2) Doing everything with the .idl files.
#
# Each .idl file is processed into a .h file and typelib information.
# The .h file shares the same stem as the input file and is installed
# in the common headers include directory.
#
# XPIDL files are logically grouped together by modules. The typelib
# information for all XPIDLs in the same module is linked together into
# an .xpt file having the name of the module.
#
# As an optimization to reduce overall CPU usage, we process all .idl
# belonging to a module with a single command invocation. This prevents
# redundant parsing of .idl files and significantly reduces CPU cycles.
# For dependency files.
idl_deps_dir := .deps
# Where we put our final, linked .xpt files.
idl_xpt_dir := xpt
dist_idl_dir := $(DIST)/idl
dist_include_dir := $(DIST)/include
process_py := $(topsrcdir)/python/mozbuild/mozbuild/action/xpidl-process.py
# TODO we should use py_action, but that would require extra directories to be
# in the virtualenv.
idlprocess := $(PYTHON_PATH) $(PLY_INCLUDE) -I$(IDL_PARSER_DIR) -I$(IDL_PARSER_CACHE_DIR) \
$(process_py) --cache-dir $(IDL_PARSER_CACHE_DIR) $(dist_idl_dir) \
$(dist_include_dir) $(idl_xpt_dir) $(idl_deps_dir)
xpidl_modules := @xpidl_modules@
@xpidl_rules@
linked_xpt_files := $(addprefix $(idl_xpt_dir)/,$(addsuffix .xpt,$(xpidl_modules)))
depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp)
xpidl:: $(linked_xpt_files)
$(linked_xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(idl_xpt_dir))
ifdef .PYMAKE
-includedeps $(depends_files)
else
-include $(depends_files)
endif
.PHONY: xpidl

Просмотреть файл

@ -33,6 +33,10 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
XPIDL_MODULE \
$(NULL)
_DEPRECATED_VARIABLES := \
XPIDL_FLAGS \
$(NULL)
ifndef EXTERNALLY_MANAGED_MAKE_FILE
# Using $(firstword) may not be perfect. But it should be good enough for most
# scenarios.
@ -42,6 +46,10 @@ $(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $($(var)),\
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
))
$(foreach var,$(_DEPRECATED_VARIABLES),$(if $($(var)),\
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build)\
))
ifneq (,$(XPIDLSRCS)$(SDK_XPIDLSRCS))
$(error XPIDLSRCS and SDK_XPIDLSRCS have been merged and moved to moz.build files as the XPIDL_SOURCES variable. You must move these variables out of $(_current_makefile))
endif
@ -417,8 +425,6 @@ ifeq ($(SOLARIS_SUNPRO_CXX),1)
GARBAGE_DIRS += SunWS_cache
endif
XPIDL_GEN_DIR = _xpidlgen
ifdef MOZ_UPDATE_XTERM
# Its good not to have a newline at the end of the titlebar string because it
# makes the make -s output easier to read. Echo -n does not work on all
@ -1388,98 +1394,23 @@ endif
endif
################################################################################
# Export the elements of $(XPIDLSRCS)
# generating .h and .xpt files and moving them to the appropriate places.
ifneq ($(XPIDLSRCS),) #{
export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
ifndef XPIDL_MODULE
XPIDL_MODULE = $(MODULE)
endif
ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
export:: FORCE
@echo
@echo "*** Error processing XPIDLSRCS:"
@echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
@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 = \
$(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) \
$(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
# 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/typelib/xpt/tools \
$(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)))
XPT_PY = $(filter %/xpt.py,$(XPIDL_LINK))
xpidl-idl2xpt = $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
xpidl-module-deps = $(xpidl-idl2xpt) $(GLOBAL_DEPS) $(XPT_PY)
$(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(xpidl-module-deps)
$(XPIDL_LINK) $@ $(xpidl-idl2xpt)
$(XPT_PY):
$(MAKE) -C $(DEPTH)/xpcom/typelib/xpt/tools libs
endif # XPIDL_MODULE.xpt != XPIDLSRCS
# Install a linked .xpt into the appropriate place.
# This should ideally be performed by the non-recursive idl make file. Some day.
ifdef XPT_NAME #{
ifndef NO_DIST_INSTALL
XPIDL_MODULE_FILES := $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
XPIDL_MODULE_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += XPIDL_MODULE
_XPT_NAME_FILES := $(DEPTH)/config/makefiles/xpidl/xpt/$(XPT_NAME)
_XPT_NAME_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += _XPT_NAME
ifndef NO_INTERFACES_MANIFEST
libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)"
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
endif
endif
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
ifndef NO_DIST_INSTALL
XPIDL_HEADERS_FILES := $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
XPIDL_HEADERS_DEST := $(DIST)/include
XPIDL_HEADERS_TARGET := export
INSTALL_TARGETS += XPIDL_HEADERS
XPIDLSRCS_FILES := $(XPIDLSRCS)
XPIDLSRCS_DEST := $(IDL_DIR)
XPIDLSRCS_TARGET := export
INSTALL_TARGETS += XPIDLSRCS
endif
endif #} XPIDLSRCS
endif #} XPT_NAME
################################################################################
# Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
@ -1691,7 +1622,7 @@ endif
# it.
ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(sort $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt)),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(sort $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS)),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
ifneq (,$(MDDEPEND_FILES))
ifdef .PYMAKE
@ -1884,7 +1815,6 @@ FREEZE_VARIABLES = \
CSRCS \
CPPSRCS \
EXPORTS \
XPIDLSRCS \
DIRS \
LIBRARY \
MODULE \

Просмотреть файл

@ -15,9 +15,3 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_activities'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]

Просмотреть файл

@ -13,10 +13,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_alarm'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'
EXPORTS.mozilla.dom.alarm += [

Просмотреть файл

@ -14,11 +14,6 @@ XPIDL_SOURCES += [
'nsISiteSpecificUserAgent.idl',
]
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'
EXPORTS += [

Просмотреть файл

@ -10,13 +10,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_camera'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
'-I$(topsrcdir)/dom/media',
]
MODULE = 'dom'
EXPORTS += [

Просмотреть файл

@ -13,9 +13,3 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_cellbroadcast'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]

Просмотреть файл

@ -13,12 +13,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_file'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'
EXPORTS += [

Просмотреть файл

@ -11,10 +11,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_fm'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'
CPP_SOURCES += [

Просмотреть файл

@ -13,9 +13,3 @@ XPIDL_SOURCES += [
]
XPIDL_MODULE = 'dom_icc'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]

Просмотреть файл

@ -14,11 +14,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_indexeddb'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'
EXPORTS.mozilla.dom.indexedDB += [

Просмотреть файл

@ -15,10 +15,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_apps'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'

Просмотреть файл

@ -59,9 +59,5 @@ if CONFIG['MOZ_WEBSPEECH']:
XPIDL_MODULE = 'dom_base'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'

Просмотреть файл

@ -12,10 +12,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_contacts'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'

Просмотреть файл

@ -29,9 +29,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_core'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -33,10 +33,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_css'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/stylesheets',
]
MODULE = 'dom'

Просмотреть файл

@ -11,10 +11,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_devicestorage'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'

Просмотреть файл

@ -59,9 +59,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_events'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -15,9 +15,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_geolocation'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -68,10 +68,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_html'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/core',
]
MODULE = 'dom'

Просмотреть файл

@ -10,9 +10,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_json'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -10,9 +10,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_notification'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -11,9 +11,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_offline'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -11,9 +11,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_permissionsettings'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -10,9 +10,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_range'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -11,10 +11,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_settings'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'

Просмотреть файл

@ -10,12 +10,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_smil'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/core',
'-I$(topsrcdir)/dom/interfaces/events',
'-I$(topsrcdir)/dom/interfaces/svg',
]
MODULE = 'dom'

Просмотреть файл

@ -14,11 +14,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_storage'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'
EXPORTS += [

Просмотреть файл

@ -12,9 +12,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_stylesheets'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -12,11 +12,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_svg'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/core',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'

Просмотреть файл

@ -12,9 +12,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_traversal'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -10,9 +10,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_xbl'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]
MODULE = 'dom'

Просмотреть файл

@ -15,10 +15,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_xpath'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/core',
]
MODULE = 'dom'

Просмотреть файл

@ -29,11 +29,5 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_xul'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/core',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'

Просмотреть файл

@ -11,7 +11,3 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_messages'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]

Просмотреть файл

@ -29,9 +29,3 @@ if CONFIG['MOZ_B2G_RIL']:
XPIDL_MODULE = 'dom_mobilemessage'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]

Просмотреть файл

@ -27,9 +27,3 @@ if CONFIG['MOZ_B2G_RIL']:
]
XPIDL_MODULE = 'dom_network'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]

Просмотреть файл

@ -13,7 +13,3 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_payment'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/interfaces/base',
]

Просмотреть файл

@ -29,10 +29,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_system_gonk'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/network/interfaces',
]
MODULE = 'dom'
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':

Просмотреть файл

@ -10,12 +10,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_telephony'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'
CPP_SOURCES += [

Просмотреть файл

@ -13,12 +13,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_voicemail'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
]
MODULE = 'dom'
EXPORTS.mozilla.dom += [

Просмотреть файл

@ -12,13 +12,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom_wifi'
XPIDL_FLAGS += [
'-I$(topsrcdir)/dom/base',
'-I$(topsrcdir)/dom/interfaces/base',
'-I$(topsrcdir)/dom/interfaces/events',
'-I$(topsrcdir)/dom/system/gonk',
]
MODULE = 'dom'
EXTRA_COMPONENTS += [

Просмотреть файл

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsIRecoveryService.idl',
'gonk/nsIRecoveryService.idl',
]
MODULE = 'hal'

Просмотреть файл

@ -365,7 +365,6 @@ MY_RULES := $(DEPTH)/config/myrules.mk
# Default command macros; can be overridden in <arch>.mk.
#
CCC = $(CXX)
XPIDL_LINK = $(PYTHON) $(LIBXUL_DIST)/sdk/bin/xpt.py link
# Java macros
JAVA_GEN_DIR = _javagen
@ -522,12 +521,8 @@ endif
endif
# Default location of include files
IDL_DIR = $(DIST)/idl
XPIDL_FLAGS += -I$(srcdir) -I$(IDL_DIR)
ifdef LIBXUL_SDK
XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
endif
IDL_PARSER_DIR = $(topsrcdir)/xpcom/idl-parser
IDL_PARSER_CACHE_DIR = $(DEPTH)/xpcom/idl-parser
SDK_LIB_DIR = $(DIST)/sdk/lib
SDK_BIN_DIR = $(DIST)/sdk/bin

Просмотреть файл

@ -33,6 +33,10 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
XPIDL_MODULE \
$(NULL)
_DEPRECATED_VARIABLES := \
XPIDL_FLAGS \
$(NULL)
ifndef EXTERNALLY_MANAGED_MAKE_FILE
# Using $(firstword) may not be perfect. But it should be good enough for most
# scenarios.
@ -42,6 +46,10 @@ $(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $($(var)),\
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
))
$(foreach var,$(_DEPRECATED_VARIABLES),$(if $($(var)),\
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build)\
))
ifneq (,$(XPIDLSRCS)$(SDK_XPIDLSRCS))
$(error XPIDLSRCS and SDK_XPIDLSRCS have been merged and moved to moz.build files as the XPIDL_SOURCES variable. You must move these variables out of $(_current_makefile))
endif
@ -417,8 +425,6 @@ ifeq ($(SOLARIS_SUNPRO_CXX),1)
GARBAGE_DIRS += SunWS_cache
endif
XPIDL_GEN_DIR = _xpidlgen
ifdef MOZ_UPDATE_XTERM
# Its good not to have a newline at the end of the titlebar string because it
# makes the make -s output easier to read. Echo -n does not work on all
@ -1388,98 +1394,23 @@ endif
endif
################################################################################
# Export the elements of $(XPIDLSRCS)
# generating .h and .xpt files and moving them to the appropriate places.
ifneq ($(XPIDLSRCS),) #{
export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
ifndef XPIDL_MODULE
XPIDL_MODULE = $(MODULE)
endif
ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
export:: FORCE
@echo
@echo "*** Error processing XPIDLSRCS:"
@echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
@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 = \
$(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) \
$(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
# 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/typelib/xpt/tools \
$(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)))
XPT_PY = $(filter %/xpt.py,$(XPIDL_LINK))
xpidl-idl2xpt = $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
xpidl-module-deps = $(xpidl-idl2xpt) $(GLOBAL_DEPS) $(XPT_PY)
$(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(xpidl-module-deps)
$(XPIDL_LINK) $@ $(xpidl-idl2xpt)
$(XPT_PY):
$(MAKE) -C $(DEPTH)/xpcom/typelib/xpt/tools libs
endif # XPIDL_MODULE.xpt != XPIDLSRCS
# Install a linked .xpt into the appropriate place.
# This should ideally be performed by the non-recursive idl make file. Some day.
ifdef XPT_NAME #{
ifndef NO_DIST_INSTALL
XPIDL_MODULE_FILES := $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
XPIDL_MODULE_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += XPIDL_MODULE
_XPT_NAME_FILES := $(DEPTH)/config/makefiles/xpidl/xpt/$(XPT_NAME)
_XPT_NAME_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += _XPT_NAME
ifndef NO_INTERFACES_MANIFEST
libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)"
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
endif
endif
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
ifndef NO_DIST_INSTALL
XPIDL_HEADERS_FILES := $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
XPIDL_HEADERS_DEST := $(DIST)/include
XPIDL_HEADERS_TARGET := export
INSTALL_TARGETS += XPIDL_HEADERS
XPIDLSRCS_FILES := $(XPIDLSRCS)
XPIDLSRCS_DEST := $(IDL_DIR)
XPIDLSRCS_TARGET := export
INSTALL_TARGETS += XPIDLSRCS
endif
endif #} XPIDLSRCS
endif #} XPT_NAME
################################################################################
# Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
@ -1691,7 +1622,7 @@ endif
# it.
ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(sort $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt)),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(sort $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS)),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
ifneq (,$(MDDEPEND_FILES))
ifdef .PYMAKE
@ -1884,7 +1815,6 @@ FREEZE_VARIABLES = \
CSRCS \
CPPSRCS \
EXPORTS \
XPIDLSRCS \
DIRS \
LIBRARY \
MODULE \

Просмотреть файл

@ -13,6 +13,6 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
componentdir = js/xpconnect/tests/components
libs:: $(XPIDL_GEN_DIR)/$(MODULE).xpt
libs:: $(DEPTH)/config/makefiles/xpidl/xpt/$(MODULE).xpt
$(INSTALL) $^ $(testxpcobjdir)/$(componentdir)/native
$(INSTALL) $^ $(testxpcobjdir)/$(componentdir)/js

Просмотреть файл

@ -10,10 +10,6 @@ XPIDL_SOURCES += [
'nsIMIMEService.idl',
]
XPIDL_FLAGS += [
'-I$(topsrcdir)/netwerk/base/public',
]
MODULE = 'mimetype'
EXPORTS += [

Просмотреть файл

@ -11,10 +11,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'necko_file'
XPIDL_FLAGS += [
'-I$(topsrcdir)/netwerk/base/public',
]
MODULE = 'necko'
CPP_SOURCES += [

Просмотреть файл

@ -20,10 +20,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'necko_http'
XPIDL_FLAGS += [
'-I$(topsrcdir)/netwerk/base/public',
]
MODULE = 'necko'
EXPORTS += [

Просмотреть файл

@ -10,10 +10,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'necko_res'
XPIDL_FLAGS += [
'-I$(topsrcdir)/netwerk/base/public',
]
MODULE = 'necko'
CPP_SOURCES += [

Просмотреть файл

@ -10,10 +10,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'necko_viewsource'
XPIDL_FLAGS += [
'-I$(topsrcdir)/netwerk/base/public',
]
MODULE = 'necko'
CPP_SOURCES += [

Просмотреть файл

@ -10,10 +10,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'necko_wyciwyg'
XPIDL_FLAGS += [
'-I$(topsrcdir)/netwerk/base/public',
]
MODULE = 'necko'
EXPORTS.mozilla.net += [

Просмотреть файл

@ -20,9 +20,5 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
XPIDL_MODULE = 'necko_strconv'
XPIDL_FLAGS += [
'-I$(topsrcdir)/netwerk/base/public',
]
MODULE = 'necko'

Просмотреть файл

@ -0,0 +1,92 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This script is used to generate an output header and xpt file for
# input IDL file(s). It's purpose is to directly support the build
# system. The API will change to meet the needs of the build system.
import argparse
import os
import sys
from io import BytesIO
from header import print_header
from typelib import write_typelib
from xpidl import IDLParser
from xpt import xpt_link
from mozbuild.util import FileAvoidWrite
def process(input_dir, cache_dir, header_dir, xpt_dir, deps_dir, module, stems):
p = IDLParser(outputdir=cache_dir)
xpts = {}
deps = set()
# Write out dependencies for Python modules we import. If this list isn't
# up to date, we will not re-process XPIDL files if the processor changes.
for imported in ('header', 'typelib', 'xpidl', 'xpt'):
path = sys.modules[imported].__file__
if path.endswith('.pyc'):
path = path[0:-1]
deps.add(path)
for stem in stems:
path = os.path.join(input_dir, '%s.idl' % stem)
idl_data = open(path).read()
idl = p.parse(idl_data, filename=path)
idl.resolve([input_dir], p)
header_path = os.path.join(header_dir, '%s.h' % stem)
deps_path = os.path.join(deps_dir, '%s.pp' % stem)
xpt = BytesIO()
write_typelib(idl, xpt, path)
xpt.seek(0)
xpts[stem] = xpt
deps |= set(dep.replace('\\', '/') for dep in idl.deps)
with FileAvoidWrite(header_path) as fh:
print_header(idl, fh, path)
xpt_path = os.path.join(xpt_dir, '%s.xpt' % module)
with FileAvoidWrite(xpt_path) as fh:
xpt_link(xpts.values()).writefd(fh)
deps_path = os.path.join(deps_dir, '%s.pp' % module)
with FileAvoidWrite(deps_path) as fh:
# Need output to be consistent to avoid rewrites.
s_deps = sorted(deps)
fh.write('%s: %s\n' % (xpt_path, ' '.join(s_deps)))
for dep in s_deps:
fh.write('%s:\n' % dep)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--cache-dir',
help='Directory in which to find or write cached lexer data.')
parser.add_argument('inputdir',
help='Directory in which to find source .idl files.')
parser.add_argument('headerdir',
help='Directory in which to write header files.')
parser.add_argument('xptdir',
help='Directory in which to write xpt file.')
parser.add_argument('depsdir',
help='Directory in which to write dependency files.')
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.')
args = parser.parse_args()
process(args.inputdir, args.cache_dir, args.headerdir, args.xptdir,
args.depsdir, args.module, args.idls)

Просмотреть файл

@ -0,0 +1,58 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import unicode_literals
import mozpack.path as mozpath
from .base import BuildBackend
from ..frontend.data import XPIDLFile
class XPIDLManager(object):
"""Helps manage XPCOM IDLs in the context of the build system."""
def __init__(self, config):
self.config = config
self.topsrcdir = config.topsrcdir
self.topobjdir = config.topobjdir
self.idls = {}
self.modules = {}
def register_idl(self, source, module, allow_existing=False):
"""Registers an IDL file with this instance.
The IDL file will be built, installed, etc.
"""
basename = mozpath.basename(source)
root = mozpath.splitext(basename)[0]
entry = {
'source': source,
'module': module,
'basename': basename,
'root': root,
}
if not allow_existing and entry['basename'] in self.idls:
raise Exception('IDL already registered: %' % entry['basename'])
self.idls[entry['basename']] = entry
self.modules.setdefault(entry['module'], set()).add(entry['root'])
class CommonBackend(BuildBackend):
"""Holds logic common to all build backends."""
def _init(self):
self._idl_manager = XPIDLManager(self.environment)
def consume_object(self, obj):
if isinstance(obj, XPIDLFile):
self._idl_manager.register_idl(obj.source_path, obj.module)
def consume_finished(self):
if len(self._idl_manager.idls):
self._handle_idl_manager(self._idl_manager)

Просмотреть файл

@ -168,7 +168,7 @@ class ConfigEnvironment(object):
assert(isinstance(file, basestring))
return os.path.normpath(os.path.join(self.topsrcdir, "%s.in" % relpath(file, self.topobjdir)))
def create_config_file(self, path):
def create_config_file(self, path, extra=None):
'''Creates the given config file. A config file is generated by
taking the corresponding source file and replacing occurences of
"@VAR@" by the value corresponding to "VAR" in the substs dict.
@ -185,6 +185,8 @@ class ConfigEnvironment(object):
pp.context.update(srcdir = self.get_file_srcdir(path))
pp.context.update(relativesrcdir = self.get_relative_srcdir(path))
pp.context.update(DEPTH = self.get_depth(path))
if extra:
pp.context.update(extra)
pp.do_filter('attemptSubstitution')
pp.setMarker(None)

Просмотреть файл

@ -9,14 +9,14 @@ import logging
import os
import types
import mozpack.path
from mozpack.copier import FilePurger
from mozpack.manifests import (
InstallManifest,
PurgeManifest,
)
import mozpack.path as mozpath
from .base import BuildBackend
from .common import CommonBackend
from ..frontend.data import (
ConfigFileSubstitution,
DirectoryTraversal,
@ -25,6 +25,7 @@ from ..frontend.data import (
VariablePassthru,
Exports,
Program,
XPIDLFile,
XpcshellManifests,
)
from ..util import FileAvoidWrite
@ -75,6 +76,10 @@ class BackendMakeFile(object):
self.environment = environment
self.path = os.path.join(objdir, 'backend.mk')
# XPIDLFiles attached to this file.
self.idls = []
self.xpt_name = None
self.fh = FileAvoidWrite(self.path)
self.fh.write('# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.\n')
self.fh.write('\n')
@ -90,15 +95,24 @@ class BackendMakeFile(object):
# scan and build, installing the new Makefile.
self.fh.write('NO_SUBMAKEFILES_RULE := 1\n')
def write(self, buf):
self.fh.write(buf)
def close(self):
if self.xpt_name:
self.fh.write('XPT_NAME := %s\n' % self.xpt_name)
self.fh.write('NONRECURSIVE_TARGETS += export\n')
self.fh.write('NONRECURSIVE_TARGETS_export += xpidl\n')
self.fh.write('NONRECURSIVE_TARGETS_export_xpidl_DIRECTORY = '
'$(DEPTH)/config/makefiles/xpidl\n')
self.fh.write('NONRECURSIVE_TARGETS_export_xpidl_TARGETS += '
'xpt/%s' % self.xpt_name)
return self.fh.close()
class RecursiveMakeBackend(BuildBackend):
class RecursiveMakeBackend(CommonBackend):
"""Backend that integrates with the existing recursive make build system.
This backend facilitates the transition from Makefile.in to moz.build
@ -114,6 +128,8 @@ class RecursiveMakeBackend(BuildBackend):
"""
def _init(self):
CommonBackend._init(self)
self._backend_files = {}
self._ipdl_sources = set()
@ -140,6 +156,11 @@ class RecursiveMakeBackend(BuildBackend):
dist_public=PurgeManifest(relpath='dist/public'),
dist_sdk=PurgeManifest(relpath='dist/sdk'),
tests=PurgeManifest(relpath='_tests'),
xpidl=PurgeManifest(relpath='config/makefiles/xpidl'),
)
self._install_manifests = dict(
dist_idl=InstallManifest(),
)
def _update_from_avoid_write(self, result):
@ -155,6 +176,8 @@ class RecursiveMakeBackend(BuildBackend):
def consume_object(self, obj):
"""Write out build files necessary to build with recursive make."""
CommonBackend.consume_object(self, obj)
if not isinstance(obj, SandboxDerived):
return
@ -168,6 +191,9 @@ class RecursiveMakeBackend(BuildBackend):
backend_file.environment.create_config_file(obj.output_path))
self.backend_input_files.add(obj.input_path)
self.summary.managed_count += 1
elif isinstance(obj, XPIDLFile):
backend_file.idls.append(obj)
backend_file.xpt_name = '%s.xpt' % obj.module
elif isinstance(obj, VariablePassthru):
# Sorted so output is consistent and we don't bump mtimes.
for k, v in sorted(obj.variables.items()):
@ -181,7 +207,7 @@ class RecursiveMakeBackend(BuildBackend):
self._process_exports(obj.exports, backend_file)
elif isinstance(obj, IPDLFile):
self._ipdl_sources.add(mozpack.path.join(obj.srcdir, obj.basename))
self._ipdl_sources.add(mozpath.join(obj.srcdir, obj.basename))
elif isinstance(obj, Program):
self._process_program(obj.program, backend_file)
@ -192,6 +218,8 @@ class RecursiveMakeBackend(BuildBackend):
self._backend_files[obj.srcdir] = backend_file
def consume_finished(self):
CommonBackend.consume_finished(self)
for srcdir in sorted(self._backend_files.keys()):
bf = self._backend_files[srcdir]
@ -361,6 +389,44 @@ class RecursiveMakeBackend(BuildBackend):
self._process_exports(children[subdir], backend_file,
namespace=namespace + subdir)
def _handle_idl_manager(self, manager):
build_files = self._purge_manifests['xpidl']
for p in ('Makefile', 'backend.mk', '.deps/.mkdir.done',
'xpt/.mkdir.done'):
build_files.add(p)
for idl in manager.idls.values():
self._install_manifests['dist_idl'].add_symlink(idl['source'],
idl['basename'])
self._purge_manifests['dist_include'].add('%s.h' % idl['root'])
for module in manager.modules:
build_files.add(mozpath.join('xpt', '%s.xpt' % module))
build_files.add(mozpath.join('.deps', '%s.pp' % module))
modules = manager.modules
xpt_modules = sorted(modules.keys())
rules = []
for module in xpt_modules:
deps = sorted(modules[module])
rules.extend([
'$(idl_xpt_dir)/%s.xpt:' % module,
'\t@echo "$(notdir $@)"',
'\t$(idlprocess) $(basename $(notdir $@)) %s' % ' '.join(deps),
'',
])
out_path = os.path.join(self.environment.topobjdir, 'config',
'makefiles', 'xpidl', 'Makefile')
result = self.environment.create_config_file(out_path, extra=dict(
xpidl_rules='\n'.join(rules),
xpidl_modules=' '.join(xpt_modules),
))
self._update_from_avoid_write(result)
self.summary.managed_count += 1
def _process_program(self, program, backend_file):
backend_file.write('PROGRAM = %s\n' % program)

Просмотреть файл

@ -17,6 +17,8 @@ structures.
from __future__ import unicode_literals
import os
from collections import OrderedDict
@ -136,6 +138,22 @@ class VariablePassthru(SandboxDerived):
SandboxDerived.__init__(self, sandbox)
self.variables = {}
class XPIDLFile(SandboxDerived):
"""Describes an XPIDL file to be compiled."""
__slots__ = (
'basename',
'source_path',
)
def __init__(self, sandbox, source, module):
SandboxDerived.__init__(self, sandbox)
self.source_path = source
self.basename = os.path.basename(source)
self.module = module
class Exports(SandboxDerived):
"""Sandbox container object for EXPORTS, which is a HierarchicalStringList.

Просмотреть файл

@ -4,8 +4,13 @@
from __future__ import unicode_literals
import logging
import os
from mach.mixin.logging import LoggingMixin
import mozpack.path as mozpath
from .data import (
ConfigFileSubstitution,
DirectoryTraversal,
@ -14,13 +19,17 @@ from .data import (
Program,
ReaderSummary,
VariablePassthru,
XPIDLFile,
XpcshellManifests,
)
from .reader import MozbuildSandbox
from .reader import (
MozbuildSandbox,
SandboxValidationError,
)
class TreeMetadataEmitter(object):
class TreeMetadataEmitter(LoggingMixin):
"""Converts the executed mozbuild files into data structures.
This is a bridge between reader.py and data.py. It takes what was read by
@ -29,6 +38,8 @@ class TreeMetadataEmitter(object):
"""
def __init__(self, config):
self.populate_logger()
self.config = config
def emit(self, output):
@ -74,6 +85,27 @@ class TreeMetadataEmitter(object):
sub.relpath = path
yield sub
# XPIDL source files get processed and turned into .h and .xpt files.
# If there are multiple XPIDL files in a directory, they get linked
# together into a final .xpt, which has the name defined by either
# MODULE or XPIDL_MODULE (if the latter is defined).
xpidl_module = sandbox['MODULE']
if sandbox['XPIDL_MODULE']:
xpidl_module = sandbox['XPIDL_MODULE']
if sandbox['XPIDL_SOURCES'] and not xpidl_module:
raise SandboxValidationError('MODULE or XPIDL_MODULE must be '
'defined if XPIDL_SOURCES is defined.')
if sandbox['XPIDL_SOURCES'] and sandbox['NO_DIST_INSTALL']:
self.log(logging.WARN, 'mozbuild_warning', dict(
path=sandbox.main_path),
'{path}: NO_DIST_INSTALL has no effect on XPIDL_SOURCES.')
for idl in sandbox['XPIDL_SOURCES']:
yield XPIDLFile(sandbox, mozpath.join(sandbox['SRCDIR'], idl),
xpidl_module)
# Proxy some variables as-is until we have richer classes to represent
# them. We should aim to keep this set small because it violates the
# desired abstraction of the build definition away from makefiles.
@ -104,10 +136,7 @@ class TreeMetadataEmitter(object):
SHARED_LIBRARY_LIBS='SHARED_LIBRARY_LIBS',
SIMPLE_PROGRAMS='SIMPLE_PROGRAMS',
SSRCS='SSRCS',
XPIDL_FLAGS='XPIDL_FLAGS',
XPIDL_MODULE='XPIDL_MODULE',
XPIDLSRCS='XPIDL_SOURCES',
)
)
for mak, moz in varmap.items():
if sandbox[moz]:
passthru.variables[mak] = sandbox[moz]

Просмотреть файл

@ -295,10 +295,8 @@ VARIABLES = {
"""Module name.
Historically, this variable was used to describe where to install header
files, but that feature is now handled by EXPORTS_NAMESPACES. Currently
it is used as the XPIDL module name if XPIDL_MODULE is not defined, but
using XPIDL_MODULE directly is preferred. MODULE will likely be removed
in the future.
files, but that feature is now handled by EXPORTS_NAMESPACES. MODULE
will likely be removed in the future.
"""),
'EXPORTS': (HierarchicalStringList, list, HierarchicalStringList(),
@ -355,14 +353,6 @@ VARIABLES = {
MODULE.
"""),
'XPIDL_FLAGS': (list, list, [],
"""XPCOM Interface Definition Module Flags.
This is a list of extra flags that are passed to the IDL compiler.
Typically this is a set of -I flags that denote extra include
directories to search for included .idl files.
"""),
'IPDL_SOURCES': (StrictOrderingOnAppendList, list, [],
"""IPDL source files.

Просмотреть файл

@ -75,6 +75,11 @@ CONFIGS = {
'non_global_defines': [],
'substs': [],
},
'xpidl': {
'defines': [],
'non_global_defines': [],
'substs': [],
},
}
@ -95,9 +100,7 @@ class BackendTester(unittest.TestCase):
return ConfigEnvironment(srcdir, objdir, **config)
def _emit(self, name, env=None):
if not env:
env = self._get_environment(name)
env = env or self._get_environment(name)
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)

Просмотреть файл

@ -2,9 +2,7 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
XPIDL_SOURCES = ['bar.idl', 'biz.idl', 'foo.idl']
XPIDL_MODULE = 'module_name'
XPIDL_FLAGS = ['-Idir1', '-Idir2', '-Idir3']
MODULE = 'module_name'
ASFILES = ['bar.s', 'foo.asm']

Просмотреть файл

Просмотреть файл

@ -0,0 +1,6 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MODULE = 'my_module'
XPIDL_SOURCES = ['bar.idl', 'foo.idl']

Просмотреть файл

@ -217,19 +217,6 @@ class TestRecursiveMakeBackend(BackendTester):
'SSRCS += bar.S',
'SSRCS += foo.S',
],
'XPIDL_FLAGS': [
'XPIDL_FLAGS += -Idir1',
'XPIDL_FLAGS += -Idir2',
'XPIDL_FLAGS += -Idir3',
],
'XPIDL_MODULE': [
'XPIDL_MODULE := module_name'
],
'XPIDLSRCS': [
'XPIDLSRCS += bar.idl',
'XPIDLSRCS += biz.idl',
'XPIDLSRCS += foo.idl',
]
}
for var, val in expected.items():
@ -281,6 +268,34 @@ class TestRecursiveMakeBackend(BackendTester):
expected = ('aa', 'bb', 'cc', 'dd', 'valid_val')
self.assertEqual(xpclines, ["XPCSHELL_TESTS += %s" % val for val in expected])
def test_xpidl_generation(self):
"""Ensure xpidl files and directories are written out."""
env = self._consume('xpidl', RecursiveMakeBackend)
# Purge manifests should contain entries.
purge_dir = os.path.join(env.topobjdir, '_build_manifests', 'purge')
install_dir = os.path.join(env.topobjdir, '_build_manifests',
'install')
self.assertTrue(os.path.isfile(os.path.join(purge_dir, 'xpidl')))
self.assertTrue(os.path.isfile(os.path.join(install_dir, 'dist_idl')))
m = PurgeManifest(path=os.path.join(purge_dir, 'xpidl'))
self.assertIn('.deps/my_module.pp', m.entries)
self.assertIn('xpt/my_module.xpt', m.entries)
m = InstallManifest(path=os.path.join(install_dir, 'dist_idl'))
self.assertEqual(len(m), 2)
self.assertIn('bar.idl', m)
self.assertIn('foo.idl', m)
m = PurgeManifest(path=os.path.join(purge_dir, 'dist_include'))
self.assertIn('foo.h', m.entries)
p = os.path.join(env.topobjdir, 'config/makefiles/xpidl')
self.assertTrue(os.path.isdir(p))
self.assertTrue(os.path.isfile(os.path.join(p, 'Makefile')))
def test_xpcshell_master_manifest(self):
"""Ensure that the master xpcshell manifest is written out correctly."""
env = self._consume('xpcshell_manifests', RecursiveMakeBackend)

Просмотреть файл

@ -2,9 +2,7 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
XPIDL_SOURCES += ['bar.idl', 'biz.idl', 'foo.idl']
XPIDL_MODULE = 'module_name'
XPIDL_FLAGS += ['-Idir1', '-Idir2', '-Idir3']
MODULE = 'module_name'
ASFILES += ['fans.asm', 'tans.s']

Просмотреть файл

@ -144,14 +144,12 @@ class TestEmitterBasic(unittest.TestCase):
LIBRARY_NAME='lib_name',
LIBS=['fans.lib', 'tans.lib'],
NO_DIST_INSTALL='1',
MODULE='module_name',
SDK_LIBRARY=['fans.sdk', 'tans.sdk'],
SHARED_LIBRARY_LIBS=['fans.sll', 'tans.sll'],
SIMPLE_PROGRAMS=['fans.x', 'tans.x'],
SSRCS=['fans.S', 'tans.S'],
XPIDLSRCS=['bar.idl', 'biz.idl', 'foo.idl'],
XPIDL_MODULE='module_name',
XPIDL_FLAGS=['-Idir1', '-Idir2', '-Idir3'],
)
)
variables = objs[1].variables
self.assertEqual(len(variables), len(wanted))

Просмотреть файл

@ -20,7 +20,6 @@ VPATH += \
$(NULL)
LOCAL_INCLUDES += \
-I$(XPIDL_GEN_DIR) \
-I$(srcdir)/../google-breakpad/src/ \
$(NULL)
EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(MOZ_COMPONENT_LIBS) $(XPCOM_GLUE_LDOPTS)

Просмотреть файл

@ -18,8 +18,8 @@ PARSER_SRCS = \
SDK_BINARY = \
$(PARSER_SRCS) \
xpidllex.py \
xpidlyacc.py \
$(IDL_PARSER_CACHE_DIR)/xpidllex.py \
$(IDL_PARSER_CACHE_DIR)/xpidlyacc.py \
$(NULL)
SDK_BINARY_TARGET = xpidl-parser
@ -39,13 +39,13 @@ endif
include $(topsrcdir)/config/rules.mk
# Generate the PLY lexer and parser.
xpidllex.py: $(PARSER_SRCS) $(PLY_FILES)
$(IDL_PARSER_CACHE_DIR)/xpidllex.py: $(PARSER_SRCS) $(PLY_FILES)
$(PYTHON_PATH) \
$(PLY_INCLUDE) \
$(srcdir)/header.py --cachedir=. --regen
$(srcdir)/header.py --cachedir=$(IDL_PARSER_CACHE_DIR) --regen
# generating xpidllex.py generates xpidlyacc.py too
xpidlyacc.py: xpidllex.py
$(IDL_PARSER_CACHE_DIR)/xpidlyacc.py: $(IDL_PARSER_CACHE_DIR)/xpidllex.py
check::
$(PYTHON_PATH) \
@ -53,10 +53,12 @@ check::
-I. \
$(srcdir)/runtests.py
GARBAGE += \
garbage_files := \
xpidllex.py \
xpidllex.pyc \
xpidlyacc.py \
xpidlyacc.pyc \
xpidl_debug \
$(NULL)
GARBAGE += $(addprefix $(IDL_PARSER_CACHE_DIR)/,$(garbage_files))