Bug 1520108 - Move MOZ_CONFIGURE_OPTIONS to toolkit/moz.configure. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 15 Jan 2019 15:28:00 +0000
changeset 513985 a6b0bf9e4e6a00ff6347276d57131ad7ab28b476
parent 513984 6f0a657ae73e55dbcfbf98661739f1aadf07f869
child 513986 73e3a031b232f16866c02598fb72c951d998a211
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1520108
milestone66.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 1520108 - Move MOZ_CONFIGURE_OPTIONS to toolkit/moz.configure. r=froydnj It is only used to fill about:buildconfig. Differential Revision: https://phabricator.services.mozilla.com/D16526
build/moz.configure/init.configure
python/mozbuild/mozbuild/test/configure/test_moz_configure.py
python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
toolkit/moz.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -1203,46 +1203,8 @@ def project_flag(env=None, set_for_old_c
         add_old_configure_assignment(env, option_implementation)
 
 # milestone.is_nightly corresponds to cases NIGHTLY_BUILD is set.
 
 
 @depends(milestone)
 def enabled_in_nightly(milestone):
     return milestone.is_nightly
-
-# Set the MOZ_CONFIGURE_OPTIONS variable with all the options that
-# were passed somehow (environment, command line, mozconfig)
-
-
-@dependable
-@imports(_from='mozbuild.shellutil', _import='quote')
-@imports('__sandbox__')
-def all_configure_options():
-    result = []
-    previous = None
-    for option in __sandbox__._options.itervalues():
-        # __sandbox__._options contains items for both option.name and
-        # option.env. But it's also an OrderedDict, meaning both are
-        # consecutive.
-        # Also ignore OLD_CONFIGURE and MOZCONFIG because they're not
-        # interesting.
-        if option == previous or option.env in ('OLD_CONFIGURE', 'MOZCONFIG'):
-            continue
-        previous = option
-        value = __sandbox__._value_for(option)
-        # We only want options that were explicitly given on the command
-        # line, the environment, or mozconfig, and that differ from the
-        # defaults.
-        if (value is not None and value.origin not in ('default', 'implied') and
-                value != option.default):
-            result.append(__sandbox__._raw_options[option])
-        # We however always include options that are sent to old configure
-        # because we don't know their actual defaults. (Keep the conditions
-        # separate for ease of understanding and ease of removal)
-        elif (option.help == 'Help missing for old configure options' and
-                option in __sandbox__._raw_options):
-            result.append(__sandbox__._raw_options[option])
-
-    return quote(*result)
-
-
-set_config('MOZ_CONFIGURE_OPTIONS', all_configure_options)
--- a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py
@@ -1,71 +1,20 @@
 # 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 absolute_import, print_function, unicode_literals
 
 from mozunit import main
-from mozpack import path as mozpath
 
 from common import BaseConfigureTest
 
 
 class TestMozConfigure(BaseConfigureTest):
-    def test_moz_configure_options(self):
-        def get_value_for(args=[], environ={}, mozconfig=''):
-            sandbox = self.get_sandbox({}, {}, args, environ, mozconfig)
-
-            # Add a fake old-configure option
-            sandbox.option_impl('--with-foo', nargs='*',
-                                help='Help missing for old configure options')
-
-            # Remove all implied options, otherwise, getting
-            # all_configure_options below triggers them, and that triggers
-            # configure parts that aren't expected to run during this test.
-            del sandbox._implied_options[:]
-            result = sandbox._value_for(sandbox['all_configure_options'])
-            shell = mozpath.abspath('/bin/sh')
-            return result.replace('CONFIG_SHELL=%s ' % shell, '')
-
-        self.assertEquals('--enable-application=browser',
-                          get_value_for(['--enable-application=browser']))
-
-        self.assertEquals('--enable-application=browser '
-                          'MOZ_VTUNE=1',
-                          get_value_for(['--enable-application=browser',
-                                         'MOZ_VTUNE=1']))
-
-        value = get_value_for(
-            environ={'MOZ_VTUNE': '1'},
-            mozconfig='ac_add_options --enable-project=js')
-
-        self.assertEquals('--enable-project=js MOZ_VTUNE=1',
-                          value)
-
-        # --disable-js-shell is the default, so it's filtered out.
-        self.assertEquals('--enable-application=browser',
-                          get_value_for(['--enable-application=browser',
-                                         '--disable-js-shell']))
-
-        # Normally, --without-foo would be filtered out because that's the
-        # default, but since it is a (fake) old-configure option, it always
-        # appears.
-        self.assertEquals('--enable-application=browser --without-foo',
-                          get_value_for(['--enable-application=browser',
-                                         '--without-foo']))
-        self.assertEquals('--enable-application=browser --with-foo',
-                          get_value_for(['--enable-application=browser',
-                                         '--with-foo']))
-
-        self.assertEquals("--enable-application=browser '--with-foo=foo bar'",
-                          get_value_for(['--enable-application=browser',
-                                         '--with-foo=foo bar']))
-
     def test_nsis_version(self):
         this = self
 
         class FakeNSIS(object):
             def __init__(self, version):
                 self.version = version
 
             def __call__(self, stdin, args):
--- a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
@@ -7,19 +7,70 @@ from __future__ import absolute_import, 
 import os
 
 from StringIO import StringIO
 from buildconfig import topsrcdir
 from common import BaseConfigureTest
 from mozunit import MockedOpen, main
 from mozbuild.configure.options import InvalidOptionError
 from mozbuild.configure.util import Version
+from mozpack import path as mozpath
 
 
 class TestToolkitMozConfigure(BaseConfigureTest):
+    def test_moz_configure_options(self):
+        def get_value_for(args=[], environ={}, mozconfig=''):
+            sandbox = self.get_sandbox({}, {}, args, environ, mozconfig)
+
+            # Add a fake old-configure option
+            sandbox.option_impl('--with-foo', nargs='*',
+                                help='Help missing for old configure options')
+
+            # Remove all implied options, otherwise, getting
+            # all_configure_options below triggers them, and that triggers
+            # configure parts that aren't expected to run during this test.
+            del sandbox._implied_options[:]
+            result = sandbox._value_for(sandbox['all_configure_options'])
+            shell = mozpath.abspath('/bin/sh')
+            return result.replace('CONFIG_SHELL=%s ' % shell, '')
+
+        self.assertEquals('--enable-application=browser',
+                          get_value_for(['--enable-application=browser']))
+
+        self.assertEquals('--enable-application=browser '
+                          'MOZ_VTUNE=1',
+                          get_value_for(['--enable-application=browser',
+                                         'MOZ_VTUNE=1']))
+
+        value = get_value_for(
+            environ={'MOZ_VTUNE': '1'},
+            mozconfig='ac_add_options --enable-application=browser')
+
+        self.assertEquals('--enable-application=browser MOZ_VTUNE=1',
+                          value)
+
+        # --disable-js-shell is the default, so it's filtered out.
+        self.assertEquals('--enable-application=browser',
+                          get_value_for(['--enable-application=browser',
+                                         '--disable-js-shell']))
+
+        # Normally, --without-foo would be filtered out because that's the
+        # default, but since it is a (fake) old-configure option, it always
+        # appears.
+        self.assertEquals('--enable-application=browser --without-foo',
+                          get_value_for(['--enable-application=browser',
+                                         '--without-foo']))
+        self.assertEquals('--enable-application=browser --with-foo',
+                          get_value_for(['--enable-application=browser',
+                                         '--with-foo']))
+
+        self.assertEquals("--enable-application=browser '--with-foo=foo bar'",
+                          get_value_for(['--enable-application=browser',
+                                         '--with-foo=foo bar']))
+
     def test_developer_options(self, milestone='42.0a1'):
         def get_value(args=[], environ={}):
             sandbox = self.get_sandbox({}, {}, args, environ)
             return sandbox._value_for(sandbox['developer_options'])
 
         milestone_path = os.path.join(topsrcdir, 'config', 'milestone.txt')
         with MockedOpen({milestone_path: milestone}):
             # developer options are enabled by default on "nightly" milestone
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1,14 +1,49 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=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/.
 
+# Set the MOZ_CONFIGURE_OPTIONS variable with all the options that
+# were passed somehow (environment, command line, mozconfig)
+@dependable
+@imports(_from='mozbuild.shellutil', _import='quote')
+@imports('__sandbox__')
+def all_configure_options():
+    result = []
+    previous = None
+    for option in __sandbox__._options.itervalues():
+        # __sandbox__._options contains items for both option.name and
+        # option.env. But it's also an OrderedDict, meaning both are
+        # consecutive.
+        # Also ignore OLD_CONFIGURE and MOZCONFIG because they're not
+        # interesting.
+        if option == previous or option.env in ('OLD_CONFIGURE', 'MOZCONFIG'):
+            continue
+        previous = option
+        value = __sandbox__._value_for(option)
+        # We only want options that were explicitly given on the command
+        # line, the environment, or mozconfig, and that differ from the
+        # defaults.
+        if (value is not None and value.origin not in ('default', 'implied') and
+                value != option.default):
+            result.append(__sandbox__._raw_options[option])
+        # We however always include options that are sent to old configure
+        # because we don't know their actual defaults. (Keep the conditions
+        # separate for ease of understanding and ease of removal)
+        elif (option.help == 'Help missing for old configure options' and
+                option in __sandbox__._raw_options):
+            result.append(__sandbox__._raw_options[option])
+
+    return quote(*result)
+
+
+set_config('MOZ_CONFIGURE_OPTIONS', all_configure_options)
 
 # Profiling
 # ==============================================================
 # Some of the options here imply an option from js/moz.configure,
 # so, need to be declared before the include.
 
 option('--enable-jprof', env='MOZ_JPROF',
        help='Enable jprof profiling tool (needs mozilla/tools/jprof)')