[infra] Update recipes engine to 0589a4

This required several changes to module method invocations.

Change-Id: Ief8678cb919fc435cd25be3ece1348087be9d51f
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/4800
Reviewed-by: Julie Hockett <juliehockett@google.com>
Commit-Queue: Petr Hosek <phosek@google.com>
diff --git a/infra/README.recipes.md b/infra/README.recipes.md
index d8005aa..128ecb7 100644
--- a/infra/README.recipes.md
+++ b/infra/README.recipes.md
@@ -1,5 +1,5 @@
 <!--- AUTOGENERATED BY `./recipes.py test train` -->
-# Package documentation for [gn]()
+# Repo documentation for [gn]()
 ## Table of Contents
 
 **[Recipe Modules](#Recipe-Modules)**
@@ -94,15 +94,15 @@
 
 &mdash; **def [RunSteps](/infra/recipe_modules/windows_sdk/examples/full.py#13)(api):**
 
-[recipe_engine/recipe_modules/buildbucket]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-buildbucket
-[recipe_engine/recipe_modules/cipd]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-cipd
-[recipe_engine/recipe_modules/context]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-context
-[recipe_engine/recipe_modules/file]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-file
-[recipe_engine/recipe_modules/json]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-json
-[recipe_engine/recipe_modules/path]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-path
-[recipe_engine/recipe_modules/platform]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-platform
-[recipe_engine/recipe_modules/properties]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-properties
-[recipe_engine/recipe_modules/python]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-python
-[recipe_engine/recipe_modules/raw_io]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-raw_io
-[recipe_engine/recipe_modules/step]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/README.recipes.md#recipe_modules-step
-[recipe_engine/wkt/RecipeApi]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/82e233fa4e6fed0a5dd99501e0d52d3dce25c994/recipe_engine/recipe_api.py#1006
+[recipe_engine/recipe_modules/buildbucket]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-buildbucket
+[recipe_engine/recipe_modules/cipd]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-cipd
+[recipe_engine/recipe_modules/context]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-context
+[recipe_engine/recipe_modules/file]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-file
+[recipe_engine/recipe_modules/json]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-json
+[recipe_engine/recipe_modules/path]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-path
+[recipe_engine/recipe_modules/platform]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-platform
+[recipe_engine/recipe_modules/properties]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-properties
+[recipe_engine/recipe_modules/python]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-python
+[recipe_engine/recipe_modules/raw_io]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-raw_io
+[recipe_engine/recipe_modules/step]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/README.recipes.md#recipe_modules-step
+[recipe_engine/wkt/RecipeApi]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/0589a429cf3c164004dae4ced4c75784a50afd81/recipe_engine/recipe_api.py#838
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
index 70e6892..6b7363b 100644
--- a/infra/config/recipes.cfg
+++ b/infra/config/recipes.cfg
@@ -3,7 +3,7 @@
   "deps": {
     "recipe_engine": {
       "branch": "master",
-      "revision": "82e233fa4e6fed0a5dd99501e0d52d3dce25c994",
+      "revision": "0589a429cf3c164004dae4ced4c75784a50afd81",
       "url": "https://chromium.googlesource.com/infra/luci/recipes-py"
     }
   },
diff --git a/infra/recipe_modules/macos_sdk/examples/full.expected/linux.json b/infra/recipe_modules/macos_sdk/examples/full.expected/linux.json
index 51d9430..40db66c 100644
--- a/infra/recipe_modules/macos_sdk/examples/full.expected/linux.json
+++ b/infra/recipe_modules/macos_sdk/examples/full.expected/linux.json
@@ -16,8 +16,7 @@
     "name": "ninja"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipe_modules/macos_sdk/examples/full.expected/mac.json b/infra/recipe_modules/macos_sdk/examples/full.expected/mac.json
index e5a7fc0..e2acecd 100644
--- a/infra/recipe_modules/macos_sdk/examples/full.expected/mac.json
+++ b/infra/recipe_modules/macos_sdk/examples/full.expected/mac.json
@@ -18,7 +18,7 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:434\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -76,8 +76,7 @@
     "name": "reset XCode"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipe_modules/macos_sdk/examples/full.expected/win.json b/infra/recipe_modules/macos_sdk/examples/full.expected/win.json
index 51d9430..40db66c 100644
--- a/infra/recipe_modules/macos_sdk/examples/full.expected/win.json
+++ b/infra/recipe_modules/macos_sdk/examples/full.expected/win.json
@@ -16,8 +16,7 @@
     "name": "ninja"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipe_modules/windows_sdk/examples/full.expected/linux.json b/infra/recipe_modules/windows_sdk/examples/full.expected/linux.json
index 51d9430..40db66c 100644
--- a/infra/recipe_modules/windows_sdk/examples/full.expected/linux.json
+++ b/infra/recipe_modules/windows_sdk/examples/full.expected/linux.json
@@ -16,8 +16,7 @@
     "name": "ninja"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipe_modules/windows_sdk/examples/full.expected/mac.json b/infra/recipe_modules/windows_sdk/examples/full.expected/mac.json
index 51d9430..40db66c 100644
--- a/infra/recipe_modules/windows_sdk/examples/full.expected/mac.json
+++ b/infra/recipe_modules/windows_sdk/examples/full.expected/mac.json
@@ -16,8 +16,7 @@
     "name": "ninja"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipe_modules/windows_sdk/examples/full.expected/win.json b/infra/recipe_modules/windows_sdk/examples/full.expected/win.json
index 092354d..def8e7a 100644
--- a/infra/recipe_modules/windows_sdk/examples/full.expected/win.json
+++ b/infra/recipe_modules/windows_sdk/examples/full.expected/win.json
@@ -101,8 +101,7 @@
     "name": "taskkill mspdbsrv"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes.py b/infra/recipes.py
index d726c68..2fe0086 100755
--- a/infra/recipes.py
+++ b/infra/recipes.py
@@ -10,7 +10,7 @@
 ** DO NOT MODIFY **
 *******************
 
-This is a copy of https://chromium.googlesource.com/infra/luci/recipes-py/+/master/doc/recipes.py.
+This is a copy of https://chromium.googlesource.com/infra/luci/recipes-py/+/master/recipes.py.
 To fix bugs, fix in the googlesource repo then run the autoroller.
 """
 
@@ -32,16 +32,10 @@
 #
 # url (str) - the url to the engine repo we want to use.
 # revision (str) - the git revision for the engine to get.
-# path_override (str) - the subdirectory in the engine repo we should use to
-#   find it's recipes.py entrypoint. This is here for completeness, but will
-#   essentially always be empty. It would be used if the recipes-py repo was
-#   merged as a subdirectory of some other repo and you depended on that
-#   subdirectory.
 # branch (str) - the branch to fetch for the engine as an absolute ref (e.g.
 #   refs/heads/master)
-# repo_type ("GIT"|"GITILES") - An ignored enum which will be removed soon.
 EngineDep = namedtuple('EngineDep',
-                       'url revision path_override branch repo_type')
+                       'url revision branch')
 
 
 class MalformedRecipesCfg(Exception):
@@ -73,9 +67,12 @@
       raise MalformedRecipesCfg('unknown version %d' % pb['api_version'],
                                 recipes_cfg_path)
 
-    # If we're running ./doc/recipes.py from the recipe_engine repo itself, then
+    # If we're running ./recipes.py from the recipe_engine repo itself, then
     # return None to signal that there's no EngineDep.
-    if pb['project_id'] == 'recipe_engine':
+    repo_name = pb.get('repo_name')
+    if not repo_name:
+      repo_name = pb['project_id']
+    if repo_name == 'recipe_engine':
       return None, pb.get('recipes_path', '')
 
     engine = pb['deps']['recipe_engine']
@@ -86,7 +83,6 @@
         recipes_cfg_path)
 
     engine.setdefault('revision', '')
-    engine.setdefault('path_override', '')
     engine.setdefault('branch', 'refs/heads/master')
     recipes_path = pb.get('recipes_path', '')
 
@@ -94,12 +90,6 @@
     if not engine['branch'].startswith('refs/'):
       engine['branch'] = 'refs/heads/' + engine['branch']
 
-    engine.setdefault('repo_type', 'GIT')
-    if engine['repo_type'] not in ('GIT', 'GITILES'):
-      raise MalformedRecipesCfg(
-        'Unsupported "repo_type" value in dependency "recipe_engine"',
-        recipes_cfg_path)
-
     recipes_path = os.path.join(
       repo_root, recipes_path.replace('/', os.path.sep))
     return EngineDep(**engine), recipes_path
@@ -110,6 +100,20 @@
 _BAT = '.bat' if sys.platform.startswith(('win', 'cygwin')) else ''
 GIT = 'git' + _BAT
 VPYTHON = 'vpython' + _BAT
+CIPD = 'cipd' + _BAT
+REQUIRED_BINARIES = {GIT, VPYTHON, CIPD}
+
+
+def _is_executable(path):
+  return os.path.isfile(path) and os.access(path, os.X_OK)
+
+# TODO: Use shutil.which once we switch to Python3.
+def _is_on_path(basename):
+  for path in os.environ['PATH'].split(os.pathsep):
+    full_path = os.path.join(path, basename)
+    if _is_executable(full_path):
+      return True
+  return False
 
 
 def _subprocess_call(argv, **kwargs):
@@ -132,7 +136,7 @@
 def parse_args(argv):
   """This extracts a subset of the arguments that this bootstrap script cares
   about. Currently this consists of:
-    * an override for the recipe engine in the form of `-O recipe_engin=/path`
+    * an override for the recipe engine in the form of `-O recipe_engine=/path`
     * the --package option.
   """
   PREFIX = 'recipe_engine='
@@ -160,33 +164,39 @@
 
   if not engine_path:
     revision = dep.revision
-    subpath = dep.path_override
     branch = dep.branch
 
     # Ensure that we have the recipe engine cloned.
-    engine = os.path.join(recipes_path, '.recipe_deps', 'recipe_engine')
-    engine_path = os.path.join(engine, subpath)
+    engine_path = os.path.join(recipes_path, '.recipe_deps', 'recipe_engine')
 
     with open(os.devnull, 'w') as NUL:
       # Note: this logic mirrors the logic in recipe_engine/fetch.py
-      _git_check_call(['init', engine], stdout=NUL)
+      _git_check_call(['init', engine_path], stdout=NUL)
 
       try:
         _git_check_call(['rev-parse', '--verify', '%s^{commit}' % revision],
-                        cwd=engine, stdout=NUL, stderr=NUL)
+                        cwd=engine_path, stdout=NUL, stderr=NUL)
       except subprocess.CalledProcessError:
-        _git_check_call(['fetch', url, branch], cwd=engine, stdout=NUL,
+        _git_check_call(['fetch', url, branch], cwd=engine_path, stdout=NUL,
                         stderr=NUL)
 
     try:
-      _git_check_call(['diff', '--quiet', revision], cwd=engine)
+      _git_check_call(['diff', '--quiet', revision], cwd=engine_path)
     except subprocess.CalledProcessError:
-      _git_check_call(['reset', '-q', '--hard', revision], cwd=engine)
+      _git_check_call(['reset', '-q', '--hard', revision], cwd=engine_path)
+
+    # If the engine has refactored/moved modules we need to clean all .pyc files
+    # or things will get squirrely.
+    _git_check_call(['clean', '-qxf'], cwd=engine_path)
 
   return engine_path
 
 
 def main():
+  for required_binary in REQUIRED_BINARIES:
+    if not _is_on_path(required_binary):
+      return 'Required binary is not found on PATH: %s' % required_binary
+
   if '--verbose' in sys.argv:
     logging.getLogger().setLevel(logging.INFO)
 
@@ -211,7 +221,7 @@
 
   return _subprocess_call([
       VPYTHON, '-u',
-      os.path.join(engine_path, 'recipes.py')] + args)
+      os.path.join(engine_path, 'recipe_engine', 'main.py')] + args)
 
 
 if __name__ == '__main__':
diff --git a/infra/recipes/gn.expected/ci_linux.json b/infra/recipes/gn.expected/ci_linux.json
index 993c491..4105a03 100644
--- a/infra/recipes/gn.expected/ci_linux.json
+++ b/infra/recipes/gn.expected/ci_linux.json
@@ -21,7 +21,7 @@
       "fetch",
       "--tags",
       "https://gn.googlesource.com/gn",
-      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+      "2d72510e447ab60a9728aeea2362d8be2cbd7789"
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
@@ -62,17 +62,17 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ], @@@",
       "@@@STEP_LOG_LINE@json.output@    \"sysroot\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:a28\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -207,6 +207,8 @@
       "{\"data\": [{\"file\": \"gn\"}, {\"version_file\": \".versions/gn.cipd_version\"}], \"install_mode\": \"copy\", \"package\": \"gn/gn/${platform}\", \"root\": \"[START_DIR]/gn/out\"}",
       "-out",
       "[CLEANUP]/gn.cipd",
+      "-hash-algo",
+      "sha256",
       "-json-output",
       "/path/to/tmp/json"
     ],
@@ -215,15 +217,14 @@
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
-      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
     ]
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.expected/ci_mac.json b/infra/recipes/gn.expected/ci_mac.json
index bb30be4..aed5d14 100644
--- a/infra/recipes/gn.expected/ci_mac.json
+++ b/infra/recipes/gn.expected/ci_mac.json
@@ -21,7 +21,7 @@
       "fetch",
       "--tags",
       "https://gn.googlesource.com/gn",
-      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+      "2d72510e447ab60a9728aeea2362d8be2cbd7789"
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
@@ -62,11 +62,11 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -93,7 +93,7 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:434\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -161,7 +161,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "debug.build.generate",
     "~followup_annotations": [
@@ -180,7 +180,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "debug.build.ninja",
     "~followup_annotations": [
@@ -221,7 +221,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "release.build.generate",
     "~followup_annotations": [
@@ -240,7 +240,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "release.build.ninja",
     "~followup_annotations": [
@@ -273,6 +273,8 @@
       "{\"data\": [{\"file\": \"gn\"}, {\"version_file\": \".versions/gn.cipd_version\"}], \"install_mode\": \"copy\", \"package\": \"gn/gn/${platform}\", \"root\": \"[START_DIR]/gn/out\"}",
       "-out",
       "[CLEANUP]/gn.cipd",
+      "-hash-algo",
+      "sha256",
       "-json-output",
       "/path/to/tmp/json"
     ],
@@ -281,15 +283,14 @@
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
-      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
     ]
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.expected/ci_win.json b/infra/recipes/gn.expected/ci_win.json
index 764f2fa..6df7ef5 100644
--- a/infra/recipes/gn.expected/ci_win.json
+++ b/infra/recipes/gn.expected/ci_win.json
@@ -21,7 +21,7 @@
       "fetch",
       "--tags",
       "https://gn.googlesource.com/gn",
-      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+      "2d72510e447ab60a9728aeea2362d8be2cbd7789"
     ],
     "cwd": "[START_DIR]\\gn",
     "infra_step": true,
@@ -62,7 +62,7 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -131,26 +131,10 @@
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "debug"
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "debug.build",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
@@ -216,26 +200,10 @@
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "release"
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "release.build",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
@@ -318,6 +286,8 @@
       "{\"data\": [{\"file\": \"gn.exe\"}, {\"version_file\": \".versions/gn.exe.cipd_version\"}], \"install_mode\": \"copy\", \"package\": \"gn/gn/${platform}\", \"root\": \"[START_DIR]\\\\gn\\\\out\"}",
       "-out",
       "[CLEANUP]\\gn.cipd",
+      "-hash-algo",
+      "sha256",
       "-json-output",
       "/path/to/tmp/json"
     ],
@@ -326,15 +296,14 @@
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
-      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
     ]
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.expected/cipd_exists.json b/infra/recipes/gn.expected/cipd_exists.json
index c6f3825..29834b2 100644
--- a/infra/recipes/gn.expected/cipd_exists.json
+++ b/infra/recipes/gn.expected/cipd_exists.json
@@ -62,17 +62,17 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ], @@@",
       "@@@STEP_LOG_LINE@json.output@    \"sysroot\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:a28\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -207,6 +207,8 @@
       "{\"data\": [{\"file\": \"gn\"}, {\"version_file\": \".versions/gn.cipd_version\"}], \"install_mode\": \"copy\", \"package\": \"gn/gn/${platform}\", \"root\": \"[START_DIR]/gn/out\"}",
       "-out",
       "[CLEANUP]/gn.cipd",
+      "-hash-algo",
+      "sha256",
       "-json-output",
       "/path/to/tmp/json"
     ],
@@ -215,7 +217,7 @@
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
-      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
@@ -259,8 +261,7 @@
     "name": "Package is up-to-date"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.expected/cipd_register.json b/infra/recipes/gn.expected/cipd_register.json
index 76efe86..bc97fc0 100644
--- a/infra/recipes/gn.expected/cipd_register.json
+++ b/infra/recipes/gn.expected/cipd_register.json
@@ -62,17 +62,17 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ], @@@",
       "@@@STEP_LOG_LINE@json.output@    \"sysroot\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:a28\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -207,6 +207,8 @@
       "{\"data\": [{\"file\": \"gn\"}, {\"version_file\": \".versions/gn.cipd_version\"}], \"install_mode\": \"copy\", \"package\": \"gn/gn/${platform}\", \"root\": \"[START_DIR]/gn/out\"}",
       "-out",
       "[CLEANUP]/gn.cipd",
+      "-hash-algo",
+      "sha256",
       "-json-output",
       "/path/to/tmp/json"
     ],
@@ -215,7 +217,7 @@
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
-      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
@@ -268,15 +270,14 @@
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
-      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"package\": \"gn/gn/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
     ]
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.expected/cq_linux.json b/infra/recipes/gn.expected/cq_linux.json
index 8fe2ad2..dcd0a7e 100644
--- a/infra/recipes/gn.expected/cq_linux.json
+++ b/infra/recipes/gn.expected/cq_linux.json
@@ -21,7 +21,7 @@
       "fetch",
       "--tags",
       "https://gn.googlesource.com/gn",
-      "refs/heads/master"
+      ""
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
@@ -48,11 +48,11 @@
       "git",
       "fetch",
       "https://gn.googlesource.com/gn",
-      "refs/changes/00/1000/1"
+      "refs/changes/56/123456/7"
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
-    "name": "git.fetch 1000/1",
+    "name": "git.fetch 123456/7",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -65,7 +65,7 @@
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
-    "name": "git.cherry-pick 1000/1",
+    "name": "git.cherry-pick 123456/7",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -89,17 +89,17 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ], @@@",
       "@@@STEP_LOG_LINE@json.output@    \"sysroot\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:a28\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/sysroot/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -227,8 +227,7 @@
     ]
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.expected/cq_mac.json b/infra/recipes/gn.expected/cq_mac.json
index 7872a57..6b0aa0a 100644
--- a/infra/recipes/gn.expected/cq_mac.json
+++ b/infra/recipes/gn.expected/cq_mac.json
@@ -21,7 +21,7 @@
       "fetch",
       "--tags",
       "https://gn.googlesource.com/gn",
-      "refs/heads/master"
+      ""
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
@@ -48,11 +48,11 @@
       "git",
       "fetch",
       "https://gn.googlesource.com/gn",
-      "refs/changes/00/1000/1"
+      "refs/changes/56/123456/7"
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
-    "name": "git.fetch 1000/1",
+    "name": "git.fetch 123456/7",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -65,7 +65,7 @@
     ],
     "cwd": "[START_DIR]/gn",
     "infra_step": true,
-    "name": "git.cherry-pick 1000/1",
+    "name": "git.cherry-pick 123456/7",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -89,11 +89,11 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"fuchsia/clang/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -120,7 +120,7 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:434\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -188,7 +188,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "debug.build.generate",
     "~followup_annotations": [
@@ -207,7 +207,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "debug.build.ninja",
     "~followup_annotations": [
@@ -248,7 +248,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "release.build.generate",
     "~followup_annotations": [
@@ -267,7 +267,7 @@
       "CC": "[START_DIR]/cipd/bin/clang",
       "CFLAGS": "--sysroot=/some/xcode/path",
       "CXX": "[START_DIR]/cipd/bin/clang++",
-      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a [START_DIR]/cipd/lib/libc++abi.a [START_DIR]/cipd/lib/libunwind.a"
+      "LDFLAGS": "--sysroot=/some/xcode/path -nostdlib++ [START_DIR]/cipd/lib/libc++.a"
     },
     "name": "release.build.ninja",
     "~followup_annotations": [
@@ -293,8 +293,7 @@
     "name": "reset XCode"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.expected/cq_win.json b/infra/recipes/gn.expected/cq_win.json
index 92f665a..979c3b9 100644
--- a/infra/recipes/gn.expected/cq_win.json
+++ b/infra/recipes/gn.expected/cq_win.json
@@ -21,7 +21,7 @@
       "fetch",
       "--tags",
       "https://gn.googlesource.com/gn",
-      "refs/heads/master"
+      ""
     ],
     "cwd": "[START_DIR]\\gn",
     "infra_step": true,
@@ -48,11 +48,11 @@
       "git",
       "fetch",
       "https://gn.googlesource.com/gn",
-      "refs/changes/00/1000/1"
+      "refs/changes/56/123456/7"
     ],
     "cwd": "[START_DIR]\\gn",
     "infra_step": true,
-    "name": "git.fetch 1000/1",
+    "name": "git.fetch 123456/7",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -65,7 +65,7 @@
     ],
     "cwd": "[START_DIR]\\gn",
     "infra_step": true,
-    "name": "git.cherry-pick 1000/1",
+    "name": "git.cherry-pick 123456/7",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -89,7 +89,7 @@
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/${platform}\"@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/ninja/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
@@ -158,26 +158,10 @@
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "debug"
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "debug.build",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
@@ -243,26 +227,10 @@
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "release"
   },
   {
     "cmd": [],
-    "env": {
-      "VSINSTALLDIR": "[CACHE]\\windows_sdk"
-    },
-    "env_prefixes": {
-      "PATH": [
-        "[CACHE]\\windows_sdk\\win_sdk\\bin\\x64"
-      ]
-    },
     "name": "release.build",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
@@ -338,8 +306,7 @@
     "name": "taskkill mspdbsrv"
   },
   {
-    "name": "$result",
-    "recipe_result": null,
-    "status_code": 0
+    "jsonResult": null,
+    "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py
index 7a079b5..4005b6e 100644
--- a/infra/recipes/gn.py
+++ b/infra/recipes/gn.py
@@ -90,15 +90,13 @@
           step_test_data=
           lambda: api.raw_io.test_api.stream_output('/some/xcode/path')
       ).stdout.strip()
-      stdlib = '%s %s %s' % (cipd_dir.join('lib', 'libc++.a'),
-                             cipd_dir.join('lib', 'libc++abi.a'),
-                             cipd_dir.join('lib', 'libunwind.a'))
+      stdlib = '-nostdlib++ %s' % cipd_dir.join('lib', 'libc++.a')
       env = {
           'CC': cipd_dir.join('bin', 'clang'),
           'CXX': cipd_dir.join('bin', 'clang++'),
           'AR': cipd_dir.join('bin', 'llvm-ar'),
           'CFLAGS': sysroot,
-          'LDFLAGS': '%s -nostdlib++ %s' % (sysroot, stdlib),
+          'LDFLAGS': '%s %s' % (sysroot, stdlib),
       }
     else:
       env = {}
@@ -157,35 +155,32 @@
 
 
 def GenTests(api):
-  REVISION = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
-
   for platform in ('linux', 'mac', 'win'):
     yield (api.test('ci_' + platform) + api.platform.name(platform) +
            api.buildbucket.ci_build(
+               project='gn',
                git_repo='gn.googlesource.com/gn',
-               revision=REVISION,
            ))
 
     yield (api.test('cq_' + platform) + api.platform.name(platform) +
            api.buildbucket.try_build(
-               gerrit_host='gn-review.googlesource.com',
-               change_number=1000,
-               patch_set=1,
+               project='gn',
+               git_repo='gn.googlesource.com/gn',
            ))
 
   yield (api.test('cipd_exists') + api.buildbucket.ci_build(
       project='infra-internal',
       git_repo='gn.googlesource.com/gn',
-      revision=REVISION,
-  ) + api.step_data('rev-parse', api.raw_io.stream_output(REVISION)) +
-         api.step_data('cipd search gn/gn/${platform} git_revision:' + REVISION,
+      revision='a' * 40,
+  ) + api.step_data('rev-parse', api.raw_io.stream_output('a' * 40)) +
+         api.step_data('cipd search gn/gn/${platform} git_revision:' + 'a' * 40,
                        api.cipd.example_search('gn/gn/linux-amd64',
-                                               ['git_revision:' + REVISION])))
+                                               ['git_revision:' + 'a' * 40])))
 
   yield (api.test('cipd_register') + api.buildbucket.ci_build(
       project='infra-internal',
       git_repo='gn.googlesource.com/gn',
-      revision=REVISION,
-  ) + api.step_data('rev-parse', api.raw_io.stream_output(REVISION)) +
-         api.step_data('cipd search gn/gn/${platform} git_revision:' + REVISION,
+      revision='a' * 40,
+  ) + api.step_data('rev-parse', api.raw_io.stream_output('a' * 40)) +
+         api.step_data('cipd search gn/gn/${platform} git_revision:' + 'a' * 40,
                        api.cipd.example_search('gn/gn/linux-amd64', [])))