From bf17475c577a80c3312b570e1849e9d444126825 Mon Sep 17 00:00:00 2001
From: "ben@chromium.org"
 <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Sun, 17 May 2009 02:02:42 +0000
Subject: [PATCH] Convert app/ to GYP.

http://crbug.com/11387


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16251 0039d316-1c4b-4281-b951-d872f2087c98
---
 app/app.gyp       | 166 +++++++++++++++++++++++++
 app/app.vcproj    | 303 ----------------------------------------------
 build/all.gyp     |   1 +
 chrome/chrome.gyp | 115 +-----------------
 4 files changed, 169 insertions(+), 416 deletions(-)
 create mode 100644 app/app.gyp
 delete mode 100644 app/app.vcproj

diff --git a/app/app.gyp b/app/app.gyp
new file mode 100644
index 0000000000000..b75b355792b42
--- /dev/null
+++ b/app/app.gyp
@@ -0,0 +1,166 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+  'variables': {
+    'chromium_code': 1,
+    # Mac NOTE: at the start of the conditions block we default some vars
+    # that control features based on the branding, this way each place that
+    # needs to know about the feature isn't hard coded to the branding type.
+  },
+  'includes': [
+    '../build/common.gypi',
+  ],
+  'target_defaults': {
+    'sources/': [
+      ['exclude', '/(cocoa|gtk|win)/'],
+      ['exclude', '_(cocoa|gtk|linux|mac|posix|skia|win|x)\\.(cc|mm?)$'],
+      ['exclude', '/(gtk|win|x11)_[^/]*\\.cc$'],
+    ],
+    'conditions': [
+      ['OS=="linux"', {'sources/': [
+        ['include', '/gtk/'],
+        ['include', '_(gtk|linux|posix|skia|x)\\.cc$'],
+        ['include', '/(gtk|x11)_[^/]*\\.cc$'],
+      ]}],
+      ['OS=="mac"', {'sources/': [
+        ['include', '/cocoa/'],
+        ['include', '_(cocoa|mac|posix)\\.(cc|mm?)$'],
+      ]}, { # else: OS != "mac"
+        'sources/': [
+          ['exclude', '\\.mm?$'],
+        ],
+      }],
+      ['OS=="win"', {'sources/': [
+        ['include', '_(win)\\.cc$'],
+        ['include', '/win/'],
+        ['include', '/win_[^/]*\\.cc$'],
+      ]}],
+    ],
+  },
+  'targets': [
+    {
+      'target_name': 'app',
+      'type': '<(library)',
+      'msvs_guid': '4631946D-7D5F-44BD-A5A8-504C0A7033BE',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../base/base.gyp:base_gfx',
+        '../net/net.gyp:net',
+        '../skia/skia.gyp:skia',
+        '../third_party/icu38/icu38.gyp:icui18n',
+        '../third_party/icu38/icu38.gyp:icuuc',
+      ],
+      'include_dirs': [
+        '..',
+        '../chrome/third_party/wtl/include',
+      ],
+      'sources': [
+        # All .cc, .h, and .mm files under app/ except for tests.
+        'animation.cc',
+        'animation.h',
+        'app_paths.h',
+        'app_paths.cc',
+        'app_switches.h',
+        'app_switches.cc',
+        'drag_drop_types.cc',
+        'drag_drop_types.h',
+        'gfx/canvas.cc',
+        'gfx/canvas.h',
+        'gfx/canvas_linux.cc',
+        'gfx/canvas_win.cc',
+        'gfx/font.h',
+        'gfx/font_gtk.cc',
+        'gfx/font_mac.mm',
+        'gfx/font_skia.cc',
+        'gfx/font_win.cc',
+        'gfx/color_utils.cc',
+        'gfx/color_utils.h',
+        'gfx/favicon_size.h',
+        'gfx/gtk_util.cc',
+        'gfx/gtk_util.h',
+        'gfx/icon_util.cc',
+        'gfx/icon_util.h',
+        'gfx/insets.h',
+        'gfx/path_gtk.cc',
+        'gfx/path_win.cc',
+        'gfx/path.h',
+        'gfx/text_elider.cc',
+        'gfx/text_elider.h',
+        'l10n_util.cc',
+        'l10n_util.h',
+        'l10n_util_posix.cc',
+        'l10n_util_win.cc',
+        'l10n_util_win.h',
+        'message_box_flags.h',
+        'os_exchange_data_win.cc',
+        'os_exchange_data_gtk.cc',
+        'os_exchange_data.h',
+        'resource_bundle.cc',
+        'resource_bundle.h',
+        'resource_bundle_win.cc',
+        'resource_bundle_linux.cc',
+        'resource_bundle_mac.mm',
+        'slide_animation.cc',
+        'slide_animation.h',
+        'theme_provider.h',
+        'throb_animation.cc',
+        'throb_animation.h',
+      ],
+      'direct_dependent_settings': {
+        'include_dirs': [
+          '..',
+        ],
+      },
+      'conditions': [
+        ['OS=="linux"', {
+          'dependencies': [
+            # font_gtk.cc uses fontconfig.
+            # TODO(evanm): I think this is wrong; it should just use GTK.
+            '../build/linux/system.gyp:fontconfig',
+            '../build/linux/system.gyp:gtk',
+          ],
+        }],
+        ['OS=="win"', {
+          # TODO: remove this when chrome_resources/chrome_strings are
+          #       generated by GYP.
+          # The legacy vcproj we rely on places the grit output in this
+          # directory, so we need to explicitly add it to our include path.
+          'include_dirs': [
+            '<(PRODUCT_DIR)/grit_derived_sources',
+          ],
+          'sources': [
+            'win_util.cc',
+            'win_util.h',
+          ],
+        }],
+        ['OS!="win"', {
+          'sources!': [
+            'drag_drop_types.cc',
+            'drag_drop_types.h',
+            'gfx/icon_util.cc',
+            'gfx/icon_util.h',
+            'os_exchange_data.cc',
+          ],
+          # TODO: Move these dependencies to platform-neutral once these
+          # projects are generated by GYP.
+          'dependencies': [
+            '../chrome/chrome.gyp:chrome_resources',
+            '../chrome/chrome.gyp:chrome_strings',
+          ],
+          'conditions': [
+            ['toolkit_views==0', {
+              # Note: because of gyp predence rules this has to be defined as
+              # 'sources/' rather than 'sources!'.
+              'sources/': [
+                ['exclude', '^os_exchange_data_gtk.cc'],
+                ['exclude', '^os_exchange_data.h'],
+              ],
+            }],
+          ],
+        }],
+      ],
+    },
+  ],
+}
diff --git a/app/app.vcproj b/app/app.vcproj
deleted file mode 100644
index f54461a477c07..0000000000000
--- a/app/app.vcproj
+++ /dev/null
@@ -1,303 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="app"
-	ProjectGUID="{4631946D-7D5F-44BD-A5A8-504C0A7033BE}"
-	RootNamespace="app"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			ConfigurationType="4"
-			InheritedPropertySheets=".\app.vsprops;$(SolutionDir)..\build\debug.vsprops"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			ConfigurationType="4"
-			InheritedPropertySheets=".\app.vsprops;$(SolutionDir)..\build\release.vsprops"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="gfx"
-			>
-			<File
-				RelativePath=".\gfx\canvas.cc"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\canvas.h"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\canvas_win.cc"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\color_utils.cc"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\color_utils.h"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\favicon_size.h"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\font.h"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\font_win.cc"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\icon_util.cc"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\icon_util.h"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\insets.h"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\path.h"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\path_win.cc"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\text_elider.cc"
-				>
-			</File>
-			<File
-				RelativePath=".\gfx\text_elider.h"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath=".\animation.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\animation.h"
-			>
-		</File>
-		<File
-			RelativePath=".\app_paths.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\app_paths.h"
-			>
-		</File>
-		<File
-			RelativePath=".\app_switches.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\app_switches.h"
-			>
-		</File>
-		<File
-			RelativePath=".\drag_drop_types.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\drag_drop_types.h"
-			>
-		</File>
-		<File
-			RelativePath=".\l10n_util.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\l10n_util.h"
-			>
-		</File>
-		<File
-			RelativePath=".\l10n_util_win.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\l10n_util_win.h"
-			>
-		</File>
-		<File
-			RelativePath=".\message_box_flags.h"
-			>
-		</File>
-		<File
-			RelativePath=".\os_exchange_data.h"
-			>
-		</File>
-		<File
-			RelativePath=".\os_exchange_data_win.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\resource_bundle.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\resource_bundle.h"
-			>
-		</File>
-		<File
-			RelativePath=".\resource_bundle_win.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\slide_animation.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\slide_animation.h"
-			>
-		</File>
-		<File
-			RelativePath=".\theme_provider.h"
-			>
-		</File>
-		<File
-			RelativePath=".\throb_animation.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\throb_animation.h"
-			>
-		</File>
-		<File
-			RelativePath=".\tree_model.h"
-			>
-		</File>
-		<File
-			RelativePath=".\tree_node_iterator.h"
-			>
-		</File>
-		<File
-			RelativePath=".\tree_node_model.h"
-			>
-		</File>
-		<File
-			RelativePath=".\win_util.cc"
-			>
-		</File>
-		<File
-			RelativePath=".\win_util.h"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/build/all.gyp b/build/all.gyp
index 73a001e2cdc3d..2d3fa12d76d14 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -21,6 +21,7 @@
       'type': 'none',
       'xcode_create_dependents_test_runner': 1,
       'dependencies': [
+        '../app/app.gyp:*',
         '../base/base.gyp:*',
         '../media/media.gyp:*',
         '../net/net.gyp:*',
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 9b4e046c77275..50270f4b4da07 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -5,9 +5,6 @@
 {
   'variables': {
     'chromium_code': 1,
-    # Mac NOTE: at the start of the conditions block we default some vars
-    # that control features based on the branding, this way each place that
-    # needs to know about the feature isn't hard coded to the branding type.
   },
   'includes': [
     '../build/common.gypi',
@@ -151,114 +148,6 @@
         }],
       ],
     },
-    {
-      # TODO(beng): rename to 'app' when moves to top level.
-      'target_name': 'app_base',
-      'type': '<(library)',
-      'msvs_guid': '4631946D-7D5F-44BD-A5A8-504C0A7033BE',
-      'dependencies': [
-        'chrome_resources',
-        'chrome_strings',
-        '../base/base.gyp:base',
-        '../base/base.gyp:base_gfx',
-        '../net/net.gyp:net',
-        '../skia/skia.gyp:skia',
-        '../third_party/icu38/icu38.gyp:icui18n',
-        '../third_party/icu38/icu38.gyp:icuuc',
-      ],
-      'include_dirs': [
-        '..',
-        'third_party/wtl/include',
-      ],
-      'sources': [
-        # All .cc, .h, and .mm files under app/ except for tests.
-        '../app/animation.cc',
-        '../app/animation.h',
-        '../app/app_paths.h',
-        '../app/app_paths.cc',
-        '../app/app_switches.h',
-        '../app/app_switches.cc',
-        '../app/drag_drop_types.cc',
-        '../app/drag_drop_types.h',
-        '../app/gfx/canvas.cc',
-        '../app/gfx/canvas.h',
-        '../app/gfx/canvas_linux.cc',
-        '../app/gfx/canvas_win.cc',
-        '../app/gfx/font.h',
-        '../app/gfx/font_gtk.cc',
-        '../app/gfx/font_mac.mm',
-        '../app/gfx/font_skia.cc',
-        '../app/gfx/font_win.cc',
-        '../app/gfx/color_utils.cc',
-        '../app/gfx/color_utils.h',
-        '../app/gfx/favicon_size.h',
-        '../app/gfx/gtk_util.cc',
-        '../app/gfx/gtk_util.h',
-        '../app/gfx/icon_util.cc',
-        '../app/gfx/icon_util.h',
-        '../app/gfx/insets.h',
-        '../app/gfx/path_gtk.cc',
-        '../app/gfx/path_win.cc',
-        '../app/gfx/path.h',
-        '../app/gfx/text_elider.cc',
-        '../app/gfx/text_elider.h',
-        '../app/l10n_util.cc',
-        '../app/l10n_util.h',
-        '../app/l10n_util_posix.cc',
-        '../app/l10n_util_win.cc',
-        '../app/l10n_util_win.h',
-        '../app/message_box_flags.h',
-        '../app/os_exchange_data_win.cc',
-        '../app/os_exchange_data_gtk.cc',
-        '../app/os_exchange_data.h',
-        '../app/resource_bundle.cc',
-        '../app/resource_bundle.h',
-        '../app/resource_bundle_win.cc',
-        '../app/resource_bundle_linux.cc',
-        '../app/resource_bundle_mac.mm',
-        '../app/slide_animation.cc',
-        '../app/slide_animation.h',
-        '../app/theme_provider.h',
-        '../app/throb_animation.cc',
-        '../app/throb_animation.h',
-        '../app/win_util.cc',
-        '../app/win_util.h',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          '..',
-        ],
-      },
-      'conditions': [
-        ['OS=="linux"', {
-          'dependencies': [
-            # font_gtk.cc uses fontconfig.
-            # TODO(evanm): I think this is wrong; it should just use GTK.
-            '../build/linux/system.gyp:fontconfig',
-            '../build/linux/system.gyp:gtk',
-          ],
-        }],
-        ['OS!="win"', {
-          'sources!': [
-            '../app/drag_drop_types.cc',
-            '../app/drag_drop_types.h',
-            '../app/gfx/icon_util.cc',
-            '../app/gfx/icon_util.h',
-            '../app/os_exchange_data.cc',
-          ],
-          'conditions': [
-            ['toolkit_views==0', {
-              # Note: because of gyp predence rules this has to be defined as
-              # 'sources/' rather than 'sources!'.
-              'sources/': [
-                ['exclude', '^../app/os_exchange_data_gtk.cc'],
-                ['exclude', '^../app/os_exchange_data.h'],
-              ],
-            }],
-          ],
-        }],
-      ],
-    },
     {
       # theme_resources also generates a .cc file, so it can't use the rules above.
       'target_name': 'theme_resources',
@@ -313,10 +202,10 @@
       'target_name': 'common',
       'type': '<(library)',
       'dependencies': [
-        'app_base',
         'chrome_resources',
         'chrome_strings',
         'theme_resources',
+        '../app/app.gyp:app',
         '../base/base.gyp:base',
         '../base/base.gyp:base_gfx',
         '../build/temp_gyp/googleurl.gyp:googleurl',
@@ -514,7 +403,7 @@
         ],
       },
       'export_dependent_settings': [
-        'app_base',
+        '../app/app.gyp:app',
       ],
       'conditions': [
         ['OS=="linux"', {
-- 
GitLab