From fe90037862ec1d1a65a534ea70534f2ed78479fa Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sat, 9 May 2015 08:24:18 +0900 Subject: [PATCH] Bug 1043692 - Add a DIST_INSTALL variable to moz.build, and replace NO_DIST_INSTALL with it. r=gps --- build/unix/elfhack/inject/moz.build | 2 +- build/unix/elfhack/moz.build | 2 +- config/moz.build | 2 +- dom/media/gmp-plugin/moz.build | 2 +- .../test/testplugin/testplugin.mozbuild | 2 +- js/xpconnect/tests/components/js/moz.build | 2 +- .../tests/components/native/moz.build | 2 +- .../lib/gb/libstagefright/moz.build | 2 +- .../libstagefright_color_conversion/moz.build | 2 +- media/omx-plugin/lib/gb/libutils/moz.build | 2 +- .../lib/gb235/libstagefright/moz.build | 2 +- .../lib/hc/libstagefright/moz.build | 2 +- .../lib/ics/libstagefright/moz.build | 2 +- media/omx-plugin/lib/ics/libutils/moz.build | 2 +- .../lib/ics/libvideoeditorplayer/moz.build | 2 +- memory/replace/dummy/moz.build | 2 +- mozglue/linker/tests/moz.build | 2 +- python/mozbuild/mozbuild/frontend/context.py | 39 +++++++++++++++++-- python/mozbuild/mozbuild/frontend/data.py | 2 +- python/mozbuild/mozbuild/frontend/emitter.py | 13 +++++-- .../frontend/data/variable-passthru/moz.build | 2 +- .../ssl/tests/unit/pkcs11testmodule/moz.build | 2 +- toolkit/components/ctypes/tests/moz.build | 2 +- toolkit/crashreporter/test/moz.build | 2 +- .../update/updater/updater-xpcshell/moz.build | 2 +- xpcom/tests/bug656331_component/moz.build | 2 +- xpcom/tests/component/moz.build | 2 +- xpcom/tests/component_no_aslr/moz.build | 2 +- 28 files changed, 70 insertions(+), 34 deletions(-) diff --git a/build/unix/elfhack/inject/moz.build b/build/unix/elfhack/inject/moz.build index d0edb3ae7750..f13c1e24cb05 100644 --- a/build/unix/elfhack/inject/moz.build +++ b/build/unix/elfhack/inject/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['TARGET_CPU'].endswith('86'): cpu = 'x86' diff --git a/build/unix/elfhack/moz.build b/build/unix/elfhack/moz.build index e5cdae5ecb09..95b58391968c 100644 --- a/build/unix/elfhack/moz.build +++ b/build/unix/elfhack/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False DIRS += ['inject'] if not CONFIG['CROSS_COMPILE']: diff --git a/config/moz.build b/config/moz.build index 76f99bdd6e04..dbf819cb9899 100644 --- a/config/moz.build +++ b/config/moz.build @@ -7,7 +7,7 @@ with Files('**'): BUG_COMPONENT = ('Core', 'Build Config') -NO_DIST_INSTALL = True +DIST_INSTALL = False # For sanity's sake, we compile nsinstall without the wrapped system # headers, so that we can use it to set up the wrapped system headers. NO_VISIBILITY_FLAGS = True diff --git a/dom/media/gmp-plugin/moz.build b/dom/media/gmp-plugin/moz.build index 79233e691af4..96c5661db4fd 100644 --- a/dom/media/gmp-plugin/moz.build +++ b/dom/media/gmp-plugin/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False SOURCES += [ 'gmp-fake.cpp', 'gmp-test-decryptor.cpp', diff --git a/dom/plugins/test/testplugin/testplugin.mozbuild b/dom/plugins/test/testplugin/testplugin.mozbuild index e194773d6b2e..68e70522ebdf 100644 --- a/dom/plugins/test/testplugin/testplugin.mozbuild +++ b/dom/plugins/test/testplugin/testplugin.mozbuild @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False UNIFIED_SOURCES += [ '%s/%s' % (relative_path, p) for p in [ 'nptest.cpp', diff --git a/js/xpconnect/tests/components/js/moz.build b/js/xpconnect/tests/components/js/moz.build index b79124b6db67..839631444920 100644 --- a/js/xpconnect/tests/components/js/moz.build +++ b/js/xpconnect/tests/components/js/moz.build @@ -3,4 +3,4 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False diff --git a/js/xpconnect/tests/components/native/moz.build b/js/xpconnect/tests/components/native/moz.build index e0a444369c6a..8a25f97212d9 100644 --- a/js/xpconnect/tests/components/native/moz.build +++ b/js/xpconnect/tests/components/native/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False UNIFIED_SOURCES += [ 'xpctest_attributes.cpp', diff --git a/media/omx-plugin/lib/gb/libstagefright/moz.build b/media/omx-plugin/lib/gb/libstagefright/moz.build index 273f530f362b..79427559b7e7 100644 --- a/media/omx-plugin/lib/gb/libstagefright/moz.build +++ b/media/omx-plugin/lib/gb/libstagefright/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build b/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build index 31bc2885bfcf..420aeb532c48 100644 --- a/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build +++ b/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/media/omx-plugin/lib/gb/libutils/moz.build b/media/omx-plugin/lib/gb/libutils/moz.build index 5c5ce7c3cbb1..f81b4cfd6af3 100644 --- a/media/omx-plugin/lib/gb/libutils/moz.build +++ b/media/omx-plugin/lib/gb/libutils/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/media/omx-plugin/lib/gb235/libstagefright/moz.build b/media/omx-plugin/lib/gb235/libstagefright/moz.build index 273f530f362b..79427559b7e7 100644 --- a/media/omx-plugin/lib/gb235/libstagefright/moz.build +++ b/media/omx-plugin/lib/gb235/libstagefright/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/media/omx-plugin/lib/hc/libstagefright/moz.build b/media/omx-plugin/lib/hc/libstagefright/moz.build index 273f530f362b..79427559b7e7 100644 --- a/media/omx-plugin/lib/hc/libstagefright/moz.build +++ b/media/omx-plugin/lib/hc/libstagefright/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/media/omx-plugin/lib/ics/libstagefright/moz.build b/media/omx-plugin/lib/ics/libstagefright/moz.build index f5aebaca8c42..71b733e3b975 100644 --- a/media/omx-plugin/lib/ics/libstagefright/moz.build +++ b/media/omx-plugin/lib/ics/libstagefright/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/media/omx-plugin/lib/ics/libutils/moz.build b/media/omx-plugin/lib/ics/libutils/moz.build index 04aedf670430..ffa5ec4d895a 100644 --- a/media/omx-plugin/lib/ics/libutils/moz.build +++ b/media/omx-plugin/lib/ics/libutils/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build b/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build index a65d24f489e6..09a43e0588d1 100644 --- a/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build +++ b/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': SOURCES += [ diff --git a/memory/replace/dummy/moz.build b/memory/replace/dummy/moz.build index 88b7d6fb6127..219598d88b1b 100644 --- a/memory/replace/dummy/moz.build +++ b/memory/replace/dummy/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False SOURCES += [ 'dummy_replace_malloc.c', diff --git a/mozglue/linker/tests/moz.build b/mozglue/linker/tests/moz.build index a42f3c9505c5..f0421b33f30c 100644 --- a/mozglue/linker/tests/moz.build +++ b/mozglue/linker/tests/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False SimplePrograms([ 'TestZip', diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 58ec0fac3b81..1c81a75fa1f4 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -318,6 +318,21 @@ class FinalTargetValue(ContextDerivedValue, unicode): return unicode.__new__(cls, value) +def Enum(*values): + assert len(values) + default = values[0] + + class EnumClass(object): + def __new__(cls, value=None): + if value is None: + return default + if value in values: + return value + raise ValueError('Invalid value. Allowed values are: %s' + % ', '.join(repr(v) for v in values)) + return EnumClass + + class SourcePath(ContextDerivedValue, UserString): """Stores and resolves a source path relative to a given context @@ -1094,11 +1109,17 @@ VARIABLES = { ends with ``HOST_BIN_SUFFIX``, ``HOST_PROGRAM`` will remain unchanged. """, None), - 'NO_DIST_INSTALL': (bool, bool, - """Disable installing certain files into the distribution directory. + 'DIST_INSTALL': (Enum(None, False, True), bool, + """Whether to install certain files into the dist directory. - If present, some files defined by other variables won't be - distributed/shipped with the produced build. + By default, some files types are installed in the dist directory, and + some aren't. Set this variable to True to force the installation of + some files that wouldn't be installed by default. Set this variable to + False to force to not install some files that would be installed by + default. + + This is confusing for historical reasons, but eventually, the behavior + will be made explicit. """, None), 'JAR_MANIFESTS': (StrictOrderingOnAppendList, list, @@ -1790,6 +1811,16 @@ DEPRECATION_HINTS = { 'TEST_TOOL_DIRS': 'Please use the TEST_DIRS variable instead.', 'PARALLEL_DIRS': 'Please use the DIRS variable instead.', + + 'NO_DIST_INSTALL': ''' + Please use + + DIST_INSTALL = False + + instead of + + NO_DIST_INSTALL = True + ''', } # Make sure that all template variables have a deprecation hint. diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index fa063c7592ba..20ce75d08867 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -842,7 +842,7 @@ class InstallationTarget(ContextDerived): self.xpiname = context.get('XPI_NAME', '') self.subdir = context.get('DIST_SUBDIR', '') self.target = context['FINAL_TARGET'] - self.enabled = not context.get('NO_DIST_INSTALL', False) + self.enabled = context['DIST_INSTALL'] is not False def is_custom(self): """Returns whether or not the target is not derived from the default diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 08e81da52384..de45733d4066 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -559,7 +559,6 @@ class TreeMetadataEmitter(LoggingMixin): 'EXTRA_PP_COMPONENTS', 'FAIL_ON_WARNINGS', 'USE_STATIC_LIBS', - 'NO_DIST_INSTALL', 'PYTHON_UNIT_TESTS', 'RCFILE', 'RESFILE', @@ -592,13 +591,19 @@ class TreeMetadataEmitter(LoggingMixin): if isinstance(context, TemplateContext) and context.template == 'Gyp': passthru.variables['IS_GYP_DIR'] = True + dist_install = context['DIST_INSTALL'] + if dist_install is True: + passthru.variables['DIST_INSTALL'] = True + elif dist_install is False: + passthru.variables['NO_DIST_INSTALL'] = True + for obj in self._process_sources(context, passthru): yield obj exports = context.get('EXPORTS') if exports: yield Exports(context, exports, - dist_install=not context.get('NO_DIST_INSTALL', False)) + dist_install=dist_install is not False) for obj in self._process_generated_files(context): yield obj @@ -802,10 +807,10 @@ class TreeMetadataEmitter(LoggingMixin): raise SandboxValidationError('XPIDL_MODULE cannot be defined ' 'unless there are XPIDL_SOURCES', context) - if context['XPIDL_SOURCES'] and context['NO_DIST_INSTALL']: + if context['XPIDL_SOURCES'] and context['DIST_INSTALL'] is False: self.log(logging.WARN, 'mozbuild_warning', dict( path=context.main_path), - '{path}: NO_DIST_INSTALL has no effect on XPIDL_SOURCES.') + '{path}: DIST_INSTALL = False has no effect on XPIDL_SOURCES.') for idl in context['XPIDL_SOURCES']: yield XPIDLFile(context, mozpath.join(context.srcdir, idl), diff --git a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build index f9fcf42f8fc3..46ce663fd325 100644 --- a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build +++ b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build @@ -6,7 +6,7 @@ EXTRA_COMPONENTS = ['dummy.manifest', 'fans.js', 'tans.js'] EXTRA_PP_COMPONENTS=['fans.pp.js', 'tans.pp.js'] FAIL_ON_WARNINGS = True -NO_DIST_INSTALL = True +DIST_INSTALL = False NO_VISIBILITY_FLAGS = True diff --git a/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build b/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build index 5c20439de871..339b130d5b32 100644 --- a/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build +++ b/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build @@ -13,6 +13,6 @@ SharedLibrary('pkcs11testmodule') # C_GetFunctionList needs to be exported. As it turns out, it's much easier to # just export all the symbols. NO_VISIBILITY_FLAGS = True -NO_DIST_INSTALL = True +DIST_INSTALL = False FAIL_ON_WARNINGS = True diff --git a/toolkit/components/ctypes/tests/moz.build b/toolkit/components/ctypes/tests/moz.build index c54142e5370f..f2937d83b68c 100644 --- a/toolkit/components/ctypes/tests/moz.build +++ b/toolkit/components/ctypes/tests/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini'] diff --git a/toolkit/crashreporter/test/moz.build b/toolkit/crashreporter/test/moz.build index f1c05c8c9657..b27079f2b9ee 100644 --- a/toolkit/crashreporter/test/moz.build +++ b/toolkit/crashreporter/test/moz.build @@ -3,7 +3,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini', 'unit_ipc/xpcshell.ini'] BROWSER_CHROME_MANIFESTS += ['browser/browser.ini'] diff --git a/toolkit/mozapps/update/updater/updater-xpcshell/moz.build b/toolkit/mozapps/update/updater/updater-xpcshell/moz.build index 81eef713d19a..eab7c708a41a 100644 --- a/toolkit/mozapps/update/updater/updater-xpcshell/moz.build +++ b/toolkit/mozapps/update/updater/updater-xpcshell/moz.build @@ -7,7 +7,7 @@ Program('updater-xpcshell') updater_rel_path = '../' -NO_DIST_INSTALL = True +DIST_INSTALL = False DEFINES['UPDATER_XPCSHELL_CERT'] = True include('../updater-common.build') FAIL_ON_WARNINGS = True diff --git a/xpcom/tests/bug656331_component/moz.build b/xpcom/tests/bug656331_component/moz.build index 39351d514b53..a8f34881dc10 100644 --- a/xpcom/tests/bug656331_component/moz.build +++ b/xpcom/tests/bug656331_component/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False SOURCES += [ 'TestComponent.cpp', diff --git a/xpcom/tests/component/moz.build b/xpcom/tests/component/moz.build index 22be0dd9a8fb..9094610ec8c8 100644 --- a/xpcom/tests/component/moz.build +++ b/xpcom/tests/component/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False SOURCES += [ 'TestComponent.cpp', diff --git a/xpcom/tests/component_no_aslr/moz.build b/xpcom/tests/component_no_aslr/moz.build index bda7dcd4ec03..c3953d0cbb3f 100644 --- a/xpcom/tests/component_no_aslr/moz.build +++ b/xpcom/tests/component_no_aslr/moz.build @@ -4,7 +4,7 @@ # 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/. -NO_DIST_INSTALL = True +DIST_INSTALL = False SOURCES += [ 'TestComponent.cpp',