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

Issue 429423002: Refactor GN source expansions. (Closed)

Created:
6 years, 4 months ago by brettw
Modified:
6 years, 4 months ago
Reviewers:
scottmg
CC:
chromium-reviews, tfarina
Project:
chromium
Visibility:
Public.

Description

Refactor GN source expansions. This is in preparation for using {{patterns}} in toolchain definitions. It makes them more generic and usable for this, without actually implementing any new features or changing behavior. The only external change should be that the $in variable is used for actions instead of making a redundant new variable (used to be called $source). It removes the FileTemplate class and explodes it into several files: the type list and helpers (substitution_type), a single pattern (substitution_pattern), a list of patterns (substitution_list), and a class of helper functions for processing templates in various ways (substitution_writer). Previously, the things needing substitutions (args, outputs, depfile) were stored as strings and parsed in to FileTemplates as needed. This new method stores the SubstitutionList/Pattern directly on the target. This allows it to issue parse errors (previously such errors were ignored since errors weren't reportable when writing Ninja files) and cleans up a lot of the code that uses it. R=scottmg@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=287847

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : Clang warning #

Total comments: 14

Patch Set 6 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1484 lines, -1117 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M tools/gn/BUILD.gn View 1 2 3 4 5 4 chunks +11 lines, -3 lines 0 comments Download
M tools/gn/action_target_generator.cc View 1 2 3 4 5 6 chunks +14 lines, -26 lines 0 comments Download
A tools/gn/action_target_generator_unittest.cc View 1 2 3 4 5 1 chunk +42 lines, -0 lines 0 comments Download
M tools/gn/action_values.h View 1 2 chunks +11 lines, -10 lines 0 comments Download
M tools/gn/command_desc.cc View 1 2 3 4 5 4 chunks +34 lines, -44 lines 0 comments Download
M tools/gn/command_help.cc View 1 chunk +1 line, -1 line 0 comments Download
M tools/gn/copy_target_generator.cc View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M tools/gn/escape.cc View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
D tools/gn/file_template.h View 1 chunk +0 lines, -177 lines 0 comments Download
D tools/gn/file_template.cc View 1 chunk +0 lines, -419 lines 0 comments Download
D tools/gn/file_template_unittest.cc View 1 chunk +0 lines, -183 lines 0 comments Download
M tools/gn/filesystem_utils.h View 1 chunk +0 lines, -5 lines 0 comments Download
M tools/gn/filesystem_utils.cc View 3 chunks +0 lines, -10 lines 0 comments Download
M tools/gn/filesystem_utils_unittest.cc View 1 2 1 chunk +5 lines, -22 lines 0 comments Download
M tools/gn/function_get_target_outputs.cc View 1 2 4 chunks +17 lines, -22 lines 0 comments Download
M tools/gn/function_get_target_outputs_unittest.cc View 1 2 3 chunks +7 lines, -7 lines 0 comments Download
M tools/gn/function_process_file_template.cc View 2 chunks +15 lines, -15 lines 0 comments Download
M tools/gn/function_write_file.cc View 1 chunk +1 line, -1 line 0 comments Download
M tools/gn/gn.gyp View 1 2 3 4 5 4 chunks +11 lines, -3 lines 0 comments Download
M tools/gn/ninja_action_target_writer.h View 1 2 4 chunks +2 lines, -13 lines 0 comments Download
M tools/gn/ninja_action_target_writer.cc View 1 2 10 chunks +45 lines, -60 lines 0 comments Download
M tools/gn/ninja_action_target_writer_unittest.cc View 1 2 12 chunks +26 lines, -63 lines 0 comments Download
M tools/gn/ninja_copy_target_writer.cc View 1 2 3 chunks +11 lines, -13 lines 0 comments Download
M tools/gn/ninja_copy_target_writer_unittest.cc View 1 2 3 chunks +4 lines, -4 lines 0 comments Download
M tools/gn/ninja_target_writer.cc View 1 chunk +0 lines, -1 line 0 comments Download
M tools/gn/source_file.h View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download
M tools/gn/source_file.cc View 1 chunk +7 lines, -0 lines 0 comments Download
A tools/gn/substitution_list.h View 1 2 1 chunk +46 lines, -0 lines 0 comments Download
A tools/gn/substitution_list.cc View 1 2 1 chunk +72 lines, -0 lines 0 comments Download
A tools/gn/substitution_pattern.h View 1 2 1 chunk +61 lines, -0 lines 0 comments Download
A tools/gn/substitution_pattern.cc View 1 2 3 4 5 1 chunk +111 lines, -0 lines 0 comments Download
A tools/gn/substitution_pattern_unittest.cc View 1 2 3 4 5 1 chunk +49 lines, -0 lines 0 comments Download
A tools/gn/substitution_type.h View 1 1 chunk +87 lines, -0 lines 0 comments Download
A tools/gn/substitution_type.cc View 1 2 1 chunk +149 lines, -0 lines 0 comments Download
A tools/gn/substitution_writer.h View 1 chunk +107 lines, -0 lines 0 comments Download
A tools/gn/substitution_writer.cc View 1 2 3 4 5 1 chunk +317 lines, -0 lines 0 comments Download
A tools/gn/substitution_writer_unittest.cc View 1 chunk +152 lines, -0 lines 0 comments Download
M tools/gn/target_generator.h View 1 2 3 4 5 1 chunk +8 lines, -1 line 0 comments Download
M tools/gn/target_generator.cc View 1 2 3 4 5 1 chunk +53 lines, -9 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
brettw
6 years, 4 months ago (2014-08-02 05:52:22 UTC) #1
scottmg
Sorry for the delay. Holiday yesterday, moving this morning. I'll look at it today.
6 years, 4 months ago (2014-08-05 17:13:29 UTC) #2
scottmg
lgtm https://codereview.chromium.org/429423002/diff/80001/tools/gn/command_help.cc File tools/gn/command_help.cc (right): https://codereview.chromium.org/429423002/diff/80001/tools/gn/command_help.cc#newcode16 tools/gn/command_help.cc:16: #include "tools/gn/substitution_writer.h" necessary? https://codereview.chromium.org/429423002/diff/80001/tools/gn/function_get_target_outputs.cc File tools/gn/function_get_target_outputs.cc (right): https://codereview.chromium.org/429423002/diff/80001/tools/gn/function_get_target_outputs.cc#newcode29 ...
6 years, 4 months ago (2014-08-05 22:30:33 UTC) #3
brettw
https://codereview.chromium.org/429423002/diff/80001/tools/gn/command_help.cc File tools/gn/command_help.cc (right): https://codereview.chromium.org/429423002/diff/80001/tools/gn/command_help.cc#newcode16 tools/gn/command_help.cc:16: #include "tools/gn/substitution_writer.h" On 2014/08/05 22:30:32, scottmg wrote: > necessary? ...
6 years, 4 months ago (2014-08-06 18:25:01 UTC) #4
brettw
6 years, 4 months ago (2014-08-06 20:38:51 UTC) #5
Message was sent while issue was closed.
Committed patchset #6 manually as 287847 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698