Specifically only compile code in the build step.

This is part of the child CL. However, we need to submit this first
because CI always uses the *submitted* gn.py and doesn't see any
changes you make in the current CL.

This solves an issue where we try to run gn when target.is_host is false
(ie. we cross compile gn then try to run it).

Bug: None
Change-Id: I8784f1fa32677d44fa051d47774626256a6a6964
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/23220
Commit-Queue: Matt Stark <msta@google.com>
Reviewed-by: Takuto Ikuta <tikuta@google.com>
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py
index 93c9634..443ce2a 100644
--- a/infra/recipes/gn.py
+++ b/infra/recipes/gn.py
@@ -263,9 +263,8 @@
                      ['python3', '-u', src_dir.join('build', 'gen.py')] + args)
 
             # Windows requires the environment modifications when building too.
-            api.step('build',
-                     [cipd_dir.join('ninja'), '-C',
-                      src_dir.join('out')])
+            ninja_cmd = [cipd_dir.join('ninja'), '-C', src_dir.join('out')]
+            api.step('build', ninja_cmd + ['gn', 'gn_unittests'])
 
             if target.is_host:
               api.step('test', [src_dir.join('out', 'gn_unittests')])