Bug 1257823 - Move imply_option() from @depends to global scope draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 23 Mar 2016 16:20:29 +0900
changeset 343870 bca81ea8743049e08802b4e5d6860e64ee81f0d7
parent 343869 5f3eaeacbb233c2e1c276fbe11422e35ba7540a2
child 343871 245f0b805e7b8163b37c73296010f0d280a356f6
push id13691
push userbmo:mh+mozilla@glandium.org
push dateWed, 23 Mar 2016 10:00:34 +0000
bugs1257823
milestone48.0a1
Bug 1257823 - Move imply_option() from @depends to global scope
build/moz.configure/init.configure
js/moz.configure
moz.configure
toolkit/moz.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -594,17 +594,19 @@ set_define('XP_LINUX', target_is_linux)
 # The application/project to build
 # ==============================================================
 option('--enable-application', nargs=1, env='MOZ_BUILD_APP',
        help='Application to build. Same as --enable-project.')
 
 @depends('--enable-application', '--help')
 def application(app, help):
     if app:
-        imply_option(app.format('--enable-project'))
+        return app
+
+imply_option('--enable-project', application)
 
 
 @depends(check_build_environment, '--help')
 def default_project(build_env, help):
     if build_env.topobjdir.endswith('/js/src'):
         return 'js'
     return 'browser'
 
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -118,49 +118,52 @@ js_option('--enable-instruments', env='M
 
 @depends('--enable-instruments', target)
 def instruments(value, target):
     if value and target.os != 'OSX':
         error('--enable-instruments cannot be used when targeting %s'
               % target.os)
     if value:
         add_old_configure_assignment('MOZ_INSTRUMENTS', True)
-        imply_option('--enable-profiling', reason='--enable-instruments')
         return True
 
 set_config('MOZ_INSTRUMENTS', instruments)
 set_define('MOZ_INSTRUMENTS', instruments)
+imply_option('--enable-profiling', instruments, reason='--enable-instruments')
 
 js_option('--enable-callgrind', env='MOZ_CALLGRIND',
           help='Enable callgrind profiling')
 
 @depends('--enable-callgrind')
 def callgrind(value):
     if value:
-        imply_option('--enable-profiling')
         return True
 
 set_define('MOZ_CALLGRIND', callgrind)
+imply_option('--enable-profiling', callgrind)
 
 js_option('--enable-profiling', env='MOZ_PROFILING',
           help='Set compile flags necessary for using sampling profilers '
                '(e.g. shark, perf)')
 
-@depends('--enable-profiling', target)
-def profiling(value, target):
+@depends('--enable-profiling')
+def profiling(value):
     if value:
         add_old_configure_assignment('MOZ_PROFILING', True)
+        return True
 
-        if target.kernel == 'WINNT' or (target.kernel == 'Linux' and
-                                        target.os == 'GNU'):
-            imply_option('--enable-vtune', reason='--enable-profiling')
+@depends(profiling, target)
+def imply_vtune(value, target):
+    if value and (target.kernel == 'WINNT' or (target.kernel == 'Linux' and
+                                               target.os == 'GNU')):
         return True
 
 set_config('MOZ_PROFILING', profiling)
 set_define('MOZ_PROFILING', profiling)
+imply_option('--enable-vtune', imply_vtune, reason='--enable-profiling')
 
 
 js_option('--enable-vtune', env='MOZ_VTUNE', help='Enable vtune profiling')
 
 @depends('--enable-vtune')
 def vtune(value):
     if value:
         return True
--- a/moz.configure
+++ b/moz.configure
@@ -27,21 +27,26 @@ set_define('E10S_TESTING_ONLY', e10s_tes
 
 
 option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
        help='Download and use prebuilt binary artifacts.')
 
 @depends('--enable-artifact-builds')
 def artifact_builds(value):
     if value:
-        imply_option('--disable-compile-environment')
         return True
 
 set_config('MOZ_ARTIFACT_BUILDS', artifact_builds)
 
+@depends('--enable-artifact-builds')
+def imply_disable_compile_environment(value):
+    if value:
+        return False
+
+imply_option('--enable-compile-environment', imply_disable_compile_environment)
 
 option('--disable-compile-environment',
        help='Disable compiler/library checks')
 
 @depends('--disable-compile-environment')
 def compile_environment(value):
     if value:
         add_old_configure_assignment('COMPILE_ENVIRONMENT', True)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -24,21 +24,21 @@ set_define('MOZ_USE_SYSTRACE', systrace)
 
 
 option('--enable-jprof', env='MOZ_JPROF',
        help='Enable jprof profiling tool (needs mozilla/tools/jprof)')
 
 @depends('--enable-jprof')
 def jprof(value):
     if value:
-        imply_option('--enable-profiling')
         return True
 
 set_config('MOZ_JPROF', jprof)
 set_define('MOZ_JPROF', jprof)
+imply_option('--enable-profiling', jprof)
 
 @depends(target)
 def sps_profiler(target):
     if target.os == 'Android':
         return target.cpu in ('arm', 'x86')
     elif target.kernel == 'Linux':
         return target.cpu in ('x86', 'x86_64')
     return target.os in ('OSX', 'WINNT')
@@ -55,21 +55,21 @@ set_define('MOZ_ENABLE_PROFILER_SPS', sp
 option('--enable-dmd', env='MOZ_DMD',
        help='Enable Dark Matter Detector (heap profiler). '
             'Also enables jemalloc, replace-malloc and profiling')
 
 @depends('--enable-dmd')
 def dmd(value):
     if value:
         add_old_configure_assignment('MOZ_DMD', True)
-        imply_option('--enable-profiling')
         return True
 
 set_config('MOZ_DMD', dmd)
 set_define('MOZ_DMD', dmd)
+imply_option('--enable-profiling', dmd)
 
 # Javascript engine
 # ==============================================================
 include('../js/moz.configure')
 
 
 # L10N
 # ==============================================================
@@ -302,21 +302,21 @@ option('--disable-ffmpeg',
        help='Disable FFmpeg for fragmented H264/AAC decoding')
 
 @depends('--disable-ffmpeg', target)
 def ffmpeg(value, target):
     enabled = bool(value)
     if value.origin == 'default':
         enabled = target.os not in ('Android', 'WINNT')
     if enabled:
-        imply_option('--enable-fmp4', '--enable-ffmpeg')
         return True
 
 set_config('MOZ_FFMPEG', ffmpeg)
 set_define('MOZ_FFMPEG', ffmpeg)
+imply_option('--enable-fmp4', ffmpeg, '--enable-ffmpeg')
 
 # Built-in fragmented MP4 support.
 # ==============================================================
 option('--disable-fmp4', env='MOZ_FMP4',
        help='Disable support for in built Fragmented MP4 parsing')
 
 @depends('--disable-fmp4', target, wmf, applemedia)
 def fmp4(value, target, wmf, applemedia):