Skip to content

Commit

Permalink
Clean up repack.py and repack_locale.py usage.
Browse files Browse the repository at this point in the history
- Creates repack_pack.gypi action
- Updates all the call-sites of repack.py
- Removes chrome_repack_pseudo_locales.gypi to instead use
  chrome_repack_locales.gypi
- Remove unused repack_locales_cmd list

BUG=338759
R=tfarina@chromium.org, thakis@chromium.org
TBR=asargent@chromium.org, benm@chromium.org, blundell@chromium.org

Review URL: https://codereview.chromium.org/216013003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260279 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
aurimas@google.com committed Mar 28, 2014
1 parent 65486ad commit 01bdc92
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 159 deletions.
14 changes: 2 additions & 12 deletions android_webview/android_webview.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
'<(DEPTH)/ui/resources/ui_resources.gyp:ui_resources',
'<(DEPTH)/webkit/webkit_resources.gyp:webkit_resources',
],
'variables': {
'repack_path': '<(DEPTH)/tools/grit/grit/format/repack.py',
},
'actions': [
{
'action_name': 'repack_android_webview_pack',
Expand All @@ -65,16 +62,9 @@
'<(SHARED_INTERMEDIATE_DIR)/webkit/blink_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources_100_percent.pak',
],
'pak_output': '<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'outputs': [
'<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
],
'action': ['python', '<(repack_path)', '<@(_outputs)',
'<@(pak_inputs)'],
'includes': [ '../build/repack_action.gypi' ],
}
],
},
Expand Down
14 changes: 2 additions & 12 deletions apps/apps.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@
'../ui/base/strings/ui_strings.gyp:ui_strings',
'../ui/resources/ui_resources.gyp:ui_resources',
],
'variables': {
'repack_path': '<(DEPTH)/tools/grit/grit/format/repack.py',
},
'actions': [
{
'action_name': 'repack_app_shell_pack',
Expand All @@ -139,16 +136,9 @@
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_en-US.pak',
'<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak',
],
'pak_output': '<(PRODUCT_DIR)/app_shell.pak',
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'outputs': [
'<(PRODUCT_DIR)/app_shell.pak',
],
'action': ['python', '<(repack_path)', '<@(_outputs)',
'<@(pak_inputs)'],
'includes': [ '../build/repack_action.gypi' ],
},
],
},
Expand Down
23 changes: 23 additions & 0 deletions build/repack_action.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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.

# This file is meant to be included into an action to invoke grit repack in a
# consistent manner. To use this the following variables need to be
# defined:
# pak_inputs: list: paths of pak files that need to be combined.
# pak_output: string: the output pak file path.

{
'variables': {
'repack_path': '<(DEPTH)/tools/grit/grit/format/repack.py',
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'outputs': [
'<(pak_output)'
],
'action': ['python', '<(repack_path)', '<(pak_output)', '<@(pak_inputs)'],
}
1 change: 0 additions & 1 deletion chrome/chrome.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'allocator_target': '../base/allocator/allocator.gyp:allocator',
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome',
'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
'repack_locales_cmd': ['python', 'tools/build/repack_locales.py'],
'conditions': [
['OS!="ios"', {
'chromium_browser_dependencies': [
Expand Down
1 change: 0 additions & 1 deletion chrome/chrome_dll_bundle.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
}],
],
'libpeer_target_type%': 'static_library',
'repack_path': '../tools/grit/grit/format/repack.py',
},
'postbuilds': [
{
Expand Down
10 changes: 2 additions & 8 deletions chrome/chrome_repack_chrome_100_percent.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'<(grit_out_dir)/renderer_resources_100_percent.pak',
'<(grit_out_dir)/theme_resources_100_percent.pak',
],
'pak_output': '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_100_percent.pak',
'conditions': [
['OS != "ios"', {
'pak_inputs': [
Expand All @@ -23,12 +24,5 @@
}],
],
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/repack/chrome_100_percent.pak',
],
'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
'includes': [ '../build/repack_action.gypi' ],
}
10 changes: 2 additions & 8 deletions chrome/chrome_repack_chrome_200_percent.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'<(grit_out_dir)/renderer_resources_200_percent.pak',
'<(grit_out_dir)/theme_resources_200_percent.pak',
],
'pak_output': '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_200_percent.pak',
'conditions': [
['OS != "ios"', {
'pak_inputs': [
Expand All @@ -23,12 +24,5 @@
}],
],
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/repack/chrome_200_percent.pak',
],
'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
'includes': [ '../build/repack_action.gypi' ],
}
21 changes: 11 additions & 10 deletions chrome/chrome_repack_locales.gypi
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
# Copyright (c) 2012 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.

# To use this the following variables need to be defined:
# pak_locales: string: the list of all the locales that need repacking
{
'action_name': 'repack_locales',
'variables': {
'repack_locales_path': 'tools/build/repack_locales.py',
'conditions': [
['branding=="Chrome"', {
'branding_flag': ['-b', 'google_chrome',],
}, { # else: branding!="Chrome"
'branding_flag': ['-b', 'chromium',],
}],
],
'repack_extra_flags%': [],
'repack_output_dir%': '<(SHARED_INTERMEDIATE_DIR)',
},
'inputs': [
'tools/build/repack_locales.py',
'<!@pymod_do_main(repack_locales -i -p <(OS) <(branding_flag) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(repack_output_dir) --use-ash <(use_ash) <(repack_extra_flags) <(locales))'
'<(repack_locales_path)',
'<!@pymod_do_main(repack_locales -i -p <(OS) <(branding_flag) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) --use-ash <(use_ash) <(pak_locales))'
],
'outputs': [
'<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(repack_output_dir) <(locales))'
'<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(pak_locales))'
],
'action': [
'<@(repack_locales_cmd)',
'python',
'<(repack_locales_path)',
'<@(branding_flag)',
'-p', '<(OS)',
'-g', '<(grit_out_dir)',
'-s', '<(SHARED_INTERMEDIATE_DIR)',
'-x', '<(repack_output_dir)/.',
'-x', '<(SHARED_INTERMEDIATE_DIR)/.',
'--use-ash', '<(use_ash)',
'<@(repack_extra_flags)',
'<@(locales)',
'<@(pak_locales)',
],
}
40 changes: 0 additions & 40 deletions chrome/chrome_repack_pseudo_locales.gypi

This file was deleted.

10 changes: 2 additions & 8 deletions chrome/chrome_repack_resources.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'<(grit_out_dir)/sync_internals_resources.pak',
'<(grit_out_dir)/translate_internals_resources.pak',
],
'pak_output': '<(SHARED_INTERMEDIATE_DIR)/repack/resources.pak',
'conditions': [
['OS != "ios"', {
'pak_inputs': [
Expand All @@ -44,12 +45,5 @@
}],
],
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/repack/resources.pak',
],
'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
'includes': [ '../build/repack_action.gypi' ],
}
17 changes: 9 additions & 8 deletions chrome/chrome_resources.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome',
'about_credits_file': '<(SHARED_INTERMEDIATE_DIR)/about_credits.html',
'additional_modules_list_file': '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/internal/additional_modules_list.txt',
'repack_locales_cmd': ['python', 'tools/build/repack_locales.py'],
},
'targets': [
{
Expand Down Expand Up @@ -320,9 +319,6 @@
{
'target_name': 'packed_extra_resources',
'type': 'none',
'variables': {
'repack_path': '../tools/grit/grit/format/repack.py',
},
'dependencies': [
'chrome_extra_resources',
'packed_resources',
Expand Down Expand Up @@ -350,9 +346,6 @@
{
'target_name': 'packed_resources',
'type': 'none',
'variables': {
'repack_path': '../tools/grit/grit/format/repack.py',
},
'dependencies': [
# MSVS needs the dependencies explictly named, Make is able to
# derive the dependencies from the output files.
Expand All @@ -367,10 +360,18 @@
],
'actions': [
{
'action_name': 'repack_locales_pack',
'variables': {
'pak_locales': '<(locales)',
},
'includes': ['chrome_repack_locales.gypi']
},
{
'includes': ['chrome_repack_pseudo_locales.gypi']
'action_name': 'repack_pseudo_locales_pack',
'variables': {
'pak_locales': '<(pseudo_locales)',
},
'includes': ['chrome_repack_locales.gypi']
},
{
'includes': ['chrome_repack_chrome_100_percent.gypi']
Expand Down
12 changes: 2 additions & 10 deletions components/components_tests.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -561,21 +561,13 @@
{
'action_name': 'repack_components_pack',
'variables': {
'repack_path': '<(DEPTH)/tools/grit/grit/format/repack.py',
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/components/component_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/components/strings/component_strings_en-US.pak',
],
'pak_output': '<(PRODUCT_DIR)/components_resources.pak',
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'outputs': [
'<(PRODUCT_DIR)/components_resources.pak',
],
'action': ['python', '<(repack_path)', '<@(_outputs)',
'<@(pak_inputs)'],
'includes': [ '../build/repack_action.gypi' ],
},
],
'conditions': [
Expand Down
38 changes: 13 additions & 25 deletions content/content_shell.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,6 @@
],
}],
],
'variables': {
'repack_path': '<(DEPTH)/tools/grit/grit/format/repack.py',
},
'actions': [
{
'action_name': 'repack_content_shell_pack',
Expand All @@ -493,29 +490,20 @@
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources_100_percent.pak',
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak',
],
'conditions': [
['OS!="android"', {
'variables': {
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak',
],
},
'pak_output': '<(PRODUCT_DIR)/content_shell.pak',
}, {
'pak_output': '<(PRODUCT_DIR)/content_shell/assets/content_shell.pak',
}],
],
},
'inputs': [
'<(repack_path)',
'<@(pak_inputs)',
],
'action': ['python', '<(repack_path)', '<@(_outputs)',
'<@(pak_inputs)'],
'conditions': [
['OS!="android"', {
'variables': {
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak',
],
},
'outputs': [
'<(PRODUCT_DIR)/content_shell.pak',
],
}, {
'outputs': [
'<(PRODUCT_DIR)/content_shell/assets/content_shell.pak',
],
}],
],
'includes': [ '../build/repack_action.gypi' ],
},
],
},
Expand Down
Loading

0 comments on commit 01bdc92

Please sign in to comment.