From 02b2c90e60f69349bb300134539dca37a398cacd Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Wed, 30 Jul 2014 16:34:40 +0000 Subject: [PATCH] extensions: Combine extensions_pak with app_shell_pak Use the same .pak file for both app_shell and extensions_unittests by merging app_shell_pak into extensions_pak. BUG=397250,394469 TEST=extensions_unittests and app_shell R=jamescook@chromium.org TBR=yoz@chromium.org Review URL: https://codereview.chromium.org/418283006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286536 0039d316-1c4b-4281-b951-d872f2087c98 --- athena/resources/athena_resources.gyp | 2 +- extensions/extensions.gyp | 40 ++++++++++--- extensions/shell/app/shell_main_delegate.cc | 7 ++- extensions/shell/app_shell.gyp | 62 +------------------- extensions/shell/app_shell_resources.gyp | 25 ++++++++ extensions/test/extensions_unittests_main.cc | 7 ++- 6 files changed, 67 insertions(+), 76 deletions(-) create mode 100644 extensions/shell/app_shell_resources.gyp diff --git a/athena/resources/athena_resources.gyp b/athena/resources/athena_resources.gyp index 3e8c7ce43efa25..e9a4ed9ea96105 100644 --- a/athena/resources/athena_resources.gyp +++ b/athena/resources/athena_resources.gyp @@ -13,7 +13,7 @@ 'dependencies': [ '../../ash/ash_resources.gyp:ash_resources', '../../content/content_resources.gyp:content_resources', - '../../extensions/shell/app_shell.gyp:app_shell_pak', + '../../extensions/extensions.gyp:extensions_shell_and_test_pak', '../../third_party/WebKit/public/blink_resources.gyp:blink_resources', '../../ui/chromeos/ui_chromeos.gyp:ui_chromeos_resources', '../../ui/chromeos/ui_chromeos.gyp:ui_chromeos_strings', diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index cec99e6e9df101..f65e8b2027764e 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -733,29 +733,51 @@ 'msvs_disabled_warnings': [ 4267, ], }, { - # TODO(jamescook): Use the same .pak file for both app_shell and - # extensions_unittests by creating an extensions_resources.pak file - # that can be used in both places. This will save build time. - # http://crbug.com/397250 - 'target_name': 'extensions_pak', + # The pak file generated by this target is intended to be shared by + # both shell and test targets. It was combined because it might help a + # little bit with build time by avoiding a repack step (one instead of + # two). + 'target_name': 'extensions_shell_and_test_pak', 'type': 'none', 'dependencies': [ + # Need extension related resources in common_resources.pak and + # renderer_resources_100_percent.pak + '../chrome/chrome_resources.gyp:chrome_resources', + # Need dev-tools related resources in shell_resources.pak and + # devtools_resources.pak. + '../content/browser/devtools/devtools_resources.gyp:devtools_resources', '../content/content_resources.gyp:content_resources', + '../content/content_shell_and_tests.gyp:content_shell_resources', + '../ui/resources/ui_resources.gyp:ui_resources', '../ui/strings/ui_strings.gyp:ui_strings', 'extensions_resources.gyp:extensions_resources', + 'extensions_strings.gyp:extensions_strings', + 'shell/app_shell_resources.gyp:app_shell_resources', ], 'actions': [ { - 'action_name': 'repack_extensions_pak', + 'action_name': 'repack_extensions_shell_and_test_pak', 'variables': { 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/chrome/extensions_api_resources.pak', + # TODO(jamescook): Extract the extension/app related resources + # from generated_resources_en-US.pak. http://crbug.com/397250 + '<(SHARED_INTERMEDIATE_DIR)/chrome/generated_resources_en-US.pak', + '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources_100_percent.pak', '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/content/shell_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_renderer_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/extensions/shell/app_shell_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/extensions/strings/extensions_strings_en-US.pak', + '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak', '<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_en-US.pak', '<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_en-US.pak', + '<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak', ], - 'pak_output': '<(PRODUCT_DIR)/extensions.pak', + 'pak_output': '<(PRODUCT_DIR)/extensions_shell_and_test.pak', }, 'includes': [ '../build/repack_action.gypi' ], }, @@ -780,9 +802,9 @@ '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', 'extensions_common', - 'extensions_pak', 'extensions_renderer', 'extensions_resources.gyp:extensions_resources', + 'extensions_shell_and_test_pak', 'extensions_strings.gyp:extensions_strings', 'extensions_test_support', ], diff --git a/extensions/shell/app/shell_main_delegate.cc b/extensions/shell/app/shell_main_delegate.cc index b3b6cebbdf8862..c49319edf55d5f 100644 --- a/extensions/shell/app/shell_main_delegate.cc +++ b/extensions/shell/app/shell_main_delegate.cc @@ -89,10 +89,11 @@ ShellMainDelegate::CreateShellRendererMainDelegate() { } void ShellMainDelegate::InitializeResourceBundle() { - base::FilePath pak_dir; - PathService::Get(base::DIR_MODULE, &pak_dir); + base::FilePath extensions_shell_and_test_pak_path; + PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path); ui::ResourceBundle::InitSharedInstanceWithPakPath( - pak_dir.AppendASCII("app_shell.pak")); + extensions_shell_and_test_pak_path.AppendASCII( + "extensions_shell_and_test.pak")); } // static diff --git a/extensions/shell/app_shell.gyp b/extensions/shell/app_shell.gyp index 833d079969f64e..0fced9298abf1b 100644 --- a/extensions/shell/app_shell.gyp +++ b/extensions/shell/app_shell.gyp @@ -7,70 +7,11 @@ 'chromium_code': 1, }, 'targets': [ - { - 'target_name': 'app_shell_resources', - 'type': 'none', - 'actions': [ - { - 'action_name': 'generate_app_shell_resources', - 'variables': { - 'grit_grd_file': 'app_shell_resources.grd', - 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/extensions/shell', - }, - 'includes': [ '../../build/grit_action.gypi' ], - }, - ], - }, - { - 'target_name': 'app_shell_pak', - 'type': 'none', - 'dependencies': [ - 'app_shell_resources', - # Need extension related resources in common_resources.pak and - # renderer_resources_100_percent.pak - '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources', - # Need dev-tools related resources in shell_resources.pak and - # devtools_resources.pak. - '<(DEPTH)/content/content_shell_and_tests.gyp:content_shell_resources', - '<(DEPTH)/content/browser/devtools/devtools_resources.gyp:devtools_resources', - '<(DEPTH)/extensions/extensions_resources.gyp:extensions_resources', - '<(DEPTH)/extensions/extensions_strings.gyp:extensions_strings', - '<(DEPTH)/ui/resources/ui_resources.gyp:ui_resources', - '<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings', - ], - 'actions': [ - { - 'action_name': 'repack_app_shell_pack', - 'variables': { - 'pak_inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/chrome/extensions_api_resources.pak', - # TODO(jamescook): Extract the extension/app related resources - # from generated_resources_en-US.pak. http://crbug.com/397250 - '<(SHARED_INTERMEDIATE_DIR)/chrome/generated_resources_en-US.pak', - '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources_100_percent.pak', - '<(SHARED_INTERMEDIATE_DIR)/content/shell_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_renderer_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/extensions/shell/app_shell_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/extensions/strings/extensions_strings_en-US.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_en-US.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_en-US.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak', - ], - 'pak_output': '<(PRODUCT_DIR)/app_shell.pak', - }, - 'includes': [ '../../build/repack_action.gypi' ], - }, - ], - }, { 'target_name': 'app_shell_lib', 'type': 'static_library', 'defines!': ['CONTENT_IMPLEMENTATION'], 'dependencies': [ - 'app_shell_pak', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_prefs_test_support', '<(DEPTH)/components/components.gyp:omaha_query_params', @@ -85,6 +26,7 @@ '<(DEPTH)/extensions/extensions.gyp:extensions_browser', '<(DEPTH)/extensions/extensions.gyp:extensions_common', '<(DEPTH)/extensions/extensions.gyp:extensions_renderer', + '<(DEPTH)/extensions/extensions.gyp:extensions_shell_and_test_pak', '<(DEPTH)/extensions/extensions_resources.gyp:extensions_resources', '<(DEPTH)/extensions/shell/common/api/api.gyp:shell_api', '<(DEPTH)/mojo/mojo.gyp:mojo_environment_chromium', @@ -173,7 +115,7 @@ 'defines!': ['CONTENT_IMPLEMENTATION'], 'dependencies': [ 'app_shell_lib', - 'app_shell_pak', + '<(DEPTH)/extensions/extensions.gyp:extensions_shell_and_test_pak', ], 'include_dirs': [ '../..', diff --git a/extensions/shell/app_shell_resources.gyp b/extensions/shell/app_shell_resources.gyp new file mode 100644 index 00000000000000..162bd895191e3e --- /dev/null +++ b/extensions/shell/app_shell_resources.gyp @@ -0,0 +1,25 @@ +# Copyright 2014 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. + +{ + 'targets': [ + { + 'target_name': 'app_shell_resources', + 'type': 'none', + 'variables': { + 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/extensions/shell', + }, + 'actions': [ + { + 'action_name': 'generate_app_shell_resources', + 'variables': { + 'grit_grd_file': 'app_shell_resources.grd', + }, + 'includes': [ '../../build/grit_action.gypi' ], + }, + ], + 'includes': [ '../../build/grit_target.gypi' ], + }, + ] # targets +} diff --git a/extensions/test/extensions_unittests_main.cc b/extensions/test/extensions_unittests_main.cc index be46e857c73c54..50b02473960427 100644 --- a/extensions/test/extensions_unittests_main.cc +++ b/extensions/test/extensions_unittests_main.cc @@ -75,10 +75,11 @@ void ExtensionsTestSuite::Initialize() { extensions::RegisterPathProvider(); - base::FilePath extensions_pak_path; - PathService::Get(base::DIR_MODULE, &extensions_pak_path); + base::FilePath extensions_shell_and_test_pak_path; + PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path); ui::ResourceBundle::InitSharedInstanceWithPakPath( - extensions_pak_path.AppendASCII("extensions.pak")); + extensions_shell_and_test_pak_path.AppendASCII( + "extensions_shell_and_test.pak")); client_.reset(new extensions::TestExtensionsClient()); extensions::ExtensionsClient::Set(client_.get());