[hhh] Symlink dart sdk and flutter web sdk instead of making a copy.

Saves 15 seconds from the build time.

Change-Id: Ib8c896a3b8b07ec7ae5e34512b6e68e91b4dc62c
Reviewed-on: https://dart-review.googlesource.com/c/recipes/+/196549
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
diff --git a/recipes/dart/flutter_engine.expected/flutter-engine-linux.json b/recipes/dart/flutter_engine.expected/flutter-engine-linux.json
index a87f923..cab7a54 100644
--- a/recipes/dart/flutter_engine.expected/flutter-engine-linux.json
+++ b/recipes/dart/flutter_engine.expected/flutter-engine-linux.json
@@ -6218,7 +6218,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/dart-sdk",
       "[CACHE]/builder/flutter/bin/cache/dart-sdk"
     ],
@@ -6234,7 +6234,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location"
+    "name": "symlink just built dart sdk to cached location"
   },
   {
     "cmd": [
@@ -6243,7 +6243,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/flutter_web_sdk",
       "[CACHE]/builder/flutter/bin/cache/flutter_web_sdk"
     ],
@@ -6259,7 +6259,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location (2)"
+    "name": "symlink just built flutter web sdk to cached location"
   },
   {
     "cmd": [
diff --git a/recipes/dart/flutter_engine.expected/only-run-webtests-suite.json b/recipes/dart/flutter_engine.expected/only-run-webtests-suite.json
index 2395623..871f5d1 100644
--- a/recipes/dart/flutter_engine.expected/only-run-webtests-suite.json
+++ b/recipes/dart/flutter_engine.expected/only-run-webtests-suite.json
@@ -6218,7 +6218,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/dart-sdk",
       "[CACHE]/builder/flutter/bin/cache/dart-sdk"
     ],
@@ -6234,7 +6234,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location"
+    "name": "symlink just built dart sdk to cached location"
   },
   {
     "cmd": [
@@ -6243,7 +6243,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/flutter_web_sdk",
       "[CACHE]/builder/flutter/bin/cache/flutter_web_sdk"
     ],
@@ -6259,7 +6259,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location (2)"
+    "name": "symlink just built flutter web sdk to cached location"
   },
   {
     "cmd": [
diff --git a/recipes/dart/flutter_engine.expected/run-all-test-suites.json b/recipes/dart/flutter_engine.expected/run-all-test-suites.json
index a87f923..cab7a54 100644
--- a/recipes/dart/flutter_engine.expected/run-all-test-suites.json
+++ b/recipes/dart/flutter_engine.expected/run-all-test-suites.json
@@ -6218,7 +6218,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/dart-sdk",
       "[CACHE]/builder/flutter/bin/cache/dart-sdk"
     ],
@@ -6234,7 +6234,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location"
+    "name": "symlink just built dart sdk to cached location"
   },
   {
     "cmd": [
@@ -6243,7 +6243,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/flutter_web_sdk",
       "[CACHE]/builder/flutter/bin/cache/flutter_web_sdk"
     ],
@@ -6259,7 +6259,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location (2)"
+    "name": "symlink just built flutter web sdk to cached location"
   },
   {
     "cmd": [
diff --git a/recipes/dart/flutter_engine.expected/run-undefined-test-suite.json b/recipes/dart/flutter_engine.expected/run-undefined-test-suite.json
index 759479f..a51910b 100644
--- a/recipes/dart/flutter_engine.expected/run-undefined-test-suite.json
+++ b/recipes/dart/flutter_engine.expected/run-undefined-test-suite.json
@@ -6218,7 +6218,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/dart-sdk",
       "[CACHE]/builder/flutter/bin/cache/dart-sdk"
     ],
@@ -6234,7 +6234,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location"
+    "name": "symlink just built dart sdk to cached location"
   },
   {
     "cmd": [
@@ -6243,7 +6243,7 @@
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
       "--json-output",
       "/path/to/tmp/json",
-      "copytree",
+      "symlink",
       "[CACHE]/builder/engine/src/out/host_debug/flutter_web_sdk",
       "[CACHE]/builder/flutter/bin/cache/flutter_web_sdk"
     ],
@@ -6259,7 +6259,7 @@
       "WEB_SHARD_COUNT": "16"
     },
     "infra_step": true,
-    "name": "copy just built dart sdk to cached location (2)"
+    "name": "symlink just built flutter web sdk to cached location"
   },
   {
     "cmd": [
diff --git a/recipes/dart/flutter_engine.py b/recipes/dart/flutter_engine.py
index adebe0d..5ada220 100644
--- a/recipes/dart/flutter_engine.py
+++ b/recipes/dart/flutter_engine.py
@@ -263,11 +263,11 @@
     '/bin/bash', '-c',
     'if [ -L "%(dir)s" ]; then rm "%(dir)s"; else rm -rf "%(dir)s"; fi' %
     {'dir': flutter_patched_sdk_product}])
-  api.file.copytree('copy just built dart sdk to cached location',
-                    engine_src.join('out', 'host_debug', 'dart-sdk'), dart_sdk)
-  api.file.copytree('copy just built dart sdk to cached location',
-                    engine_src.join('out', 'host_debug', 'flutter_web_sdk'),
-                    flutter_web_sdk)
+  api.file.symlink('symlink just built dart sdk to cached location',
+                   engine_src.join('out', 'host_debug', 'dart-sdk'), dart_sdk)
+  api.file.symlink('symlink just built flutter web sdk to cached location',
+                   engine_src.join('out', 'host_debug', 'flutter_web_sdk'),
+                   flutter_web_sdk)
   api.file.symlink('symlink just built pkg from dart sdk to cached location',
                    engine_src.join('out', 'host_debug', 'gen', 'dart-pkg'), pkg)
   api.file.symlink(