Add --omit_platform as option to fasta.

Change-Id: I9f8b7b89a0440bbff8b466ed2e4f2af73c72c023
Reviewed-on: https://dart-review.googlesource.com/c/84428
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index fcc9865..cf712e6 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -154,6 +154,10 @@
   /// Dumped data is printed in stdout.
   bool debugDump = false;
 
+  /// Whether to exclode the platform when serializing the result from a
+  /// 'fasta compile' run.
+  bool omitPlatform = false;
+
   /// Whether to set the exit code to non-zero if any problem (including
   /// warning, etc.) is encountered during compilation.
   bool setExitCodeOnProblem = false;
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index a1517be..126a0c0 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -159,6 +159,8 @@
 
   bool get debugDump => _raw.debugDump;
 
+  bool get omitPlatform => _raw.omitPlatform;
+
   bool get setExitCodeOnProblem => _raw.setExitCodeOnProblem;
 
   bool get embedSourceText => _raw.embedSourceText;
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index 517aeae..804241f 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -3391,6 +3391,9 @@
   --dump-ir
     Print compiled libraries in Kernel source notation.
 
+  --omit-platform
+    Exclude the platform from the serialized dill file.
+
   --bytecode
     Generate bytecode. Supported only for SDK platform compilation.
 
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 121cbcb..bddb452 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -1515,6 +1515,9 @@
       --dump-ir
         Print compiled libraries in Kernel source notation.
 
+      --omit-platform
+        Exclude the platform from the serialized dill file.
+
       --bytecode
         Generate bytecode. Supported only for SDK platform compilation.
 
diff --git a/pkg/front_end/tool/_fasta/command_line.dart b/pkg/front_end/tool/_fasta/command_line.dart
index 6c35efb..f31ab71 100644
--- a/pkg/front_end/tool/_fasta/command_line.dart
+++ b/pkg/front_end/tool/_fasta/command_line.dart
@@ -239,6 +239,7 @@
   "--compile-sdk": Uri,
   "--dump-ir": false,
   "--exclude-source": false,
+  "--omit-platform": false,
   "--fatal": ",",
   "--help": false,
   "--legacy": "--legacy-mode",
@@ -308,6 +309,8 @@
 
   final bool excludeSource = options["--exclude-source"];
 
+  final bool omitPlatform = options["--omit-platform"];
+
   final Uri packages = options["--packages"];
 
   final Set<String> fatal =
@@ -367,6 +370,7 @@
           ..throwOnWarningsForDebugging = warningsAreFatal
           ..embedSourceText = !excludeSource
           ..debugDump = dumpIr
+          ..omitPlatform = omitPlatform
           ..verbose = verbose
           ..verify = verify
           ..bytecode = bytecode,
@@ -401,6 +405,7 @@
     ..throwOnWarningsForDebugging = warningsAreFatal
     ..embedSourceText = !excludeSource
     ..debugDump = dumpIr
+    ..omitPlatform = omitPlatform
     ..verbose = verbose
     ..verify = verify;
 
diff --git a/pkg/front_end/tool/_fasta/entry_points.dart b/pkg/front_end/tool/_fasta/entry_points.dart
index 22d2418..c5dea7c 100644
--- a/pkg/front_end/tool/_fasta/entry_points.dart
+++ b/pkg/front_end/tool/_fasta/entry_points.dart
@@ -163,7 +163,7 @@
       options.sdkSummaryComponent = platformComponent;
     }
     CompileTask task = new CompileTask(c, ticker);
-    await task.compile(sansPlatform: true);
+    await task.compile(omitPlatform: true);
     CanonicalName root = platformComponent.root;
     for (Library library in platformComponent.libraries) {
       library.parent = platformComponent;
@@ -210,7 +210,7 @@
       }
       CompileTask task =
           new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
-      return await task.compile();
+      return await task.compile(omitPlatform: c.options.omitPlatform);
     });
   });
 }
@@ -252,7 +252,7 @@
     return kernelTarget;
   }
 
-  Future<Uri> compile({bool sansPlatform: false}) async {
+  Future<Uri> compile({bool omitPlatform: false}) async {
     KernelTarget kernelTarget = await buildOutline();
     Uri uri = c.options.output;
     Component component =
@@ -261,7 +261,7 @@
       printComponentText(component,
           libraryFilter: kernelTarget.isSourceLibrary);
     }
-    if (sansPlatform) {
+    if (omitPlatform) {
       component.computeCanonicalNames();
       Component userCode = new Component(
           nameRoot: component.root,