PRESUBMIT: Improve --check-only logic in tools/gen_xxx

This change introduces more uniform and reliable
handling of the presubmit-time check of generators.
Instead of delegating the check to the PRESUBMIT.py
script, it introduce a --check-only option.
Then it changes the behavior of generator to:
- Always write to xxx.swp files (which are .gitignore-d)
- If --check-only, diff-test and remove them
- If not, rename them into the final location

Test: manual (edit files, run git cl presubmit --force)
Change-Id: Ic156620c591bd434781c543803c9ab7aa3c2a33c
diff --git a/tools/gen_amalgamated b/tools/gen_amalgamated
index 06da7a3..a8d40da 100755
--- a/tools/gen_amalgamated
+++ b/tools/gen_amalgamated
@@ -44,7 +44,11 @@
 
 # Arguments for the GN output directory (unless overridden from the command
 # line).
-gn_args = 'is_debug=false perfetto_enable_ipc=true'
+gn_args = ' '.join([
+    'is_debug=false',
+    'perfetto_build_with_embedder=true',
+    'perfetto_enable_ipc=true'
+])
 
 # Compiler flags which aren't filtered out.
 cflag_whitelist = r'^-(W.*|fno-exceptions|fPIC|std.*|fvisibility.*)$'