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

Issue 591373002: gn: start of format command (Closed)

Created:
6 years, 3 months ago by scottmg
Modified:
6 years, 2 months ago
Reviewers:
brettw
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@gn-more-comment-stuff
Project:
chromium
Visibility:
Public.

Description

gn: start of format command Adds `gn format` command. Currently accepts one //path/to/BUILD.gn and attempts to reformat it (to stdout). Handles the basics, but does not handle all constructs yet, and doesn't attempt any rewrites. R=brettw@chromium.org BUG=348474 Committed: https://crrev.com/2dd93e8b9b97ad141b0a9ac6bef703926ec3b306 Cr-Commit-Position: refs/heads/master@{#296876}

Patch Set 1 #

Patch Set 2 : delete old code #

Patch Set 3 : print expr before comment, fix suffix comment printing, make test running better for gtest_filter #

Patch Set 4 : allow local files as inputname, add some broken comments w/ spaced lines #

Patch Set 5 : wip, not correct fix for standalone comments #

Patch Set 6 : block comments are real parser nodes #

Patch Set 7 : conditions #

Patch Set 8 : conditions test with comments #

Patch Set 9 : update comment #

Patch Set 10 : add some broken tests #

Patch Set 11 : add more not-working tests #

Patch Set 12 : rebase #

Patch Set 13 : . #

Patch Set 14 : Add --dump-tree, fix start token of ListNode #

Patch Set 15 : goldens for comments in in lists #

Patch Set 16 : ignore blockcomment in list eval #

Total comments: 19

Patch Set 17 : review #

Patch Set 18 : add comment #

Patch Set 19 : tests #

Patch Set 20 : warnings on clang #

Patch Set 21 : not sure what android check_licenses is complaining about #

Patch Set 22 : change 'copyright header block' to 'standard header block' for android_webview/tools/check_licenses… #

Unified diffs Side-by-side diffs Delta from patch set Stats (+769 lines, -15 lines) Patch
M tools/gn/BUILD.gn View 2 chunks +2 lines, -0 lines 0 comments Download
A tools/gn/command_format.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +391 lines, -0 lines 0 comments Download
A tools/gn/command_format_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +45 lines, -0 lines 0 comments Download
M tools/gn/commands.h View 1 chunk +5 lines, -0 lines 0 comments Download
M tools/gn/commands.cc View 1 chunk +1 line, -0 lines 0 comments Download
A tools/gn/format_test_data/001.gn View 1 chunk +2 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/001.golden View 1 chunk +3 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/002.gn View 1 chunk +6 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/002.golden View 1 chunk +6 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/003.gn View 1 chunk +10 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/003.golden View 1 chunk +8 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/004.gn View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/004.golden View 1 2 1 chunk +11 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/005.gn View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/005.golden View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/006.gn View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/006.golden View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/007.gn View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/007.golden View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/008.gn View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A tools/gn/format_test_data/008.golden View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/009.gn View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/009.golden View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/010.gn View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/010.golden View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/011.gn View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/011.golden View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/012.gn View 1 2 3 4 5 6 7 1 chunk +16 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/012.golden View 1 2 3 4 5 6 7 1 chunk +16 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/013.gn View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/013.golden View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/014.gn View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/014.golden View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +5 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/015.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download
A tools/gn/format_test_data/016.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M tools/gn/gn.gyp View 2 chunks +2 lines, -0 lines 0 comments Download
M tools/gn/parse_tree.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 4 chunks +32 lines, -1 line 0 comments Download
M tools/gn/parse_tree.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +36 lines, -3 lines 0 comments Download
M tools/gn/parser.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +3 lines, -1 line 0 comments Download
M tools/gn/parser.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 9 chunks +30 lines, -9 lines 0 comments Download
M tools/gn/parser_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +20 lines, -1 line 0 comments Download
M tools/gn/token.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M tools/gn/tokenizer.cc View 1 2 3 4 5 6 1 chunk +12 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (10 generated)
scottmg
As discussed, now with some additions to the main parse tree now for standalone comments. ...
6 years, 2 months ago (2014-09-25 20:17:44 UTC) #2
brettw
lgtm https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc File tools/gn/command_format.cc (right): https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc#newcode24 tools/gn/command_format.cc:24: "gn format: Format .gn file.\n" Can you append ...
6 years, 2 months ago (2014-09-25 22:11:32 UTC) #3
scottmg
Thanks https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc File tools/gn/command_format.cc (right): https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc#newcode24 tools/gn/command_format.cc:24: "gn format: Format .gn file.\n" On 2014/09/25 22:11:32, ...
6 years, 2 months ago (2014-09-25 23:03:12 UTC) #4
scottmg
(check out those const auto&'s btw!, woohoo)
6 years, 2 months ago (2014-09-25 23:04:38 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/591373002/340001
6 years, 2 months ago (2014-09-25 23:06:47 UTC) #7
brettw
On 2014/09/25 23:04:38, scottmg wrote: > (check out those const auto&'s btw!, woohoo) I know! ...
6 years, 2 months ago (2014-09-25 23:06:51 UTC) #8
brettw
https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc File tools/gn/command_format.cc (right): https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc#newcode163 tools/gn/command_format.cc:163: if (stmt->comments()) { Can you explain this in a ...
6 years, 2 months ago (2014-09-25 23:06:58 UTC) #9
scottmg
https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc File tools/gn/command_format.cc (right): https://codereview.chromium.org/591373002/diff/320001/tools/gn/command_format.cc#newcode163 tools/gn/command_format.cc:163: if (stmt->comments()) { On 2014/09/25 23:06:58, brettw wrote: > ...
6 years, 2 months ago (2014-09-25 23:13:12 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/591373002/380001
6 years, 2 months ago (2014-09-25 23:17:18 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_compile_dbg on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg/builds/19198) mac_chromium_rel_swarming on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_swarming/builds/17661)
6 years, 2 months ago (2014-09-25 23:33:09 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/591373002/400001
6 years, 2 months ago (2014-09-25 23:38:20 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/7413)
6 years, 2 months ago (2014-09-26 00:30:33 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/591373002/420001
6 years, 2 months ago (2014-09-26 00:38:55 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/7430)
6 years, 2 months ago (2014-09-26 01:18:00 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/591373002/420002
6 years, 2 months ago (2014-09-26 03:16:16 UTC) #25
commit-bot: I haz the power
Committed patchset #22 (id:420002) as 2aa2d72aab6956689836abf48bf4743411204e38
6 years, 2 months ago (2014-09-26 04:07:14 UTC) #26
commit-bot: I haz the power
6 years, 2 months ago (2014-09-26 04:07:58 UTC) #27
Message was sent while issue was closed.
Patchset 22 (id:??) landed as
https://crrev.com/2dd93e8b9b97ad141b0a9ac6bef703926ec3b306
Cr-Commit-Position: refs/heads/master@{#296876}

Powered by Google App Engine
This is Rietveld 408576698