From ebee6770f6478f1248330661908f2d15b1476ede Mon Sep 17 00:00:00 2001 From: "dhollowa@chromium.org" Date: Thu, 3 Nov 2011 19:27:33 +0000 Subject: Introduces chromium_resources.gyp to factor out Chrome resource generation 1. Factors out Chrome/Chromium resource generation into a separate chrome_resources.gyp file. 2. Eliminates repetition between Mac and other platforms. 3. Breaks long "repack" actions out into separate files for greater readability. 4. Eliminates circular dependencies in the Aura shell, the Views components, and the compositor when utilizing Chrome resources. BUG=none TEST=try bots run gyps and build correctly. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=107967 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=108466 Review URL: http://codereview.chromium.org/8425002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108517 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/chrome.gyp | 445 +----------------------- chrome/chrome_browser.gypi | 10 +- chrome/chrome_common.gypi | 12 +- chrome/chrome_dll.gypi | 161 +-------- chrome/chrome_exe.gypi | 4 +- chrome/chrome_installer_util.gypi | 8 +- chrome/chrome_renderer.gypi | 4 +- chrome/chrome_repack_chrome.gypi | 45 +++ chrome/chrome_repack_locales.gypi | 30 ++ chrome/chrome_repack_pseudo_locales.gypi | 38 ++ chrome/chrome_repack_resources.gypi | 34 ++ chrome/chrome_repack_theme_resources_large.gypi | 21 ++ chrome/chrome_resources.gyp | 367 +++++++++++++++++++ chrome/chrome_tests.gypi | 83 +++-- chrome/nacl.gypi | 4 +- 15 files changed, 620 insertions(+), 646 deletions(-) create mode 100644 chrome/chrome_repack_chrome.gypi create mode 100644 chrome/chrome_repack_locales.gypi create mode 100644 chrome/chrome_repack_pseudo_locales.gypi create mode 100644 chrome/chrome_repack_resources.gypi create mode 100644 chrome/chrome_repack_theme_resources_large.gypi create mode 100644 chrome/chrome_resources.gyp (limited to 'chrome') diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 2a76224..40c7ed7 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -134,229 +134,6 @@ ], 'targets': [ { - # TODO(mark): It would be better if each static library that needed - # to run grit would list its own .grd files, but unfortunately some - # of the static libraries currently have circular dependencies among - # generated headers. - 'target_name': 'chrome_resources', - 'type': 'none', - 'actions': [ - # Data resources. - { - 'action_name': 'browser_resources', - 'variables': { - 'grit_grd_file': 'browser/browser_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'common_resources', - 'variables': { - 'grit_grd_file': 'common/common_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'renderer_resources', - 'variables': { - 'grit_grd_file': 'renderer/renderer_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - ], - 'includes': [ '../build/grit_target.gypi' ], - }, - { - # TODO(mark): It would be better if each static library that needed - # to run grit would list its own .grd files, but unfortunately some - # of the static libraries currently have circular dependencies among - # generated headers. - 'target_name': 'chrome_strings', - 'type': 'none', - 'conditions': [ - ['OS=="win"', { - # HACK(nsylvain): We want to enforce a fake dependency on - # intaller_util_string. install_util depends on both - # chrome_strings and installer_util_strings, but for some reasons - # Incredibuild does not enforce it (most likely a bug). By changing - # the type and making sure we depend on installer_util_strings, it - # will always get built before installer_util. - 'type': 'dummy_executable', - 'dependencies': ['installer_util_strings'], - }], - ], - 'actions': [ - # Localizable resources. - { - 'action_name': 'locale_settings', - 'variables': { - 'grit_grd_file': 'app/resources/locale_settings.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'chromium_strings.grd', - 'variables': { - 'grit_grd_file': 'app/chromium_strings.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'generated_resources', - 'variables': { - 'grit_grd_file': 'app/generated_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'google_chrome_strings', - 'variables': { - 'grit_grd_file': 'app/google_chrome_strings.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - ], - 'includes': [ '../build/grit_target.gypi' ], - }, - { - 'target_name': 'theme_resources', - 'type': 'none', - 'actions': [ - { - 'action_name': 'theme_resources', - 'variables': { - 'grit_grd_file': 'app/theme/theme_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'theme_resources_large', - 'variables': { - 'grit_grd_file': 'app/theme/theme_resources_large.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'theme_resources_standard', - 'variables': { - 'grit_grd_file': 'app/theme/theme_resources_standard.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - ], - 'includes': [ '../build/grit_target.gypi' ], - }, - { - 'target_name': 'platform_locale_settings', - 'type': 'none', - 'actions': [ - { - 'action_name': 'platform_locale_settings', - 'variables': { - 'grit_grd_file': '<(platform_locale_settings_grd)', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - ], - 'includes': [ '../build/grit_target.gypi' ], - }, - { - 'target_name': 'chrome_extra_resources', - 'type': 'none', - 'dependencies': [ - '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:generate_devtools_grd', - ], - # These resources end up in resources.pak because they are resources - # used by internal pages. Putting them in a spearate pak file makes - # it easier for us to reference them internally. - 'actions': [ - { - 'action_name': 'component_extension_resources', - 'variables': { - 'grit_grd_file': 'browser/resources/component_extension_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'net_internals_resources', - 'variables': { - 'grit_grd_file': 'browser/resources/net_internals_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'options_resources', - 'variables': { - 'grit_grd_file': 'browser/resources/options_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'quota_internals_resources', - 'variables': { - 'grit_grd_file': 'browser/resources/quota_internals_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'shared_resources', - 'variables': { - 'grit_grd_file': 'browser/resources/shared_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'sync_internals_resources', - 'variables': { - 'grit_grd_file': 'browser/resources/sync_internals_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'workers_resources', - 'variables': { - 'grit_grd_file': 'browser/resources/workers_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - { - 'action_name': 'devtools_frontend_resources', - 'variables': { - 'grit_grd_file': - 'browser/debugger/frontend/devtools_frontend_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ] - }, - { - 'action_name': 'devtools_resources', - # This can't use ../build/grit_action.gypi because the grd file - # is generated a build time, so the trick of using grit_info to get - # the real inputs/outputs at GYP time isn't possible. - 'variables': { - 'grit_cmd': ['python', '../tools/grit/grit.py'], - 'grit_grd_file': '<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd', - }, - 'inputs': [ - '<(grit_grd_file)', - '!@(<(repack_locales_cmd) -i <(branding_flag) -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))', - ], - 'outputs': [ - '>!@(<(repack_locales_cmd) -o -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))', - ], - 'action': [ - '<@(repack_locales_cmd)', - '<@(branding_flag)', - '-g', '<(grit_out_dir)', - '-s', '<(SHARED_INTERMEDIATE_DIR)', - '-x', '<(INTERMEDIATE_DIR)', - '<@(locales)', - ], - }, - { - # This is an exact copy of the above phase, except for two - # changes: - # 1. process_outputs_as_mac_bundle_resources is omitted. - # 2. We pass 'pseudo_locales' instead of 'locales' wherever - # 'locales' is used. - # The result is a build phase that builds all pseudo locales - # but doesn't copy them to the final dll/framework. - 'action_name': 'repack_pseudo_locales', - 'variables': { - 'conditions': [ - ['branding=="Chrome"', { - 'branding_flag': ['-b', 'google_chrome',], - }, { # else: branding!="Chrome" - 'branding_flag': ['-b', 'chromium',], - }], - ], - }, - 'inputs': [ - 'tools/build/repack_locales.py', - # NOTE: Ideally the common command args would be shared - # amongst inputs/outputs/action, but the args include shell - # variables which need to be passed intact, and command - # expansion wants to expand the shell variables. Adding the - # explicit quoting here was the only way it seemed to work. - '>!@(<(repack_locales_cmd) -i <(branding_flag) -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(pseudo_locales))', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/<(pseudo_locales).pak' - ], - 'action': [ - '<@(repack_locales_cmd)', - '<@(branding_flag)', - '-g', '<(grit_out_dir)', - '-s', '<(SHARED_INTERMEDIATE_DIR)', - '-x', '<(INTERMEDIATE_DIR)', - '<@(pseudo_locales)', - ], - }, - { - 'action_name': 'repack_resources', - 'variables': { - 'pak_inputs': [ - '<(grit_out_dir)/component_extension_resources.pak', - '<(grit_out_dir)/devtools_frontend_resources.pak', - '<(grit_out_dir)/devtools_resources.pak', - '<(grit_out_dir)/net_internals_resources.pak', - '<(grit_out_dir)/options_resources.pak', - '<(grit_out_dir)/quota_internals_resources.pak', - '<(grit_out_dir)/shared_resources.pak', - '<(grit_out_dir)/sync_internals_resources.pak', - '<(grit_out_dir)/workers_resources.pak', - ], - }, - 'inputs': [ - '<(repack_path)', - '<@(pak_inputs)', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/repack/resources.pak', - ], - 'action': ['python', '<(repack_path)', '<@(_outputs)', - '<@(pak_inputs)'], - 'process_outputs_as_mac_bundle_resources': 1, + 'includes': ['chrome_repack_theme_resources_large.gypi'] }, ], 'postbuilds': [ @@ -553,15 +418,17 @@ ], }, { + # Copy of resources used by tests. 'destination': '<(PRODUCT_DIR)', 'files': [ - '<(INTERMEDIATE_DIR)/repack/resources.pak' + '<(SHARED_INTERMEDIATE_DIR)/repack/resources.pak' ], }, { + # Copy of resources used by tests. 'destination': '<(PRODUCT_DIR)/pseudo_locales', 'files': [ - '<(INTERMEDIATE_DIR)/<(pseudo_locales).pak' + '<(SHARED_INTERMEDIATE_DIR)/<(pseudo_locales).pak' ], }, { diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 9fa9d59..e19d4ea 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -400,8 +400,8 @@ }], ], 'dependencies': [ - 'packed_extra_resources', - 'packed_resources', + 'chrome_resources.gyp:packed_extra_resources', + 'chrome_resources.gyp:packed_resources', # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp # file decide what to do on a per-OS basis; on Mac, internal plugins # go inside the framework, so this dependency is in chrome_dll.gypi. diff --git a/chrome/chrome_installer_util.gypi b/chrome/chrome_installer_util.gypi index fedb136..f6bbe07 100644 --- a/chrome/chrome_installer_util.gypi +++ b/chrome/chrome_installer_util.gypi @@ -99,8 +99,8 @@ 'installer_util_strings', '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', 'common_constants', - 'chrome_resources', - 'chrome_strings', + 'chrome_resources.gyp:chrome_resources', + 'chrome_resources.gyp:chrome_strings', '../content/content.gyp:content_common', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', @@ -174,8 +174,8 @@ 'type': 'static_library', 'dependencies': [ 'common_constants', - 'chrome_resources', - 'chrome_strings', + 'chrome_resources.gyp:chrome_resources', + 'chrome_resources.gyp:chrome_strings', ], 'sources': [ 'installer/util/master_preferences.cc', diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index 0e83f01..38659ce 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -10,8 +10,8 @@ 'dependencies': [ 'common', 'common_net', - 'chrome_resources', - 'chrome_strings', + 'chrome_resources.gyp:chrome_resources', + 'chrome_resources.gyp:chrome_strings', 'safe_browsing_proto', '../content/content.gyp:content_renderer', '../net/net.gyp:net', diff --git a/chrome/chrome_repack_chrome.gypi b/chrome/chrome_repack_chrome.gypi new file mode 100644 index 0000000..f7f6795 --- /dev/null +++ b/chrome/chrome_repack_chrome.gypi @@ -0,0 +1,45 @@ +# Copyright (c) 2011 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. +{ + 'action_name': 'repack_chrome', + 'variables': { + 'pak_inputs': [ + '<(grit_out_dir)/browser_resources.pak', + '<(grit_out_dir)/common_resources.pak', + '<(grit_out_dir)/default_plugin_resources/default_plugin_resources.pak', + '<(grit_out_dir)/renderer_resources.pak', + '<(grit_out_dir)/theme_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak', + ], + 'conditions': [ + ['OS != "mac"', { + 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak', + ] + }], + ['touchui==0 or OS == "mac"', { + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_standard.pak', + '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.pak', + ], + }, { # else: touchui!=0 + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_large.pak', + '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_large/ui_resources_large.pak', + ], + }], + ], + }, + 'inputs': [ + '<(repack_path)', + '<@(pak_inputs)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/repack/chrome.pak', + ], + 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'], +} diff --git a/chrome/chrome_repack_locales.gypi b/chrome/chrome_repack_locales.gypi new file mode 100644 index 0000000..f14c17c --- /dev/null +++ b/chrome/chrome_repack_locales.gypi @@ -0,0 +1,30 @@ +# Copyright (c) 2011 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. +{ + 'action_name': 'repack_locales', + 'variables': { + 'conditions': [ + ['branding=="Chrome"', { + 'branding_flag': ['-b', 'google_chrome',], + }, { # else: branding!="Chrome" + 'branding_flag': ['-b', 'chromium',], + }], + ], + }, + 'inputs': [ + 'tools/build/repack_locales.py', + '