[grit-i18n] r200 committed - Include included files in depfiles....

0 views
Skip to first unread message

grit...@googlecode.com

unread,
Oct 8, 2015, 7:23:10 PM10/8/15
to grit-de...@googlegroups.com
Revision: 200
Author: bre...@chromium.org
Date: Thu Oct 8 23:22:53 2015 UTC
Log: Include included files in depfiles.

Previously, we would record the dependencies on files that were being
pulled in
via <structure> nodes but not <include> nodes.

R=bre...@chromium.org
BUG=http://crbug.com/541158
Review=https://codereview.chromium.org/1396493003/

https://code.google.com/p/grit-i18n/source/detail?r=200

Modified:
/trunk/grit/node/misc.py
/trunk/grit/node/misc_unittest.py

=======================================
--- /trunk/grit/node/misc.py Wed Aug 26 17:46:46 2015 UTC
+++ /trunk/grit/node/misc.py Thu Oct 8 23:22:53 2015 UTC
@@ -336,8 +336,10 @@
input_files.add(self.ToRealPath(input_path))

# If it's a flattened node, grab inlined resources too.
- if node.name == 'structure' and node.attrs['flattenhtml']
== 'true':
- node.RunPreSubstitutionGatherer()
+ if ((node.name == 'structure' or node.name == 'include')
+ and node.attrs['flattenhtml'] == 'true'):
+ if node.name == 'structure':
+ node.RunPreSubstitutionGatherer()
input_files.update(node.GetHtmlResourceFilenames())

self.SetOutputLanguage(old_output_language)
=======================================
--- /trunk/grit/node/misc_unittest.py Wed Aug 26 17:46:46 2015 UTC
+++ /trunk/grit/node/misc_unittest.py Thu Oct 8 23:22:53 2015 UTC
@@ -81,6 +81,31 @@
actual = [path.replace('\\', '/') for path in actual]
self.assertEquals(expected, actual)

+ # Verifies that GetInputFiles() returns the correct list of files
+ # when files include other files.
+ def testGetInputFilesFromIncludes(self):
+ chrome_html_path = util.PathFromRoot('grit/testdata/chrome_html.html')
+ xml = '''<?xml version="1.0" encoding="utf-8"?>
+ <grit latest_public_release="0" current_release="1">
+ <outputs>
+ <output filename="default.pak" type="data_package"
context="default_100_percent" />
+ <output filename="special.pak" type="data_package"
context="special_100_percent" fallback_to_default_layout="false" />
+ </outputs>
+ <release seq="1">
+ <includes>
+ <include name="IDR_TESTDATA_CHROME_HTML" file="%s"
flattenhtml="true"
+ allowexternalscript="true" type="BINDATA" />
+ </includes>
+ </release>
+ </grit>''' % chrome_html_path
+
+ grd = grd_reader.Parse(StringIO.StringIO(xml),
util.PathFromRoot('grit/testdata'))
+ expected = ['chrome_html.html', 'included_sample.html']
+ actual = [os.path.relpath(path, util.PathFromRoot('grit/testdata'))
for path in grd.GetInputFiles()]
+ # Convert path separator for Windows paths.
+ actual = [path.replace('\\', '/') for path in actual]
+ self.assertEquals(expected, actual)
+

class IfNodeUnittest(unittest.TestCase):
def testIffyness(self):
Reply all
Reply to author
Forward
0 new messages