summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]tools/grit/grit.py4
-rw-r--r--tools/grit/grit/grd_reader_unittest.py10
-rw-r--r--tools/grit/grit/grit_runner.py14
-rw-r--r--tools/grit/grit/node/misc.py47
-rw-r--r--tools/grit/grit/node/misc_unittest.py9
-rw-r--r--tools/grit/grit/testdata/chrome/app/generated_resources.grd199
-rw-r--r--tools/grit/grit/testdata/resource_ids1
-rw-r--r--tools/grit/grit/testdata/tools/grit/resource_ids (renamed from tools/grit/resource_ids)5
-rwxr-xr-xtools/grit/grit_info.py13
-rw-r--r--tools/gritsettings/resource_ids175
10 files changed, 445 insertions, 32 deletions
diff --git a/tools/grit/grit.py b/tools/grit/grit.py
index b9c1ad8..772d8c2 100644..100755
--- a/tools/grit/grit.py
+++ b/tools/grit/grit.py
@@ -1,5 +1,5 @@
-#!/usr/bin/python2.4
-# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+#!/usr/bin/python
+# 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.
diff --git a/tools/grit/grit/grd_reader_unittest.py b/tools/grit/grit/grd_reader_unittest.py
index 1670e4a..050f877c 100644
--- a/tools/grit/grit/grd_reader_unittest.py
+++ b/tools/grit/grit/grd_reader_unittest.py
@@ -114,8 +114,10 @@ class GrdReaderUnittest(unittest.TestCase):
grit_root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'..')
root.AssignFirstIds(
- os.path.join(grit_root_dir, "../../chrome/app/generated_resources.grd"),
- None, {})
+ os.path.join(grit_root_dir,
+ "grit/testdata/chrome/app/generated_resources.grd"),
+ os.path.join(grit_root_dir, "grit/testdata/tools/grit/resource_ids"),
+ {})
messages_node = root.children[0].children[0]
self.failUnless(isinstance(messages_node, empty.MessagesNode))
self.failUnless(messages_node.attrs["first_id"] !=
@@ -144,7 +146,9 @@ class GrdReaderUnittest(unittest.TestCase):
grit_root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'..')
root.AssignFirstIds(
- os.path.join(grit_root_dir, "../../test.grd"),
+ # This file does not actually exist, but the path must match
+ # the path of the resource_ids file as it has SRCDIR set to "."
+ os.path.join(grit_root_dir, "grit/testdata/test.grd"),
os.path.join(grit_root_dir, "grit/testdata/resource_ids"),
{})
messages_node = root.children[0].children[0]
diff --git a/tools/grit/grit/grit_runner.py b/tools/grit/grit/grit_runner.py
index 2af7299..b42bfce 100644
--- a/tools/grit/grit/grit_runner.py
+++ b/tools/grit/grit/grit_runner.py
@@ -1,5 +1,5 @@
#!/usr/bin/python2.4
-# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+# 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.
@@ -52,12 +52,16 @@ _TOOLS = [
_REQUIRES_INPUT : False }],
['sdiff', { _CLASS : grit.tool.diff_structures.DiffStructures,
_REQUIRES_INPUT : False }],
- ['resize', { _CLASS : grit.tool.resize.ResizeDialog, _REQUIRES_INPUT : True }],
+ ['resize', {
+ _CLASS : grit.tool.resize.ResizeDialog, _REQUIRES_INPUT : True }],
['unit', { _CLASS : grit.tool.unit.UnitTestTool, _REQUIRES_INPUT : False }],
['count', { _CLASS : grit.tool.count.CountMessage, _REQUIRES_INPUT : True }],
- ['test', { _CLASS: grit.tool.test.TestTool, _REQUIRES_INPUT : True, _HIDDEN : True }],
- ['menufromparts', { _CLASS: grit.tool.menu_from_parts.MenuTranslationsFromParts,
- _REQUIRES_INPUT : True, _HIDDEN : True }],
+ ['test', {
+ _CLASS: grit.tool.test.TestTool, _REQUIRES_INPUT : True,
+ _HIDDEN : True }],
+ ['menufromparts', {
+ _CLASS: grit.tool.menu_from_parts.MenuTranslationsFromParts,
+ _REQUIRES_INPUT : True, _HIDDEN : True }],
]
diff --git a/tools/grit/grit/node/misc.py b/tools/grit/grit/node/misc.py
index e077b03..46eae17 100644
--- a/tools/grit/grit/node/misc.py
+++ b/tools/grit/grit/node/misc.py
@@ -1,5 +1,5 @@
#!/usr/bin/python2.4
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
@@ -20,15 +20,25 @@ from grit import util
import grit.format.rc_header
-def _ReadFirstIdsFromFile(filename, defines, src_root_dir):
+def _ReadFirstIdsFromFile(filename, defines):
'''Read the starting resource id values from |filename|. We also
expand variables of the form <(FOO) based on defines passed in on
- the command line.'''
+ the command line.
+
+ Returns a tuple, the absolute path of SRCDIR followed by the
+ first_ids dictionary.
+ '''
first_ids_dict = eval(open(filename).read())
+ # TODO(joi@chromium.org): It might make sense to make this a
+ # parameter of the .grd file rather than of the resource_ids file.
+ src_root_dir = os.path.abspath(os.path.join(os.path.dirname(filename),
+ first_ids_dict['SRCDIR']))
+
def ReplaceVariable(matchobj):
for key, value in defines.iteritems():
if matchobj.group(1) == key:
+ value = os.path.join(src_root_dir, value)
value = os.path.abspath(value)[len(src_root_dir) + 1:]
return value
return ''
@@ -45,7 +55,7 @@ def _ReadFirstIdsFromFile(filename, defines, src_root_dir):
first_ids_dict[new_grd_filename] = first_ids_dict[grd_filename]
del(first_ids_dict[grd_filename])
- return first_ids_dict
+ return (src_root_dir, first_ids_dict)
class IfNode(base.Node):
@@ -303,27 +313,34 @@ class GritNode(base.Node):
if type(filename_or_stream) not in (str, unicode):
return
- # By default, we use the the file resources_ids next to grit.py
- # to determine what ids to assign to resources.
- grit_root_dir = os.path.abspath(os.path.join(os.path.dirname(
- os.path.abspath(__file__)), '..', '..'))
+ # TODO(joi@chromium.org): Get rid of this hack by making it
+ # possible to specify the resource_ids file to use as an attribute
+ # of the <grit> node in the .grd file, and doing so in all Chrome
+ # .grd files.
+ #
+ # For now, by default, we use the the file
+ # ../gritsettings/resource_ids relative to grit.py.
if not first_id_filename:
- first_id_filename = os.path.join(grit_root_dir, 'resource_ids')
+ first_id_filename = os.path.join(
+ os.path.dirname(__file__),
+ '..', '..', '..',
+ 'gritsettings', 'resource_ids')
first_ids = None
from grit.node import empty
for node in self.inorder():
if isinstance(node, empty.GroupingNode):
- # The checkout base directory is 2 directories up from grit.py.
- src_root_dir = os.path.dirname(os.path.dirname(grit_root_dir))
-
+ if not first_ids:
+ src_root_dir, first_ids = _ReadFirstIdsFromFile(first_id_filename,
+ defines)
filename = os.path.abspath(filename_or_stream)[
len(src_root_dir) + 1:]
filename = filename.replace('\\', '/')
- if not first_ids:
- first_ids = _ReadFirstIdsFromFile(first_id_filename, defines,
- src_root_dir)
+ # TODO(joi@chromium.org): Generalize this; users other than
+ # Chrome might want to use the first_id attribute; could check
+ # for first_ids == None to indicate not loaded, first_ids ==
+ # {} to indicate tried to load but found no resource_ids file.
if node.attrs['first_id'] != '':
raise Exception("Don't set the first_id attribute, update "
"%s instead." % first_id_filename)
diff --git a/tools/grit/grit/node/misc_unittest.py b/tools/grit/grit/node/misc_unittest.py
index 11f7b8f..6e89465 100644
--- a/tools/grit/grit/node/misc_unittest.py
+++ b/tools/grit/grit/node/misc_unittest.py
@@ -32,13 +32,12 @@ class GritNodeUnittest(unittest.TestCase):
def testReadFirstIdsFromFile(self):
test_resource_ids = os.path.join(os.path.dirname(__file__), '..',
'testdata', 'resource_ids')
- id_dict = misc._ReadFirstIdsFromFile(
+ src_dir, id_dict = misc._ReadFirstIdsFromFile(
test_resource_ids,
{
- 'FOO': '/bar',
- 'SHARED_INTERMEDIATE_DIR': '/out/Release/obj/gen',
- },
- '')
+ 'FOO': 'bar',
+ 'SHARED_INTERMEDIATE_DIR': 'out/Release/obj/gen',
+ })
self.assertEqual({}, id_dict.get('bar/file.grd', None))
self.assertEqual({},
id_dict.get('out/Release/obj/gen/devtools/devtools.grd', None))
diff --git a/tools/grit/grit/testdata/chrome/app/generated_resources.grd b/tools/grit/grit/testdata/chrome/app/generated_resources.grd
new file mode 100644
index 0000000..c2efb77
--- /dev/null
+++ b/tools/grit/grit/testdata/chrome/app/generated_resources.grd
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+This file contains definitions of resources that will be translated for each
+locale. The variables is_win, is_macosx, is_linux, and is_posix are available
+for making strings OS specific. Other platform defines such as use_titlecase
+are declared in build/common.gypi.
+-->
+
+<grit base_dir="." latest_public_release="0" current_release="1"
+ source_lang_id="en" enc_check="möl">
+ <outputs>
+ <output filename="grit/generated_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="generated_resources_am.pak" type="data_package" lang="am" />
+ <output filename="generated_resources_ar.pak" type="data_package" lang="ar" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_ast.pak" type="data_package" lang="ast" />
+ </if>
+ <output filename="generated_resources_bg.pak" type="data_package" lang="bg" />
+ <output filename="generated_resources_bn.pak" type="data_package" lang="bn" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_bs.pak" type="data_package" lang="bs" />
+ </if>
+ <output filename="generated_resources_ca.pak" type="data_package" lang="ca" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_ca@valencia.pak" type="data_package" lang="ca@valencia" />
+ </if>
+ <output filename="generated_resources_cs.pak" type="data_package" lang="cs" />
+ <output filename="generated_resources_da.pak" type="data_package" lang="da" />
+ <output filename="generated_resources_de.pak" type="data_package" lang="de" />
+ <output filename="generated_resources_el.pak" type="data_package" lang="el" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_en-AU.pak" type="data_package" lang="en-AU" />
+ </if>
+ <output filename="generated_resources_en-GB.pak" type="data_package" lang="en-GB" />
+ <output filename="generated_resources_en-US.pak" type="data_package" lang="en" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_eo.pak" type="data_package" lang="eo" />
+ </if>
+ <output filename="generated_resources_es.pak" type="data_package" lang="es" />
+ <output filename="generated_resources_es-419.pak" type="data_package" lang="es-419" />
+ <output filename="generated_resources_et.pak" type="data_package" lang="et" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_eu.pak" type="data_package" lang="eu" />
+ </if>
+ <output filename="generated_resources_fa.pak" type="data_package" lang="fa" />
+ <output filename="generated_resources_fake-bidi.pak" type="data_package" lang="fake-bidi" />
+ <output filename="generated_resources_fi.pak" type="data_package" lang="fi" />
+ <output filename="generated_resources_fil.pak" type="data_package" lang="fil" />
+ <output filename="generated_resources_fr.pak" type="data_package" lang="fr" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_gl.pak" type="data_package" lang="gl" />
+ </if>
+ <output filename="generated_resources_gu.pak" type="data_package" lang="gu" />
+ <output filename="generated_resources_he.pak" type="data_package" lang="he" />
+ <output filename="generated_resources_hi.pak" type="data_package" lang="hi" />
+ <output filename="generated_resources_hr.pak" type="data_package" lang="hr" />
+ <output filename="generated_resources_hu.pak" type="data_package" lang="hu" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_hy.pak" type="data_package" lang="hy" />
+ <output filename="generated_resources_ia.pak" type="data_package" lang="ia" />
+ </if>
+ <output filename="generated_resources_id.pak" type="data_package" lang="id" />
+ <output filename="generated_resources_it.pak" type="data_package" lang="it" />
+ <output filename="generated_resources_ja.pak" type="data_package" lang="ja" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_ka.pak" type="data_package" lang="ka" />
+ </if>
+ <output filename="generated_resources_kn.pak" type="data_package" lang="kn" />
+ <output filename="generated_resources_ko.pak" type="data_package" lang="ko" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_ku.pak" type="data_package" lang="ku" />
+ <output filename="generated_resources_kw.pak" type="data_package" lang="kw" />
+ </if>
+ <output filename="generated_resources_lt.pak" type="data_package" lang="lt" />
+ <output filename="generated_resources_lv.pak" type="data_package" lang="lv" />
+ <output filename="generated_resources_ml.pak" type="data_package" lang="ml" />
+ <output filename="generated_resources_mr.pak" type="data_package" lang="mr" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_ms.pak" type="data_package" lang="ms" />
+ </if>
+ <output filename="generated_resources_nl.pak" type="data_package" lang="nl" />
+ <!-- The translation console uses 'no' for Norwegian Bokmål. It should
+ be 'nb'. -->
+ <output filename="generated_resources_nb.pak" type="data_package" lang="no" />
+ <output filename="generated_resources_pl.pak" type="data_package" lang="pl" />
+ <output filename="generated_resources_pt-BR.pak" type="data_package" lang="pt-BR" />
+ <output filename="generated_resources_pt-PT.pak" type="data_package" lang="pt-PT" />
+ <output filename="generated_resources_ro.pak" type="data_package" lang="ro" />
+ <output filename="generated_resources_ru.pak" type="data_package" lang="ru" />
+ <output filename="generated_resources_sk.pak" type="data_package" lang="sk" />
+ <output filename="generated_resources_sl.pak" type="data_package" lang="sl" />
+ <output filename="generated_resources_sr.pak" type="data_package" lang="sr" />
+ <output filename="generated_resources_sv.pak" type="data_package" lang="sv" />
+ <output filename="generated_resources_sw.pak" type="data_package" lang="sw" />
+ <output filename="generated_resources_ta.pak" type="data_package" lang="ta" />
+ <output filename="generated_resources_te.pak" type="data_package" lang="te" />
+ <output filename="generated_resources_th.pak" type="data_package" lang="th" />
+ <output filename="generated_resources_tr.pak" type="data_package" lang="tr" />
+ <if expr="pp_ifdef('use_third_party_translations')">
+ <output filename="generated_resources_ug.pak" type="data_package" lang="ug" />
+ </if>
+ <output filename="generated_resources_uk.pak" type="data_package" lang="uk" />
+ <output filename="generated_resources_vi.pak" type="data_package" lang="vi" />
+ <output filename="generated_resources_zh-CN.pak" type="data_package" lang="zh-CN" />
+ <output filename="generated_resources_zh-TW.pak" type="data_package" lang="zh-TW" />
+ </outputs>
+ <translations>
+ <file path="resources/generated_resources_am.xtb" lang="am" />
+ <file path="resources/generated_resources_ar.xtb" lang="ar" />
+ <file path="../../third_party/launchpad_translations/generated_resources_ast.xtb" lang="ast" />
+ <file path="resources/generated_resources_bg.xtb" lang="bg" />
+ <file path="resources/generated_resources_bn.xtb" lang="bn" />
+ <file path="../../third_party/launchpad_translations/generated_resources_bs.xtb" lang="bs" />
+ <file path="resources/generated_resources_ca.xtb" lang="ca" />
+ <file path="../../third_party/launchpad_translations/generated_resources_ca-valencia.xtb" lang="ca@valencia" />
+ <file path="resources/generated_resources_cs.xtb" lang="cs" />
+ <file path="resources/generated_resources_da.xtb" lang="da" />
+ <file path="resources/generated_resources_de.xtb" lang="de" />
+ <file path="resources/generated_resources_el.xtb" lang="el" />
+ <file path="../../third_party/launchpad_translations/generated_resources_en-AU.xtb" lang="en-AU" />
+ <file path="resources/generated_resources_en-GB.xtb" lang="en-GB" />
+ <file path="../../third_party/launchpad_translations/generated_resources_eo.xtb" lang="eo" />
+ <file path="resources/generated_resources_es.xtb" lang="es" />
+ <file path="resources/generated_resources_es-419.xtb" lang="es-419" />
+ <file path="resources/generated_resources_et.xtb" lang="et" />
+ <file path="../../third_party/launchpad_translations/generated_resources_eu.xtb" lang="eu" />
+ <file path="resources/generated_resources_fa.xtb" lang="fa" />
+ <file path="resources/generated_resources_fi.xtb" lang="fi" />
+ <file path="resources/generated_resources_fil.xtb" lang="fil" />
+ <file path="resources/generated_resources_fr.xtb" lang="fr" />
+ <file path="../../third_party/launchpad_translations/generated_resources_gl.xtb" lang="gl" />
+ <file path="resources/generated_resources_gu.xtb" lang="gu" />
+ <file path="resources/generated_resources_hi.xtb" lang="hi" />
+ <file path="resources/generated_resources_hr.xtb" lang="hr" />
+ <file path="resources/generated_resources_hu.xtb" lang="hu" />
+ <file path="../../third_party/launchpad_translations/generated_resources_hy.xtb" lang="hy" />
+ <file path="../../third_party/launchpad_translations/generated_resources_ia.xtb" lang="ia" />
+ <file path="resources/generated_resources_id.xtb" lang="id" />
+ <file path="resources/generated_resources_it.xtb" lang="it" />
+ <!-- The translation console uses 'iw' for Hebrew, but we use 'he'. -->
+ <file path="resources/generated_resources_iw.xtb" lang="he" />
+ <file path="resources/generated_resources_ja.xtb" lang="ja" />
+ <file path="../../third_party/launchpad_translations/generated_resources_ka.xtb" lang="ka" />
+ <file path="resources/generated_resources_kn.xtb" lang="kn" />
+ <file path="resources/generated_resources_ko.xtb" lang="ko" />
+ <file path="../../third_party/launchpad_translations/generated_resources_ku.xtb" lang="ku" />
+ <file path="../../third_party/launchpad_translations/generated_resources_kw.xtb" lang="kw" />
+ <file path="resources/generated_resources_lt.xtb" lang="lt" />
+ <file path="resources/generated_resources_lv.xtb" lang="lv" />
+ <file path="resources/generated_resources_ml.xtb" lang="ml" />
+ <file path="resources/generated_resources_mr.xtb" lang="mr" />
+ <file path="../../third_party/launchpad_translations/generated_resources_ms.xtb" lang="ms" />
+ <file path="resources/generated_resources_nl.xtb" lang="nl" />
+ <file path="resources/generated_resources_no.xtb" lang="no" />
+ <file path="resources/generated_resources_pl.xtb" lang="pl" />
+ <file path="resources/generated_resources_pt-BR.xtb" lang="pt-BR" />
+ <file path="resources/generated_resources_pt-PT.xtb" lang="pt-PT" />
+ <file path="resources/generated_resources_ro.xtb" lang="ro" />
+ <file path="resources/generated_resources_ru.xtb" lang="ru" />
+ <file path="resources/generated_resources_sk.xtb" lang="sk" />
+ <file path="resources/generated_resources_sl.xtb" lang="sl" />
+ <file path="resources/generated_resources_sr.xtb" lang="sr" />
+ <file path="resources/generated_resources_sv.xtb" lang="sv" />
+ <file path="resources/generated_resources_sw.xtb" lang="sw" />
+ <file path="resources/generated_resources_ta.xtb" lang="ta" />
+ <file path="resources/generated_resources_te.xtb" lang="te" />
+ <file path="resources/generated_resources_th.xtb" lang="th" />
+ <file path="resources/generated_resources_tr.xtb" lang="tr" />
+ <file path="../../third_party/launchpad_translations/generated_resources_ug.xtb" lang="ug" />
+ <file path="resources/generated_resources_uk.xtb" lang="uk" />
+ <file path="resources/generated_resources_vi.xtb" lang="vi" />
+ <file path="resources/generated_resources_zh-CN.xtb" lang="zh-CN" />
+ <file path="resources/generated_resources_zh-TW.xtb" lang="zh-TW" />
+ </translations>
+ <release seq="1" allow_pseudo="false">
+ <messages fallback_to_english="true">
+ <!-- TODO add all of your "string table" messages here. Remember to
+ change nontranslateable parts of the messages into placeholders (using the
+ <ph> element). You can also use the 'grit add' tool to help you identify
+ nontranslateable parts and create placeholders for them. -->
+ <message name="IDS_BACKGROUND_APP_INSTALLED_BALLOON_TITLE" desc="The title of the balloon that is displayed when a background app is installed">
+ New background app installed
+ </message>
+ <message name="IDS_BACKGROUND_APP_INSTALLED_BALLOON_BODY" desc="The contents of the balloon that is displayed when a background app is installed">
+ <ph name="APP_NAME">$1<ex>Background App</ex></ph> will launch at system startup and continue to run in the background even once you've closed all other <ph name="PRODUCT_NAME">$2<ex>Google Chrome</ex></ph> windows.
+ </message>
+ </messages>
+ <structures fallback_to_english="true">
+ <!-- Make sure these stay in sync with the structures in generated_resources.grd. -->
+ <structure name="IDD_CHROME_FRAME_FIND_DIALOG" file="cf_resources.rc" type="dialog" >
+ </structure>
+ <structure name="IDD_CHROME_FRAME_READY_PROMPT" file="cf_resources.rc" type="dialog" >
+ </structure>
+ </structures>
+ </release>
+</grit>
diff --git a/tools/grit/grit/testdata/resource_ids b/tools/grit/grit/testdata/resource_ids
index b43d78d..b230695 100644
--- a/tools/grit/grit/testdata/resource_ids
+++ b/tools/grit/grit/testdata/resource_ids
@@ -1,4 +1,5 @@
{
+ "SRCDIR": ".",
"test.grd": {
"messages": [100, 10000],
},
diff --git a/tools/grit/resource_ids b/tools/grit/grit/testdata/tools/grit/resource_ids
index b8d09ec..d8f71ff 100644
--- a/tools/grit/resource_ids
+++ b/tools/grit/grit/testdata/tools/grit/resource_ids
@@ -7,10 +7,15 @@
# across all the grd files. If you are adding a new grd file, please add
# a new entry to this file.
#
+# The first entry in the file, SRCDIR, is special: It is a relative path from
+# this file to the base of your checkout.
+#
# http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx says that the
# range for IDR_ is 1 to 28,671 and the range for IDS_ is 1 to 32,767 and
# common convention starts practical use of IDs at 100 or 101.
{
+ "SRCDIR": "../..",
+
"chrome/browser/browser_resources.grd": {
"includes": [500],
},
diff --git a/tools/grit/grit_info.py b/tools/grit/grit_info.py
index 9723aad..e1e6a66 100755
--- a/tools/grit/grit_info.py
+++ b/tools/grit/grit_info.py
@@ -11,6 +11,7 @@ import os
import posixpath
import types
import sys
+
from grit import grd_reader
from grit import util
@@ -93,7 +94,7 @@ def relpath(path, start=os.path.curdir):
rel_list = [os.path.pardir] * (len(start_list)-i) + path_list[i:]
if not rel_list:
- return curdir
+ return os.path.curdir
return os.path.join(*rel_list)
##############################################################################
@@ -139,8 +140,16 @@ def GritSourceFiles():
grit_root_dir = relpath(os.path.dirname(__file__), os.getcwd())
for root, dirs, filenames in os.walk(grit_root_dir):
grit_src = [os.path.join(root, f) for f in filenames
- if f.endswith('.py') or f == 'resource_ids']
+ if f.endswith('.py')]
files.extend(grit_src)
+ # TODO(joi@chromium.org): Once we switch to specifying the
+ # resource_ids file via a .grd attribute, it should be considered an
+ # input of grit and this bit should no longer be necessary.
+ default_resource_ids = relpath(
+ os.path.join(grit_root_dir, '..', 'gritsettings', 'resource_ids'),
+ os.getcwd())
+ if os.path.exists(default_resource_ids):
+ files.append(default_resource_ids)
return files
diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids
new file mode 100644
index 0000000..d8f71ff
--- /dev/null
+++ b/tools/gritsettings/resource_ids
@@ -0,0 +1,175 @@
+# 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.
+#
+# This file is used to assign starting resource ids for resources and strings
+# used by Chromium. This is done to ensure that resource ids are unique
+# across all the grd files. If you are adding a new grd file, please add
+# a new entry to this file.
+#
+# The first entry in the file, SRCDIR, is special: It is a relative path from
+# this file to the base of your checkout.
+#
+# http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx says that the
+# range for IDR_ is 1 to 28,671 and the range for IDS_ is 1 to 32,767 and
+# common convention starts practical use of IDs at 100 or 101.
+{
+ "SRCDIR": "../..",
+
+ "chrome/browser/browser_resources.grd": {
+ "includes": [500],
+ },
+ "chrome/browser/resources/component_extension_resources.grd": {
+ "includes": [1000],
+ },
+ "chrome/browser/resources/net_internals_resources.grd": {
+ "includes": [1500],
+ },
+ "chrome/browser/resources/shared_resources.grd": {
+ "includes": [2000],
+ },
+ "chrome/common/common_resources.grd": {
+ "includes": [2500],
+ },
+ "chrome/default_plugin/default_plugin_resources.grd": {
+ "includes": [3000],
+ },
+ "chrome/renderer/renderer_resources.grd": {
+ "includes": [3500],
+ },
+ "net/base/net_resources.grd": {
+ "includes": [4000],
+ },
+ "webkit/glue/webkit_resources.grd": {
+ "includes": [4500],
+ },
+ "webkit/tools/test_shell/test_shell_resources.grd": {
+ "includes": [5000],
+ },
+ "ui/resources/ui_resources.grd": {
+ "includes": [5500],
+ },
+ "chrome/app/theme/theme_resources.grd": {
+ "includes": [6000],
+ },
+ "chrome_frame/resources/chrome_frame_resources.grd": {
+ "includes": [6500],
+ },
+ # WebKit.grd can be in two different places depending on whether we are
+ # in a chromium checkout or a webkit-only checkout.
+ "third_party/WebKit/Source/WebKit/chromium/WebKit.grd": {
+ "includes": [7000],
+ },
+ "WebKit.grd": {
+ "includes": [7000],
+ },
+
+ "ui/base/strings/app_locale_settings.grd": {
+ "messages": [7500],
+ },
+ "chrome/app/resources/locale_settings.grd": {
+ "includes": [8000],
+ "messages": [8500],
+ },
+ # These each start with the same resource id because we only use one
+ # file for each build (cros, linux, mac, or win).
+ "chrome/app/resources/locale_settings_cros.grd": {
+ "messages": [9000],
+ },
+ "chrome/app/resources/locale_settings_linux.grd": {
+ "messages": [9000],
+ },
+ "chrome/app/resources/locale_settings_mac.grd": {
+ "messages": [9000],
+ },
+ "chrome/app/resources/locale_settings_win.grd": {
+ "messages": [9000],
+ },
+
+ "ui/base/strings/ui_strings.grd": {
+ "messages": [9500],
+ },
+ # Chromium strings and Google Chrome strings must start at the same id.
+ # We only use one file depending on whether we're building Chromium or
+ # Google Chrome.
+ "chrome/app/chromium_strings.grd": {
+ "messages": [10000],
+ },
+ "chrome/app/google_chrome_strings.grd": {
+ "messages": [10000],
+ },
+ # Leave lots of space for generated_resources since it has most of our
+ # strings.
+ "chrome/app/generated_resources.grd": {
+ "structures": [10500],
+ "messages": [11000],
+ },
+ # The chrome frame dialogs are also in generated_resources.grd so they
+ # get included by the translation console. We make sure that the ids
+ # for structures here are the same as for generated_resources.grd.
+ "chrome_frame/resources/chrome_frame_dialogs.grd": {
+ "structures": [10500],
+ "includes": [10750],
+ },
+ "webkit/glue/inspector_strings.grd": {
+ "messages": [16000],
+ },
+ "webkit/glue/webkit_strings.grd": {
+ "messages": [16500],
+ },
+
+ "chrome_frame/resources/chrome_frame_resources.grd": {
+ "includes": [17500],
+ "structures": [18000],
+ },
+
+ "ui/gfx/gfx_resources.grd": {
+ "includes": [18500],
+ },
+
+ "chrome/app/policy/policy_templates.grd": {
+ "structures": [19000],
+ "messages": [19010],
+ },
+
+ "chrome/browser/autofill/autofill_resources.grd": {
+ "messages": [19500],
+ },
+ "chrome/browser/resources/sync_internals_resources.grd": {
+ "includes": [20000],
+ },
+ # This file is generated during the build.
+ "<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd": {
+ "includes": [20500],
+ },
+ # All standard and large theme resources should have the same IDs.
+ "chrome/app/theme/theme_resources_standard.grd": {
+ "includes": [21000],
+ },
+ "chrome/app/theme/theme_resources_large.grd": {
+ "includes": [21000],
+ },
+ # This file is generated during the build.
+ "chrome/browser/debugger/frontend/devtools_frontend_resources.grd": {
+ "includes": [21500],
+ },
+ "chrome/browser/resources/options_resources.grd": {
+ "includes": [22000],
+ },
+ "cloud_print/virtual_driver/win/install/virtual_driver_setup_resources.grd": {
+ "messages": [22500],
+ },
+ "chrome/browser/resources/quota_internals_resources.grd": {
+ "includes": [23000],
+ },
+ "chrome/browser/resources/workers_resources.grd": {
+ "includes": [23500],
+ },
+ # All standard and large theme resources should have the same IDs.
+ "ui/resources/ui_resources_standard.grd": {
+ "includes": [24000],
+ },
+ "ui/resources/ui_resources_large.grd": {
+ "includes": [24000],
+ },
+}