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

Issue 909103003: gn: Add 'clean' command. (Closed)

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

Description

gn: Add 'clean' command. This emulates in C++ and in the GN tool what https://chromium.googlesource.com/chromium/src/+/master/build/landmines.py#82 does. gn-dev mailing list discussion for more background is: https://groups.google.com/a/chromium.org/d/topic/gn-dev/KTyLEh2Um98/discussion The link to the doc proposing this command is: https://docs.google.com/document/d/1DH-t-jYwQxZAXhqoBvnWGHWeF1z4Lltxny9D7lgC4HU/edit?pli=1 Tested with the following command lines: $ gn gen out_gn_testing_clean_command/Debug --args='is_component_build=true' $ out_gn/Debug/gn clean out_gn_testing_clean_command/Debug Then: $ ls out_gn_testing_clean_command/Debug args.gn build.ninja build.ninja.d To verify the files were written to disk correctly. And: $ cat out_gn_testing_clean_command/Debug/args.gn $ cat out_gn_testing_clean_command/Debug/build.ninja $ cat out_gn_testing_clean_command/Debug/build.ninja.d To see if everything was written to the files correctly. BUG=None TEST=see above R=brettw@chromium.org Committed: https://crrev.com/7ad216606be9aa7b6d0da6109fe1ecf5d4968dab Cr-Commit-Position: refs/heads/master@{#316670}

Patch Set 1 #

Patch Set 2 : first logic #

Patch Set 3 : build_dir will be used at other places #

Patch Set 4 : build_commands #

Patch Set 5 : ReadFileToString() but we will need to do by hand with OpenFile() instead #

Patch Set 6 : Read args.gn file #

Patch Set 7 : remove build directory and put back args.gn file #

Patch Set 8 : getline #

Patch Set 9 : better help message #

Patch Set 10 : add doc comments #

Patch Set 11 : chrome/tools/convert_dict/hunspell_reader.cc - ReadLine() #

Patch Set 12 : write build.ninja file #

Patch Set 13 : default ninja file #

Patch Set 14 : the last piece #

Patch Set 15 : remove debugging code - more Errs #

Total comments: 6

Patch Set 16 : Do the logic with StringSplit #

Total comments: 13

Patch Set 17 : review fixes #

Total comments: 2

Patch Set 18 : Err instead of DeleteFile #

Unified diffs Side-by-side diffs Delta from patch set Stats (+160 lines, -1 line) Patch
M tools/gn/BUILD.gn View 1 chunk +2 lines, -1 line 0 comments Download
A tools/gn/command_clean.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +151 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
M tools/gn/gn.gyp View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 20 (4 generated)
tfarina
Hi Brett, could you review this to me? I'm happy to polish this. I'm excited ...
5 years, 10 months ago (2015-02-10 22:59:53 UTC) #2
scottmg
https://codereview.chromium.org/909103003/diff/280001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/280001/tools/gn/command_clean.cc#newcode36 tools/gn/command_clean.cc:36: if (!base::ReadFileToString(build_ninja_file, &file_contents)) { It looks like you meant ...
5 years, 10 months ago (2015-02-11 00:16:37 UTC) #4
cjhopman
https://codereview.chromium.org/909103003/diff/280001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/280001/tools/gn/command_clean.cc#newcode99 tools/gn/command_clean.cc:99: // GN builds aren't automatically regenerated when you sync. ...
5 years, 10 months ago (2015-02-11 01:59:42 UTC) #6
tfarina
PTAL https://codereview.chromium.org/909103003/diff/280001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/280001/tools/gn/command_clean.cc#newcode36 tools/gn/command_clean.cc:36: if (!base::ReadFileToString(build_ninja_file, &file_contents)) { On 2015/02/11 00:16:36, scottmg ...
5 years, 10 months ago (2015-02-11 12:29:26 UTC) #7
tfarina
Chris, Scott, are you guys OK with it? Brett, when you have a time, please, ...
5 years, 10 months ago (2015-02-12 15:43:27 UTC) #8
brettw
https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc#newcode71 tools/gn/command_clean.cc:71: "Usage: \"gn clean <out_dir> \"").PrintToStdout(); No space after <out_dir> ...
5 years, 10 months ago (2015-02-13 20:53:15 UTC) #9
tfarina
https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc#newcode87 tools/gn/command_clean.cc:87: base::DeleteFile(build_dir, true); On 2015/02/13 20:53:14, brettw wrote: > We ...
5 years, 10 months ago (2015-02-14 01:46:40 UTC) #10
tfarina
https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc#newcode76 tools/gn/command_clean.cc:76: if (!setup->DoSetup(args[0], false) || !setup->Run()) On 2015/02/13 20:53:14, brettw ...
5 years, 10 months ago (2015-02-16 20:33:33 UTC) #11
brettw
I can't think of a good reason not to run Setup as long as we ...
5 years, 10 months ago (2015-02-16 23:35:21 UTC) #12
tfarina
https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/300001/tools/gn/command_clean.cc#newcode66 tools/gn/command_clean.cc:66: " Deletes the contents of the output directory except ...
5 years, 10 months ago (2015-02-17 02:31:41 UTC) #13
brettw
https://codereview.chromium.org/909103003/diff/320001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/320001/tools/gn/command_clean.cc#newcode88 tools/gn/command_clean.cc:88: base::DeleteFile(build_dir, true); I don't think we want to do ...
5 years, 10 months ago (2015-02-17 17:41:56 UTC) #14
tfarina
https://codereview.chromium.org/909103003/diff/320001/tools/gn/command_clean.cc File tools/gn/command_clean.cc (right): https://codereview.chromium.org/909103003/diff/320001/tools/gn/command_clean.cc#newcode88 tools/gn/command_clean.cc:88: base::DeleteFile(build_dir, true); On 2015/02/17 17:41:56, brettw wrote: > I ...
5 years, 10 months ago (2015-02-17 18:49:19 UTC) #15
brettw
lgtm
5 years, 10 months ago (2015-02-17 20:40:27 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/909103003/340001
5 years, 10 months ago (2015-02-17 22:12:48 UTC) #18
commit-bot: I haz the power
Committed patchset #18 (id:340001)
5 years, 10 months ago (2015-02-17 22:17:41 UTC) #19
commit-bot: I haz the power
5 years, 10 months ago (2015-02-17 22:18:35 UTC) #20
Message was sent while issue was closed.
Patchset 18 (id:??) landed as
https://crrev.com/7ad216606be9aa7b6d0da6109fe1ecf5d4968dab
Cr-Commit-Position: refs/heads/master@{#316670}

Powered by Google App Engine
This is Rietveld 408576698