Bug 1155816 - part 2 - move EXTRA_*COMPONENTS manifest check to build-backend time; r=mshal

Now that moz.build can see EXTRA_*COMPONENTS and NO_JS_MANIFEST, we can
move some logic from rules.mk (executed every build) to moz.build's
emitter.py (executed only at build-backend time).
This commit is contained in:
Nathan Froyd 2015-04-17 15:02:19 -04:00
parent cbc082742a
commit 206784f8f3
6 changed files with 15 additions and 11 deletions

View File

@ -1170,14 +1170,6 @@ endif #} XPT_NAME
################################################################################
# Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
ifneq (,$(filter %.js,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
ifeq (,$(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
ifndef NO_JS_MANIFEST
$(error .js component without matching .manifest. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0)
endif
endif
endif
ifdef EXTRA_COMPONENTS
misc:: $(EXTRA_COMPONENTS)
ifndef NO_DIST_INSTALL

View File

@ -526,6 +526,17 @@ class TreeMetadataEmitter(LoggingMixin):
for obj in self._process_xpidl(context):
yield obj
# Check for manifest declarations in EXTRA_{PP_,}COMPONENTS.
extras = context.get('EXTRA_COMPONENTS', []) + context.get('EXTRA_PP_COMPONENTS', [])
if any(e.endswith('.js') for e in extras) and \
not any(e.endswith('.manifest') for e in extras) and \
not context.get('NO_JS_MANIFEST', False):
raise SandboxValidationError('A .js component was specified in EXTRA_COMPONENTS '
'or EXTRA_PP_COMPONENTS without a matching '
'.manifest file. See '
'https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0 .',
context);
# 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.

View File

@ -2,7 +2,7 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
EXTRA_COMPONENTS = ['bar.js', 'foo.js']
EXTRA_COMPONENTS = ['bar.js', 'dummy.manifest', 'foo.js']
EXTRA_PP_COMPONENTS = ['bar.pp.js', 'foo.pp.js']
FAIL_ON_WARNINGS = True

View File

@ -265,6 +265,7 @@ class TestRecursiveMakeBackend(BackendTester):
],
'EXTRA_COMPONENTS': [
'EXTRA_COMPONENTS += bar.js',
'EXTRA_COMPONENTS += dummy.manifest',
'EXTRA_COMPONENTS += foo.js',
],
'EXTRA_PP_COMPONENTS': [

View File

@ -2,7 +2,7 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
EXTRA_COMPONENTS=['fans.js', 'tans.js']
EXTRA_COMPONENTS = ['dummy.manifest', 'fans.js', 'tans.js']
EXTRA_PP_COMPONENTS=['fans.pp.js', 'tans.pp.js']
FAIL_ON_WARNINGS = True

View File

@ -160,7 +160,7 @@ class TestEmitterBasic(unittest.TestCase):
wanted = {
'DISABLE_STL_WRAPPING': True,
'EXTRA_COMPONENTS': ['fans.js', 'tans.js'],
'EXTRA_COMPONENTS': ['dummy.manifest', 'fans.js', 'tans.js'],
'EXTRA_PP_COMPONENTS': ['fans.pp.js', 'tans.pp.js'],
'FAIL_ON_WARNINGS': True,
'MSVC_ENABLE_PGO': True,