Bug 1257326 - Replace the env_flag configure template with a template that does not permit setting values directly from the environment or a mozconfig. r=glandium

For most cases, this replaces a value that was set in a way that would ignore
an environment variable, so this restores behavior for values that were
set in confvars.sh.

MozReview-Commit-ID: E31hm8uKq4D
This commit is contained in:
Chris Manchester 2016-05-12 11:55:58 -07:00
parent 075027b482
commit 4f42fe999c
2 changed files with 36 additions and 35 deletions

View File

@ -684,21 +684,22 @@ set_define('RELEASE_BUILD', delayed_getattr(milestone, 'is_release'))
add_old_configure_assignment('RELEASE_BUILD',
delayed_getattr(milestone, 'is_release'))
# A template providing a shorthand for tying an environment-set option to
# the corresponding variable in set_config, where the value of that variable
# passed to set_config only depends on the provided value and default.
# A template providing a shorthand for setting a variable. The created
# option will only be settable with imply_option.
# It is expected that a project-specific moz.configure will call imply_option
# to set a value other than the default.
# If required, the set_as_define and set_for_old_configure arguments
# will additionally cause the variable to be set using set_define and
# add_old_configure_assignment. util.configure would be an appropriate place for
# this, but it uses add_old_configure_assignment, which is defined in this file.
@template
def env_flag(env=None, set_for_old_configure=False, set_as_define=False,
**kwargs):
def project_flag(env=None, set_for_old_configure=False,
set_as_define=False, **kwargs):
if not env:
configure_error("An env_flag must be passed a variable name to set.")
configure_error("A project_flag must be passed a variable name to set.")
opt = option(env=env, **kwargs)
opt = option(env=env, possible_origins=('implied',), **kwargs)
@depends(opt.option)
def option_implementation(value):

View File

@ -4,45 +4,45 @@
# 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/.
env_flag('MOZ_ANDROID_EXCLUDE_FONTS',
help='Whether to exclude font files from the build',
default=True)
project_flag('MOZ_ANDROID_EXCLUDE_FONTS',
help='Whether to exclude font files from the build',
default=True)
env_flag('MOZ_LOCALE_SWITCHER',
help='Enable runtime locale switching',
default=True)
project_flag('MOZ_LOCALE_SWITCHER',
help='Enable runtime locale switching',
default=True)
env_flag('MOZ_ANDROID_GCM',
help='Enable GCM registration on Nightly builds only',
default=enabled_in_nightly,
set_for_old_configure=True)
project_flag('MOZ_ANDROID_GCM',
help='Enable GCM registration on Nightly builds only',
default=enabled_in_nightly,
set_for_old_configure=True)
env_flag('MOZ_ANDROID_DOWNLOADS_INTEGRATION',
help='Enable system download manager on Android',
default=True)
project_flag('MOZ_ANDROID_DOWNLOADS_INTEGRATION',
help='Enable system download manager on Android',
default=True)
env_flag('MOZ_ANDROID_BEAM',
help='Enable NFC permission on Android',
default=True)
project_flag('MOZ_ANDROID_BEAM',
help='Enable NFC permission on Android',
default=True)
env_flag('MOZ_ANDROID_SEARCH_ACTIVITY',
help='Include Search Activity on Android',
default=True)
project_flag('MOZ_ANDROID_SEARCH_ACTIVITY',
help='Include Search Activity on Android',
default=True)
env_flag('MOZ_ANDROID_MLS_STUMBLER',
help='Include Mozilla Location Service Stumbler on Android',
default=True)
project_flag('MOZ_ANDROID_MLS_STUMBLER',
help='Include Mozilla Location Service Stumbler on Android',
default=True)
env_flag('MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE',
help='Background service for downloading additional content at runtime',
default=True)
project_flag('MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE',
help='Background service for downloading additional content at runtime',
default=True)
# Enable the Switchboard A/B framework code.
# Note: The framework is always included in the app. This flag controls
# usage of the framework.
env_flag('MOZ_SWITCHBOARD',
help='Include Switchboard A/B framework on Android',
default=True)
project_flag('MOZ_SWITCHBOARD',
help='Include Switchboard A/B framework on Android',
default=True)
option('--disable-android-apz', env='MOZ_ANDROID_APZ',
help='Disable the C++ async pan/zoom code and use the Java version instead')