[SDK] - Ensure we only build an AOT snapshot for the frontend-server

Currently we seem to build both the JIT and AOT snapshots of the
frontend-server, ensure we only build the AOT snapshot on all
architectures except IA32

Change-Id: Ie79dc6d88fd9fa680267571e5d65081ca57609c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359100
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index f3c7aba..22259b9 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -49,7 +49,7 @@
 # ........dds.dart.snapshot
 # ........dart_tooling_daemon.dart.snapshot
 # ........frontend_server_aot.dart.snapshot (AOT snapshot, if not on ia32)
-# ........frontend_server.dart.snapshot
+# ........frontend_server.dart.snapshot (JIT snapshot only on ia32)
 # ........gen_kernel_aot.dart.snapshot (if not on ia32)
 # ........kernel-service.dart.snapshot
 # ........kernel_worker.dart.snapshot
@@ -121,14 +121,21 @@
     "../utils/dtd:dtd",
   ],
   [
-    "frontend_server",
-    "../utils/kernel-service:frontend_server",
+    "dds",
+    "../utils/dds:dds",
   ],
 ]
-_platform_sdk_snapshots += [ [
-      "dds",
-      "../utils/dds:dds",
-    ] ]
+if (dart_target_arch != "ia32" && dart_target_arch != "x86") {
+  _platform_sdk_snapshots += [ [
+        "frontend_server_aot",
+        "../utils/kernel-service:frontend_server_aot",
+      ] ]
+} else {
+  _platform_sdk_snapshots += [ [
+        "frontend_server",
+        "../utils/kernel-service:frontend_server",
+      ] ]
+}
 if (dart_snapshot_kind == "app-jit") {
   _platform_sdk_snapshots += [ [
         "kernel-service",
@@ -397,17 +404,6 @@
   }
 }
 
-# This target puts the frontend_server AOT snapshot into bin/snapshots
-copy("copy_frontend_server_aot_snapshot") {
-  visibility = [
-    ":copy_full_sdk_snapshots",
-    ":copy_platform_sdk_snapshots",
-  ]
-  deps = [ "../utils/kernel-service:frontend_server_aot" ]
-  sources = [ "$root_out_dir/frontend_server_aot.dart.snapshot" ]
-  outputs = [ "$root_out_dir/$dart_sdk_output/bin/snapshots/frontend_server_aot.dart.snapshot" ]
-}
-
 # This loop generates "copy" targets that put AppJIT snapshots into
 # bin/snapshots
 foreach(snapshot, _full_sdk_snapshots) {
@@ -415,7 +411,8 @@
 
   # The frontend_server is output to root_out_dir so that it doesn't conflict
   # with the flutter snapshot by the same name under root_gen_dir.
-  if (snapshot[0] == "frontend_server") {
+  if (snapshot[0] == "frontend_server" ||
+      snapshot[0] == "frontend_server_aot") {
     root = root_out_dir
   }
   copy("copy_${snapshot[0]}_snapshot") {
@@ -438,9 +435,6 @@
   foreach(snapshot, _platform_sdk_snapshots) {
     public_deps += [ ":copy_${snapshot[0]}_snapshot" ]
   }
-  if (dart_target_arch != "ia32" && dart_target_arch != "x86") {
-    public_deps += [ ":copy_frontend_server_aot_snapshot" ]
-  }
 }
 
 # This is the main rule for copying snapshots from _full_sdk_snapshots to
@@ -451,9 +445,6 @@
   foreach(snapshot, _full_sdk_snapshots) {
     public_deps += [ ":copy_${snapshot[0]}_snapshot" ]
   }
-  if (dart_target_arch != "ia32" && dart_target_arch != "x86") {
-    public_deps += [ ":copy_frontend_server_aot_snapshot" ]
-  }
 }
 
 # This is the main rule for copying the files that dartdoc needs.