[observatory] Include observatory main.dart.js.map with debug build.

Having this map file allows for the browser to report source line numbers in case of exception thrown by Observatory code.

Change-Id: Ia47789b89b3a14ca6513143bf9d4cc9c4a8cc1fb
Reviewed-on: https://dart-review.googlesource.com/68847
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
diff --git a/runtime/observatory/BUILD.gn b/runtime/observatory/BUILD.gn
index 599a35f..89b4836 100644
--- a/runtime/observatory/BUILD.gn
+++ b/runtime/observatory/BUILD.gn
@@ -19,6 +19,9 @@
   outputs = [
     output,
   ]
+  if (is_debug) {
+    outputs += [ "$target_gen_dir/observatory/web/main.dart.js.map" ]
+  }
 
   version_string = exec_script("../../tools/make_version.py",
                                [
@@ -60,7 +63,6 @@
   "*.concat.js",
   "*.dart",
   "*.log",
-  "*.map",
   "*.precompiled.js",
   "*.scriptUrls",
   "*_buildLogs*",
@@ -78,6 +80,10 @@
   "webcomponents.*",
 ]
 
+if (!is_debug) {
+  observatory_ignore_patterns += [ "*.map" ]
+}
+
 # The ignore_patterns entry in the scopes accepted by copy_trees() is a
 # string of comma delimited patterns.
 observatory_ignore_string = "\$sdk"
@@ -157,8 +163,11 @@
   sources = [
     "$target_gen_dir/observatory/web/main.dart.js",
   ]
+  if (is_debug) {
+    sources += [ "$target_gen_dir/observatory/web/main.dart.js.map" ]
+  }
   outputs = [
-    "$target_out_dir/observatory/deployed/web/main.dart.js",
+    "$target_out_dir/observatory/deployed/web/{{source_file_part}}",
   ]
 }