| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:args/args.dart' show ArgParser, ArgResults; | 5 import 'package:args/args.dart' show ArgParser, ArgResults; |
| 6 import 'package:analyzer/analyzer.dart' | 6 import 'package:analyzer/analyzer.dart' |
| 7 show AnalysisError, CompilationUnit, ErrorSeverity; | 7 show AnalysisError, CompilationUnit, ErrorSeverity; |
| 8 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 8 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
| 9 import 'package:analyzer/src/generated/java_engine.dart' show AnalysisException; | 9 import 'package:analyzer/src/generated/java_engine.dart' show AnalysisException; |
| 10 import 'package:analyzer/src/generated/source_io.dart' show Source, SourceKind; | 10 import 'package:analyzer/src/generated/source_io.dart' show Source, SourceKind; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 help: 'Compile code even if it has errors. ಠ_ಠ\n' | 189 help: 'Compile code even if it has errors. ಠ_ಠ\n' |
| 190 'This has undefined behavior!', | 190 'This has undefined behavior!', |
| 191 defaultsTo: false); | 191 defaultsTo: false); |
| 192 } | 192 } |
| 193 | 193 |
| 194 /// A unit of Dart code that can be built into a single JavaScript module. | 194 /// A unit of Dart code that can be built into a single JavaScript module. |
| 195 class BuildUnit { | 195 class BuildUnit { |
| 196 /// The name of this module. | 196 /// The name of this module. |
| 197 final String name; | 197 final String name; |
| 198 | 198 |
| 199 /// Build root. All library names are relative to this path/prefix. |
| 200 final String buildRoot; |
| 201 |
| 199 /// The list of sources in this module. | 202 /// The list of sources in this module. |
| 200 /// | 203 /// |
| 201 /// The set of Dart files can be arbitrarily large, but it must contain | 204 /// The set of Dart files can be arbitrarily large, but it must contain |
| 202 /// complete libraries including all of their parts, as well as all libraries | 205 /// complete libraries including all of their parts, as well as all libraries |
| 203 /// that are part of a library cycle. | 206 /// that are part of a library cycle. |
| 204 final List<String> sources; | 207 final List<String> sources; |
| 205 | 208 |
| 206 /// Given an imported library URI, this will determine to what Dart/JS module | 209 /// Given an imported library URI, this will determine to what Dart/JS module |
| 207 /// it belongs to. | 210 /// it belongs to. |
| 208 // TODO(jmesserly): we should replace this with another way of tracking | 211 // TODO(jmesserly): we should replace this with another way of tracking |
| 209 // build units. | 212 // build units. |
| 210 final Func1<Source, String> libraryToModule; | 213 final Func1<Source, String> libraryToModule; |
| 211 | 214 |
| 212 BuildUnit(this.name, this.sources, this.libraryToModule); | 215 BuildUnit(this.name, this.buildRoot, this.sources, this.libraryToModule); |
| 213 } | 216 } |
| 214 | 217 |
| 215 /// The output of Dart->JS compilation. | 218 /// The output of Dart->JS compilation. |
| 216 /// | 219 /// |
| 217 /// This contains the file contents of the JS module, as well as a list of | 220 /// This contains the file contents of the JS module, as well as a list of |
| 218 /// Dart libraries that are contained in this module. | 221 /// Dart libraries that are contained in this module. |
| 219 class JSModuleFile { | 222 class JSModuleFile { |
| 220 /// The name of this module. | 223 /// The name of this module. |
| 221 final String name; | 224 final String name; |
| 222 | 225 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 262 |
| 260 var map = new Map.from(this.sourceMap); | 263 var map = new Map.from(this.sourceMap); |
| 261 List list = new List.from(map['sources']); | 264 List list = new List.from(map['sources']); |
| 262 map['sources'] = list; | 265 map['sources'] = list; |
| 263 for (int i = 0; i < list.length; i++) { | 266 for (int i = 0; i < list.length; i++) { |
| 264 list[i] = path.relative(list[i], from: dir); | 267 list[i] = path.relative(list[i], from: dir); |
| 265 } | 268 } |
| 266 return map; | 269 return map; |
| 267 } | 270 } |
| 268 } | 271 } |
| OLD | NEW |