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

Review URL: https://codereview.chromium.org/909103003

Cr-Original-Commit-Position: refs/heads/master@{#316670}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7ad216606be9aa7b6d0da6109fe1ecf5d4968dab
5 files changed
tree: b213b15c24f48f0a7ca339a64eab3a8328a344c8
  1. tools/