Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3911)

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart

Issue 194863003: Don't include source maps in release mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't include source maps at all in release builds. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
index 176d4908d15f398fa0a80618d5b1ba486f967482..8e000571b53ab47e6ecbce27b9b2e5ed55293fb4 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
@@ -93,7 +93,8 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
return null;
}
- var provider = new _BarbackCompilerProvider(_environment, transform);
+ var provider = new _BarbackCompilerProvider(_environment, transform,
+ generateSourceMaps: _settings.mode != BarbackMode.RELEASE);
nweiz 2014/03/11 20:10:30 It might be nice to add a "sourceMaps" configurati
Bob Nystrom 2014/03/11 20:43:31 I'm a little worried that we have too many flags r
// Create a "path" to the entrypoint script. The entrypoint may not
// actually be on disk, but this gives dart2js a root to resolve
@@ -122,7 +123,9 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
suppressHints: _configBool('suppressHints'),
suppressPackageWarnings: _configBool(
'suppressPackageWarnings', defaultsTo: true),
- terse: _configBool('terse'))).then((_) {
+ terse: _configBool('terse'),
+ includeSourceMapUrls: _settings.mode != BarbackMode.RELEASE))
+ .then((_) {
stopwatch.stop();
transform.logger.info("Took ${stopwatch.elapsed} to compile $id.");
});
@@ -211,6 +214,8 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
/// errors.
var _isAborting = false;
+ final bool generateSourceMaps;
+
compiler.Diagnostic _lastKind = null;
static final int _FATAL =
@@ -220,7 +225,8 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
compiler.Diagnostic.INFO.ordinal |
compiler.Diagnostic.VERBOSE_INFO.ordinal;
- _BarbackCompilerProvider(this._environment, this._transform);
+ _BarbackCompilerProvider(this._environment, this._transform,
+ {this.generateSourceMaps: true});
/// A [CompilerInputProvider] for dart2js.
Future<String> provideInput(Uri resourceUri) {
@@ -244,6 +250,11 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
// for it.
assert(name == "");
+ // TODO(rnystrom): Do this more cleanly. See: #17403.
+ if (!generateSourceMaps && extension.endsWith(".map")) {
+ return new NullSink<String>();
+ }
+
var primaryId = _transform.primaryInput.id;
var id = new AssetId(primaryId.package, "${primaryId.path}.$extension");
@@ -356,3 +367,11 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
return null;
}
}
+
+/// An [EventSink] that discards all data. Provided to dart2js when we don't
+/// want an actual output.
+class NullSink<T> implements EventSink<T> {
+ void add(T event) {}
+ void addError(errorEvent, [StackTrace stackTrace]) {}
+ void close() {}
+}

Powered by Google App Engine
This is Rietveld 408576698