Make some dependencies more flexible.

BUG=none
TEST=trybot

Review URL: https://webrtc-codereview.appspot.com/728005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2583 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/build/common.gypi b/src/build/common.gypi
index 2bb8775..284a5a8 100644
--- a/src/build/common.gypi
+++ b/src/build/common.gypi
@@ -9,26 +9,42 @@
 # This file contains common settings for building WebRTC components.
 
 {
+  # Nesting is required in order to use variables for setting other variables.
   'variables': {
-    # These variables need to be nested in order to use them in a conditions
-    # block to set other variables.
     'variables': {
       'variables': {
-        # This will be set to zero in the supplement.gypi triggered by a gclient
-        # hook in the standalone build.
-        'build_with_chromium%': 1,
+        'variables': {
+          # This will be set to zero in the supplement.gypi triggered by a
+          # gclient hook in the standalone build.
+          'build_with_chromium%': 1,
+        },
+        'build_with_chromium%': '<(build_with_chromium)',
+
+        'conditions': [
+          ['build_with_chromium==1', {
+            'webrtc_root%': '<(DEPTH)/third_party/webrtc',
+          }, {
+            'webrtc_root%': '<(DEPTH)/src',
+          }],
+        ],
       },
       'build_with_chromium%': '<(build_with_chromium)',
+      'webrtc_root%': '<(webrtc_root)',
+
       'conditions': [
         ['build_with_chromium==1', {
-          'webrtc_root%': '<(DEPTH)/third_party/webrtc',
+          'include_tests%': 0,
         }, {
-          'webrtc_root%': '<(DEPTH)/src',
+          'include_tests%': 1,
         }],
       ],
+
+      'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
     },
     'build_with_chromium%': '<(build_with_chromium)',
+    'include_tests%': '<(include_tests)',
     'webrtc_root%': '<(webrtc_root)',
+    'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
 
     # The Chromium common.gypi we use treats all gyp files without
     # chromium_code==1 as third party code. This disables many of the
@@ -54,7 +70,6 @@
     'build_libjpeg%': 1,
     'build_libyuv%': 1,
 
-    'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
     'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
 
     'conditions': [
@@ -80,10 +95,7 @@
 
         # Disable the use of protocol buffers in production code.
         'enable_protobuf%': 0,
-
-        # Don't include tests for Chromium builds.
-        'include_tests%': 0,
-      }, { # Settings for the standalone (not-in-Chromium) build.
+      }, {  # Settings for the standalone (not-in-Chromium) build.
         'include_pulse_audio%': 1,
 
         'include_internal_audio_device%': 1,
@@ -96,8 +108,6 @@
 
         'enable_protobuf%': 1,
 
-        'include_tests%': 1,
-
         # TODO(andrew): For now, disable the Chrome plugins, which causes a
         # flood of chromium-style warnings. Investigate enabling them:
         # http://code.google.com/p/webrtc/issues/detail?id=163
diff --git a/src/voice_engine/voice_engine_core.gypi b/src/voice_engine/voice_engine_core.gypi
index 10a8d05..4825072 100644
--- a/src/voice_engine/voice_engine_core.gypi
+++ b/src/voice_engine/voice_engine_core.gypi
@@ -7,22 +7,27 @@
 # be found in the AUTHORS file in the root of the source tree.
 
 {
+  'variables': {
+    'voice_engine_dependencies': [
+      '<(webrtc_root)/common_audio/common_audio.gyp:resampler',
+      '<(webrtc_root)/common_audio/common_audio.gyp:signal_processing',
+      '<(webrtc_root)/modules/modules.gyp:audio_coding_module',
+      '<(webrtc_root)/modules/modules.gyp:audio_conference_mixer',
+      '<(webrtc_root)/modules/modules.gyp:audio_device',
+      '<(webrtc_root)/modules/modules.gyp:audio_processing',
+      '<(webrtc_root)/modules/modules.gyp:media_file',
+      '<(webrtc_root)/modules/modules.gyp:rtp_rtcp',
+      '<(webrtc_root)/modules/modules.gyp:udp_transport',
+      '<(webrtc_root)/modules/modules.gyp:webrtc_utility',
+      '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+    ],
+  },
   'targets': [
     {
       'target_name': 'voice_engine_core',
       'type': '<(library)',
       'dependencies': [
-        '<(webrtc_root)/common_audio/common_audio.gyp:resampler',
-        '<(webrtc_root)/common_audio/common_audio.gyp:signal_processing',
-        '<(webrtc_root)/modules/modules.gyp:audio_coding_module',
-        '<(webrtc_root)/modules/modules.gyp:audio_conference_mixer',
-        '<(webrtc_root)/modules/modules.gyp:audio_device',
-        '<(webrtc_root)/modules/modules.gyp:audio_processing',
-        '<(webrtc_root)/modules/modules.gyp:media_file',
-        '<(webrtc_root)/modules/modules.gyp:rtp_rtcp',
-        '<(webrtc_root)/modules/modules.gyp:udp_transport',
-        '<(webrtc_root)/modules/modules.gyp:webrtc_utility',
-        '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+        '<@(voice_engine_dependencies)',
       ],
       'include_dirs': [
         'include',
diff --git a/webrtc.gyp b/webrtc.gyp
index c729eb8..7d7c051 100644
--- a/webrtc.gyp
+++ b/webrtc.gyp
@@ -8,27 +8,32 @@
 
 {
   'includes': [ 'src/build/common.gypi', ],
+  'variables': {
+    'webrtc_all_dependencies': [
+      'src/common_audio/common_audio.gyp:*',
+      'src/common_video/common_video.gyp:*',
+      'src/modules/modules.gyp:*',
+      'src/system_wrappers/source/system_wrappers.gyp:*',
+      'src/video_engine/video_engine.gyp:*',
+      'src/voice_engine/voice_engine.gyp:*',
+      '<(webrtc_vp8_dir)/vp8.gyp:*',
+    ],
+    'conditions': [
+      ['include_tests==1', {
+        'webrtc_all_dependencies': [
+          'src/test/metrics.gyp:*',
+          'src/test/test.gyp:*',
+          'tools/e2e_quality/e2e_quality.gyp:*',
+        ],
+      }],
+    ],
+  },
   'targets': [
     {
       'target_name': 'All',
       'type': 'none',
       'dependencies': [
-        'src/common_audio/common_audio.gyp:*',
-        'src/common_video/common_video.gyp:*',
-        'src/modules/modules.gyp:*',
-        'src/system_wrappers/source/system_wrappers.gyp:*',
-        'src/video_engine/video_engine.gyp:*',
-        'src/voice_engine/voice_engine.gyp:*',
-        '<(webrtc_vp8_dir)/vp8.gyp:*'
-      ],
-      'conditions': [
-        ['include_tests==1', {
-          'dependencies': [
-            'src/test/metrics.gyp:*',
-            'src/test/test.gyp:*',
-            'tools/e2e_quality/e2e_quality.gyp:*',
-          ],
-        }],
+        '<@(webrtc_all_dependencies)',
       ],
     },
   ],