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

Issue 1632573002: Support for excluding variable from forwarding via forward_variables_form. (Closed)

Created:
4 years, 11 months ago by sdefresne
Modified:
4 years, 10 months ago
Reviewers:
brettw
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@web_shell
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Support for excluding variable from forwarding via forward_variables_form. Some templates wants to forward all their parameters to the underlying target except a select few they use. Previously they had to list all the variables the underlying target supported which was error prone and brittle if the underlying target is changed. With this change they can just use the following: forward_variables_from(invoker, "*", ["my_extra_variable"]) # my_extra_variable is not forwarded, all other variables are. BUG=580293 Committed: https://crrev.com/bf5ff79020d15e683a12b45be08200ab7d857550 Cr-Commit-Position: refs/heads/master@{#371492}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Fix error message about incorrect argument count #

Total comments: 10

Patch Set 3 : Address comments and expand filter to templates/target_defaults in NonRecursiveMergeTo #

Unified diffs Side-by-side diffs Delta from patch set Stats (+217 lines, -28 lines) Patch
M tools/gn/docs/reference.md View 1 2 3 chunks +19 lines, -2 lines 0 comments Download
M tools/gn/function_forward_variables_from.cc View 1 2 8 chunks +51 lines, -6 lines 0 comments Download
M tools/gn/function_forward_variables_from_unittest.cc View 3 chunks +102 lines, -2 lines 0 comments Download
M tools/gn/scope.h View 2 chunks +5 lines, -6 lines 0 comments Download
M tools/gn/scope.cc View 1 2 7 chunks +40 lines, -12 lines 0 comments Download

Messages

Total messages: 13 (5 generated)
sdefresne
Please take a look.
4 years, 11 months ago (2016-01-25 12:08:20 UTC) #2
tfarina
https://codereview.chromium.org/1632573002/diff/1/tools/gn/function_forward_variables_from.cc File tools/gn/function_forward_variables_from.cc (right): https://codereview.chromium.org/1632573002/diff/1/tools/gn/function_forward_variables_from.cc#newcode158 tools/gn/function_forward_variables_from.cc:158: if (args_vector.size() != 2 && args_vector.size() != 3) { ...
4 years, 11 months ago (2016-01-25 12:15:26 UTC) #3
sdefresne
https://codereview.chromium.org/1632573002/diff/1/tools/gn/function_forward_variables_from.cc File tools/gn/function_forward_variables_from.cc (right): https://codereview.chromium.org/1632573002/diff/1/tools/gn/function_forward_variables_from.cc#newcode158 tools/gn/function_forward_variables_from.cc:158: if (args_vector.size() != 2 && args_vector.size() != 3) { ...
4 years, 11 months ago (2016-01-25 15:28:30 UTC) #4
brettw
lgtm https://codereview.chromium.org/1632573002/diff/20001/tools/gn/function_forward_variables_from.cc File tools/gn/function_forward_variables_from.cc (right): https://codereview.chromium.org/1632573002/diff/20001/tools/gn/function_forward_variables_from.cc#newcode76 tools/gn/function_forward_variables_from.cc:76: " forward_variables_from(from_scope, variable_list_or_star,\n" Check out the help for ...
4 years, 10 months ago (2016-01-25 20:44:42 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1632573002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1632573002/60001
4 years, 10 months ago (2016-01-26 11:16:58 UTC) #9
commit-bot: I haz the power
Committed patchset #3 (id:60001)
4 years, 10 months ago (2016-01-26 11:34:56 UTC) #10
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/bf5ff79020d15e683a12b45be08200ab7d857550 Cr-Commit-Position: refs/heads/master@{#371492}
4 years, 10 months ago (2016-01-26 11:35:44 UTC) #12
sdefresne
4 years, 10 months ago (2016-01-26 11:59:44 UTC) #13
Message was sent while issue was closed.
https://codereview.chromium.org/1632573002/diff/20001/tools/gn/function_forwa...
File tools/gn/function_forward_variables_from.cc (right):

https://codereview.chromium.org/1632573002/diff/20001/tools/gn/function_forwa...
tools/gn/function_forward_variables_from.cc:76: " 
forward_variables_from(from_scope, variable_list_or_star,\n"
On 2016/01/25 at 20:44:41, brettw wrote:
> Check out the help for rebase_path, I used C++-style syntax for documenting
the default variables, and we should probably be consistent.

Done.

https://codereview.chromium.org/1632573002/diff/20001/tools/gn/function_forwa...
tools/gn/function_forward_variables_from.cc:137: "  # This is a template around
another template that uses a variable to\n"
On 2016/01/25 at 20:44:41, brettw wrote:
> How about "A template that wraps another. It adds behavior based on one
variable, and forwards all others to the nested target."

Done.

https://codereview.chromium.org/1632573002/diff/20001/tools/gn/function_forwa...
tools/gn/function_forward_variables_from.cc:201:
exclusion_set.insert(exclusion_set.end(), cur.string_value());
On 2016/01/25 at 20:44:41, brettw wrote:
> I think you can just delete the first parameter.

Done.

https://codereview.chromium.org/1632573002/diff/20001/tools/gn/scope.cc
File tools/gn/scope.cc (right):

https://codereview.chromium.org/1632573002/diff/20001/tools/gn/scope.cc#newco...
tools/gn/scope.cc:32: mark_dest_used(false) {}
On 2016/01/25 at 20:44:41, brettw wrote:
> Can you put the } on the following line like the other functions in here?

Done here an below.

https://codereview.chromium.org/1632573002/diff/20001/tools/gn/scope.cc#newco...
tools/gn/scope.cc:261: if (!options.excluded_values.empty() &&
On 2016/01/25 at 20:44:41, brettw wrote:
> This loop is getting a bit out of control with pair.first. Can you help clean
it up by adding at the top of the loop something like:
>   const StringPiece& current_name(pair.first);
> and use it in all the places in the loop where pair.first appears?

Done.

Powered by Google App Engine
This is Rietveld 408576698