Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: Source/bindings/scripts/blink_idl_parser.py

Issue 429523002: IDL: Make caching lex table robust (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/blink_idl_parser.py
diff --git a/Source/bindings/scripts/blink_idl_parser.py b/Source/bindings/scripts/blink_idl_parser.py
index 0120654a5f44083573025fb02f43aaec2876e8aa..37c62c5669b952fb11c730fee264a5f8cefc4418 100644
--- a/Source/bindings/scripts/blink_idl_parser.py
+++ b/Source/bindings/scripts/blink_idl_parser.py
@@ -95,6 +95,19 @@ for rule in REMOVED_RULES:
production_name = 'p_' + rule
delattr(IDLParser, production_name)
+# The base name of cached lexer table generated by BlinkIDLLexer
+LEX_TABLE_BASENAME = 'lextab'
+
+
+def remove_cached_lex_table(outputdir):
+ table_files = [
+ os.path.join(outputdir, '%s.py' % LEX_TABLE_BASENAME),
+ os.path.join(outputdir, '%s.pyc' % LEX_TABLE_BASENAME),
+ ]
+ for table_file in table_files:
+ if os.path.exists(table_file):
+ os.unlink(table_file)
+
class BlinkIDLParser(IDLParser):
# [1]
@@ -440,12 +453,16 @@ class BlinkIDLParser(IDLParser):
################################################################################
def main(argv):
- # If file itself executed, cache parse table
+ # If file itself executed, cache parse table. Caching the parse table
+ # also caches lex table. Before caching these tables, we remove the
+ # previous cached lex table if exists so that the build system can keep
+ # track of dependencies. See http://crbug.com/397909
try:
outputdir = argv[1]
except IndexError as err:
print 'Usage: %s OUTPUT_DIR' % argv[0]
return 1
+ remove_cached_lex_table(outputdir)
# Important: rewrite_tables=True causes the cache file to be deleted if it
# exists, thus making sure that PLY doesn't load it instead of regenerating
# the parse table.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698