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

Issue 1263053003: Add forward_variables_from() and target() to GN (Closed)

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

Description

Add forward_variables_from() and target() to GN forward_variables_from is syntactic sugar for: if (defined(invoker.foo)) { foo = invoker.foo } For a list of variables or for all variables in a scope. I was originally resisting adding new primitives for this kind of thing, but in some places (especially the Android build) this is so common that forcing the more verbose expression seems to be hurting readability. It will also allow us to make the component and test templates trivial and more easily up-to-date with new variables. The target() function allows a target to be defined with a user-defined type: target("source_set", "foo") is equivalent to: source_set("foo") This makes certain constructs easier to express where previously people were forced to do excessive code duplication. Renames mark_used to mark_dest_used in the scope options because I found the old name confusing when writing this patch. Committed: https://crrev.com/dc957e1a0229bd9b4764f74707b28672ae7f50bb Cr-Commit-Position: refs/heads/master@{#341626}

Patch Set 1 #

Patch Set 2 : #

Total comments: 7

Patch Set 3 : review comments #

Total comments: 2

Patch Set 4 : More spelling fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+436 lines, -16 lines) Patch
M tools/gn/BUILD.gn View 2 chunks +2 lines, -0 lines 0 comments Download
A tools/gn/function_forward_variables_from.cc View 1 2 3 1 chunk +182 lines, -0 lines 0 comments Download
A tools/gn/function_forward_variables_from_unittest.cc View 1 2 1 chunk +108 lines, -0 lines 0 comments Download
M tools/gn/function_template.cc View 1 2 chunks +14 lines, -1 line 0 comments Download
M tools/gn/functions.h View 2 chunks +17 lines, -0 lines 0 comments Download
M tools/gn/functions.cc View 3 chunks +5 lines, -4 lines 0 comments Download
M tools/gn/functions_target.cc View 1 2 3 2 chunks +65 lines, -0 lines 0 comments Download
M tools/gn/gn.gyp View 2 chunks +2 lines, -0 lines 0 comments Download
M tools/gn/import_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M tools/gn/scope.h View 1 2 3 4 chunks +11 lines, -2 lines 0 comments Download
M tools/gn/scope.cc View 1 2 3 5 chunks +19 lines, -3 lines 0 comments Download
M tools/gn/scope_unittest.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M tools/gn/target_generator.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M tools/gn/test_with_scope.h View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M tools/gn/test_with_scope.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 22 (8 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1263053003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1263053003/1
5 years, 4 months ago (2015-08-03 00:34:34 UTC) #2
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-03 01:02:12 UTC) #4
brettw
5 years, 4 months ago (2015-08-03 04:50:13 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1263053003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1263053003/20001
5 years, 4 months ago (2015-08-03 04:50:22 UTC) #8
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-03 07:00:40 UTC) #10
Dirk Pranke
initial comments, just on the features themselves ... is it possible to refer to any ...
5 years, 4 months ago (2015-08-03 15:11:42 UTC) #12
brettw
On 2015/08/03 15:11:42, Dirk Pranke wrote: > initial comments, just on the features themselves ...
5 years, 4 months ago (2015-08-03 16:22:23 UTC) #13
Dirk Pranke
mostly lgtm with a few comments ... https://codereview.chromium.org/1263053003/diff/20001/tools/gn/function_forward_variables_from.cc File tools/gn/function_forward_variables_from.cc (right): https://codereview.chromium.org/1263053003/diff/20001/tools/gn/function_forward_variables_from.cc#newcode43 tools/gn/function_forward_variables_from.cc:43: base::StringPiece storage_key ...
5 years, 4 months ago (2015-08-03 19:07:20 UTC) #14
Dirk Pranke
https://codereview.chromium.org/1263053003/diff/20001/tools/gn/function_forward_variables_from.cc File tools/gn/function_forward_variables_from.cc (right): https://codereview.chromium.org/1263053003/diff/20001/tools/gn/function_forward_variables_from.cc#newcode45 tools/gn/function_forward_variables_from.cc:45: continue; // Programatic value, don't copy. This should probably ...
5 years, 4 months ago (2015-08-03 19:50:29 UTC) #15
brettw
The new patch throws an error on programmatic values and adds tests for the error ...
5 years, 4 months ago (2015-08-03 21:09:07 UTC) #16
Dirk Pranke
lgtm w/ typos fixed. https://codereview.chromium.org/1263053003/diff/40001/tools/gn/scope.h File tools/gn/scope.h (right): https://codereview.chromium.org/1263053003/diff/40001/tools/gn/scope.h#newcode163 tools/gn/scope.h:163: // string for programatic and ...
5 years, 4 months ago (2015-08-03 21:12:24 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1263053003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1263053003/60001
5 years, 4 months ago (2015-08-03 21:15:38 UTC) #20
commit-bot: I haz the power
Committed patchset #4 (id:60001)
5 years, 4 months ago (2015-08-03 21:54:51 UTC) #21
commit-bot: I haz the power
5 years, 4 months ago (2015-08-03 21:55:11 UTC) #22
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/dc957e1a0229bd9b4764f74707b28672ae7f50bb
Cr-Commit-Position: refs/heads/master@{#341626}

Powered by Google App Engine
This is Rietveld 408576698