[build] Remove tools/compile_platform.py

It was just a shim around calling into Dart, which we are trying to
funnel through the templates in build/dart/dart_action.gni.

Change-Id: Ieb46ddddcbaacd01667e27a05cb7badd5bb5c0fd
Reviewed-on: https://dart-review.googlesource.com/61020
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
diff --git a/tools/compile_platform.py b/tools/compile_platform.py
deleted file mode 100755
index 3d71fed..0000000
--- a/tools/compile_platform.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-import os
-import subprocess
-import sys
-import utils
-
-usage = """compile_platform.py [options]"""
-
-def DisplayBootstrapWarning():
-  print """\
-
-
-WARNING: Your system can't run the checked-in Dart SDK.  Using the bootstrap
-Dart executable will make debug builds slow.  Please see the Wiki for
-instructions on replacing the checked-in Dart SDK.
-
-https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools
-
-"""
-
-
-def path(uri_path):
-  args = [ os.path.dirname(__file__), ".." ] + uri_path.split("/")
-  return os.path.normpath(os.path.join(*args))
-
-
-def main():
-  verbose = False
-  arguments = [ None ] # Leave room for the Dart VM executable.
-  arguments.append("--packages=" + path(".packages"))
-  arguments.append(path("pkg/front_end/tool/_fasta/compile_platform.dart"))
-  i = 1 # Skip argument #0 which is the script name.
-  dart_executable = None
-  while i < len(sys.argv):
-    argument = sys.argv[i]
-    if argument == "--dart-executable":
-      dart_executable = sys.argv[i + 1]
-      i += 1
-    elif argument.startswith("--dart-executable="):
-      dart_executable = argument[len("--dart-executable="):]
-    else:
-      if argument == "-v" or argument == "--verbose":
-        verbose = True
-      arguments.append(argument)
-    i += 1
-
-  if dart_executable:
-    dart_executable = os.path.abspath(dart_executable)
-  else:
-    if utils.CheckedInSdkCheckExecutable():
-      dart_executable = utils.CheckedInSdkExecutable()
-    else:
-      DisplayBootstrapWarning()
-      print >> sys.stderr, "ERROR: Can't locate Dart VM executable."
-      return -1
-
-  arguments[0] = os.path.abspath(dart_executable)
-  if verbose:
-    print "Running:", " ".join(arguments)
-  return subprocess.call(arguments)
-
-
-if __name__ == "__main__":
-  sys.exit(main())
diff --git a/utils/compile_platform.gni b/utils/compile_platform.gni
index f3bb615..94bce50 100644
--- a/utils/compile_platform.gni
+++ b/utils/compile_platform.gni
@@ -2,14 +2,7 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-import("../build/dart/dart_host_sdk_toolchain.gni")
-import("../build/dart/prebuilt_dart_sdk.gni")
-
-_is_fuchsia = defined(is_fuchsia_tree) && is_fuchsia_tree
-
-if (_is_fuchsia) {
-  import("//build/dart/dart.gni")
-}
+import("../build/dart/dart_action.gni")
 
 _dart_root = get_path_info("..", "abspath")
 
@@ -41,8 +34,10 @@
         invoker.add_implicit_vm_platform_dependency
   }
 
-  action(target_name) {
-    script = "$_dart_root/tools/compile_platform.py"
+  prebuilt_dart_action(target_name) {
+    script = "$_dart_root/pkg/front_end/tool/_fasta/compile_platform.dart"
+
+    packages = "$_dart_root/.packages"
 
     outputs = invoker.outputs
 
@@ -64,22 +59,6 @@
     }
     depfile = outputs[0] + ".d"
 
-    if (_is_fuchsia) {
-      args += [
-        "--dart-executable",
-        rebase_path(prebuilt_dart),
-      ]
-    } else if (!prebuilt_dart_exe_works) {
-      deps += [ "$_dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
-      dart_out_dir = get_label_info(
-              "$_dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)",
-              "root_out_dir")
-      args += [
-        "--dart-executable",
-        rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix"),
-      ]
-    }
-
     args += invoker.args
     if (defined(invoker.single_root_scheme)) {
       args += [ "--single-root-scheme=" + invoker.single_root_scheme ]