From 06c756181e0a5fb64b42fa5e69eaa3721fd434ae Mon Sep 17 00:00:00 2001
From: "evan@chromium.org"
 <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Tue, 27 Apr 2010 18:31:31 +0000
Subject: [PATCH] gyp: unify toolkit_views usage

Now that we can rely on toolkit_views to be set when appropriate,
we can simplify a bunch of logic in gyp.

TEST=compiles

Review URL: http://codereview.chromium.org/1741010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45727 0039d316-1c4b-4281-b951-d872f2087c98
---
 app/app_base.gypi                             |  4 +--
 build/all.gyp                                 |  2 +-
 build/common.gypi                             |  8 +++---
 chrome/chrome_browser.gypi                    |  6 ++--
 chrome/chrome_exe.gypi                        |  5 ----
 chrome/chrome_tests.gypi                      | 28 +++++++++----------
 chrome/installer/installer.gyp                |  8 +++---
 .../interactive_ui/interactive_ui_tests.gypi  | 21 +++++++-------
 ipc/ipc.gyp                                   |  5 ----
 third_party/ffmpeg/ffmpeg.gyp                 |  4 +--
 10 files changed, 41 insertions(+), 50 deletions(-)

diff --git a/app/app_base.gypi b/app/app_base.gypi
index f046e2c3022ff..0c68721443ce1 100644
--- a/app/app_base.gypi
+++ b/app/app_base.gypi
@@ -209,7 +209,7 @@
             '../build/linux/system.gyp:x11',
           ],
           'conditions': [
-            ['toolkit_views==0 and chromeos==0', {
+            ['toolkit_views==0', {
               # Note: because of gyp predence rules this has to be defined as
               # 'sources/' rather than 'sources!'.
               'sources/': [
@@ -220,7 +220,7 @@
                 ['exclude', '^drag_drop_types_gtk.cc'],
               ],
             }],
-            ['toolkit_views==1 or chromeos==1', {
+            ['toolkit_views==1', {
               # Note: because of gyp predence rules this has to be defined as
               # 'sources/' rather than 'sources!'.
               'sources/': [
diff --git a/build/all.gyp b/build/all.gyp
index d97b2ce1995fd..b4fc1bf002f14 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -107,7 +107,7 @@
             '../third_party/libevent/libevent.gyp:*',
           ],
         }],
-        ['OS=="win" or (OS=="linux" and toolkit_views==1)', {
+        ['toolkit_views==1', {
           'dependencies': [
             '../views/views.gyp:*',
           ],
diff --git a/build/common.gypi b/build/common.gypi
index 163cf9ba84116..37390599a5c5e 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -268,7 +268,7 @@
           }, {
             'linux_dump_symbols%': 0,
           }],
-          ['toolkit_views==0 and chromeos==0', {
+          ['toolkit_views==0', {
             # GTK wants Title Case strings
             'use_titlecase_in_grd_files%': 1,
           }],
@@ -388,7 +388,7 @@
       }, {  # else: branding!="Chrome"
         'defines': ['CHROMIUM_BUILD'],
       }],
-      ['toolkit_views==1 or chromeos==1', {
+      ['toolkit_views==1', {
         'defines': ['TOOLKIT_VIEWS=1'],
       }],
       ['chromeos==1', {
@@ -545,7 +545,7 @@
           ['chromeos!=1', {
             'sources/': [ ['exclude', '_chromeos\\.cc$'] ]
           }],
-          ['OS!="win" and (toolkit_views==0 and chromeos==0)', {
+          ['toolkit_views==0', {
             'sources/': [ ['exclude', '_views\\.cc$'] ]
           }],
         ],
@@ -923,7 +923,7 @@
                   '-mfpmath=sse',
                 ],
               }],
-              # ChromeOS targets Pinetrail, which is ssse3, but most of the
+              # ChromeOS targets Pinetrail, which is sse3, but most of the
               # benefit comes from sse2 so this setting allows ChromeOS
               # to build on other CPUs.  In the future -march=atom would help
               # but requires a newer compiler.
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 86a69037a6e44..642af1b71c7db 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2785,7 +2785,7 @@
             ['exclude', '^browser/views/'],
           ],
           'conditions': [
-            ['OS=="linux" and (toolkit_views==1 or chromeos==1)',{
+            ['OS=="linux" and toolkit_views==1',{
               'dependencies': [
                 '../views/views.gyp:views',
               ],
@@ -3077,7 +3077,7 @@
             # These GTK files haven't been ported to views, while ChromeOS has
             # its own separate implementation below.  So re-include them only on
             # non-ChromeOS views Linux builds.
-            ['OS=="linux" and chromeos==0 and toolkit_views==1', {
+            ['OS=="linux" and toolkit_views==1 and chromeos==0', {
               'sources/': [
                 ['include', '^browser/gtk/dialogs_gtk.cc'],
                 ['include', '^browser/gtk/external_protocol_dialog_gtk.cc'],
@@ -3089,7 +3089,7 @@
               ],
             }],
             # GTK build only
-            ['OS=="linux" and chromeos==0 and toolkit_views==0', {
+            ['OS=="linux" and toolkit_views==0', {
               'sources/': [
                 ['include', '^browser/printing/print_dialog_gtk.cc'],
                 ['include', '^browser/printing/print_dialog_gtk.h'],
diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi
index 5a36001609113..268e0816a952a 100644
--- a/chrome/chrome_exe.gypi
+++ b/chrome/chrome_exe.gypi
@@ -214,11 +214,6 @@
             },
           ],
         }],
-        ['OS=="linux" and (toolkit_views==1 or chromeos==1)', {
-          'dependencies': [
-            '../views/views.gyp:views',
-          ],
-        }],
         ['OS=="mac"', {
           'variables': {
             'mac_packaging_dir':
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 0c754c3cedea8..32b6bc7712d72 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -360,14 +360,16 @@
             'browser/process_singleton_linux_uitest.cc',
           ],
         }],
-        ['OS=="linux" and (toolkit_views==1 or chromeos==1)', {
-          'dependencies': [
-            '../views/views.gyp:views',
-          ],
+        ['OS=="linux" and toolkit_views==1', {
           'sources!': [
             'browser/download/download_uitest.cc',
           ],
         }],
+        ['toolkit_views==1', {
+          'dependencies': [
+            '../views/views.gyp:views',
+          ],
+        }],
         ['OS=="mac"', {
           'sources!': [
             # TODO(port)
@@ -391,7 +393,6 @@
             'security_tests',  # run time dependency
             'test_support_common',
             '../google_update/google_update.gyp:google_update',
-            '../views/views.gyp:views',
             '<(allocator_target)',
           ],
           'link_settings': {
@@ -1047,10 +1048,12 @@
             'browser/views/bookmark_context_menu_test.cc',
           ],
         }],
-        ['OS=="linux" and (toolkit_views==1 or chromeos==1)', {
+        ['toolkit_views==1', {
           'dependencies': [
             '../views/views.gyp:views',
           ],
+        }],
+        ['OS=="linux" and toolkit_views==1', {
           'sources': [
             '<@(views_unit_tests_sources)',
           ],
@@ -1119,7 +1122,6 @@
           'dependencies': [
             'chrome_dll_version',
             'installer/installer.gyp:installer_util_strings',
-            '../views/views.gyp:views',
             'test_chrome_plugin',  # run time dependency
             '<(allocator_target)',
           ],
@@ -1361,7 +1363,7 @@
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
           ],
         }],
-        ['OS=="linux" and (toolkit_views==1 or chromeos==1)', {
+        ['OS=="linux" and toolkit_views==1', {
           'dependencies': [
             '../views/views.gyp:views',
           ],
@@ -1388,7 +1390,7 @@
             'browser/chromeos/status/power_menu_button_browsertest.cc',
           ],
         }],
-        ['OS=="linux" and toolkit_views==0 and chromeos==0', {
+        ['OS=="linux" and toolkit_views==0', {
           'sources': [
             'browser/extensions/browser_action_test_util_gtk.cc',
             'browser/gtk/view_id_util_browsertest.cc',
@@ -1451,7 +1453,7 @@
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
           ],
         }],
-        ['OS=="linux" and (toolkit_views==1 or chromeos==1)', {
+        ['OS=="linux" and toolkit_views==1', {
           'dependencies': [
             '../views/views.gyp:views',
           ],
@@ -1547,7 +1549,7 @@
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
           ],
         }],
-        ['OS=="win" or (OS=="linux" and (toolkit_views==1 or chromeos==1))', {
+        ['toolkit_views==1', {
           'dependencies': [
             '../views/views.gyp:views',
           ],
@@ -1826,13 +1828,11 @@
             'plugin',
           ],
         }],
-        # Linux-specific rules.
         ['OS=="linux"', {
            'dependencies': [
              '../build/linux/system.gyp:gtk',
            ],
         }],
-        # Windows-specific rules.
         ['OS=="win"', {
           'sources': [
             'app/chrome_dll.rc',
@@ -1941,7 +1941,7 @@
                 'browser/visitedlink_perftest.cc',
               ],
             }],
-            ['OS=="win" or (OS=="linux" and (toolkit_views==1 or chromeos==1))', {
+            ['toolkit_views==1', {
               'dependencies': [
                 '../views/views.gyp:views',
               ],
diff --git a/chrome/installer/installer.gyp b/chrome/installer/installer.gyp
index 9489c462aad9d..242d68d0e5394 100644
--- a/chrome/installer/installer.gyp
+++ b/chrome/installer/installer.gyp
@@ -469,7 +469,7 @@
           ],
           # ChromeOS doesn't care about RPM packages.
           'conditions': [
-            ['chromeos==0 and toolkit_views==0', {
+            ['chromeos==0', {
               'dependencies': [
                 'linux_packages_trunk_rpm',
               ],
@@ -485,7 +485,7 @@
           ],
           # ChromeOS doesn't care about RPM packages.
           'conditions': [
-            ['chromeos==0 and toolkit_views==0', {
+            ['chromeos==0', {
               'dependencies': [
                 'linux_packages_unstable_rpm',
               ],
@@ -501,7 +501,7 @@
           ],
           # ChromeOS doesn't care about RPM packages.
           'conditions': [
-            ['chromeos==0 and toolkit_views==0', {
+            ['chromeos==0', {
               'dependencies': [
                 'linux_packages_beta_rpm',
               ],
@@ -517,7 +517,7 @@
           ],
           # ChromeOS doesn't care about RPM packages.
           'conditions': [
-            ['chromeos==0 and toolkit_views==0', {
+            ['chromeos==0', {
               'dependencies': [
                 'linux_packages_stable_rpm',
               ],
diff --git a/chrome/test/interactive_ui/interactive_ui_tests.gypi b/chrome/test/interactive_ui/interactive_ui_tests.gypi
index e8cd845ab07d9..f003402a87718 100644
--- a/chrome/test/interactive_ui/interactive_ui_tests.gypi
+++ b/chrome/test/interactive_ui/interactive_ui_tests.gypi
@@ -50,11 +50,13 @@
     '<(DEPTH)/chrome/test/unit/chrome_test_suite.h',
   ],
   'conditions': [
-    ['OS=="linux" and toolkit_views==0 and chromeos==0', {
+    ['OS=="linux"', {
       'dependencies': [
         '<(DEPTH)/build/linux/system.gyp:gtk',
         '<(DEPTH)/tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
       ],
+    }],
+    ['OS=="linux" and toolkit_views==0', {
       'sources!': [
         # TODO(port)
         '<(DEPTH)/chrome/browser/views/bookmark_bar_view_test.cc',
@@ -64,19 +66,14 @@
         '<(DEPTH)/chrome/test/interactive_ui/view_event_test_base.cc',
         '<(DEPTH)/chrome/test/interactive_ui/view_event_test_base.h',
       ],
-    }],  # OS=="linux"
-    ['OS=="linux" and (toolkit_views==1 or chromeos==1)', {
-      'dependencies': [
-        '<(DEPTH)/build/linux/system.gyp:gtk',
-        '<(DEPTH)/tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
-        '<(DEPTH)/views/views.gyp:views',
-      ],
+    }],
+    ['OS=="linux" and toolkit_views==1', {
       'sources!': [
         '<(DEPTH)/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc',
         # TODO(port)
         '<(DEPTH)/chrome/test/interactive_ui/npapi_interactive_test.cc',
       ],
-    }],  # OS=="linux" and (toolkit_views==1 or chromeos==1)
+    }],
     ['target_arch!="x64" and target_arch!="arm"', {
       'dependencies': [
         # run time dependency
@@ -98,6 +95,11 @@
         '<(DEPTH)/chrome/test/interactive_ui/view_event_test_base.h',
       ],
     }],  # OS=="mac"
+    ['toolkit_views==1', {
+      'dependencies': [
+        '<(DEPTH)/views/views.gyp:views',
+      ],
+    }],
     ['OS=="win"', {
       'include_dirs': [
         '<(DEPTH)/third_party/wtl/include',
@@ -107,7 +109,6 @@
         '<(DEPTH)/chrome/chrome.gyp:chrome_dll_version',
         '<(DEPTH)/chrome/chrome.gyp:crash_service',  # run time dependency
         '<(DEPTH)/chrome/installer/installer.gyp:installer_util_strings',
-        '<(DEPTH)/views/views.gyp:views',
       ],
       'sources': [
         '<(DEPTH)/webkit/glue/resources/aliasb.cur',
diff --git a/ipc/ipc.gyp b/ipc/ipc.gyp
index 07141fe1dfcf1..5560abe0353ae 100644
--- a/ipc/ipc.gyp
+++ b/ipc/ipc.gyp
@@ -58,11 +58,6 @@
             '../build/linux/system.gyp:gtk',
           ],
         }],
-        ['OS=="linux" and toolkit_views==1', {
-          'dependencies': [
-            '../views/views.gyp:views',
-          ],
-        }],
         ['OS=="linux"', {
           'conditions': [
             ['linux_use_tcmalloc==1', {
diff --git a/third_party/ffmpeg/ffmpeg.gyp b/third_party/ffmpeg/ffmpeg.gyp
index 0d661a30a5b57..7f428904d881b 100644
--- a/third_party/ffmpeg/ffmpeg.gyp
+++ b/third_party/ffmpeg/ffmpeg.gyp
@@ -39,9 +39,9 @@
     # Allow overridding the selection of which FFmpeg binaries to copy via an
     # environment variable.  Affects the ffmpeg_binaries target.
     'conditions': [
-      ['chromeos!=0 or toolkit_views!=0', {
+      ['chromeos==1', {
         'ffmpeg_branding%': '<(branding)OS',
-      },{  # else chromeos==0, assume Chrome/Chromium.
+      }, {  # otherwise, assume Chrome/Chromium.
         'ffmpeg_branding%': '<(branding)',
       }],
       ['armv7==1 and arm_neon==1', {
-- 
GitLab