| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.source.embedder; | 5 library analyzer.source.embedder; |
| 6 | 6 |
| 7 import 'dart:collection' show HashMap; | 7 import 'dart:collection' show HashMap; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| 11 import 'package:analyzer/source/package_map_provider.dart' |
| 12 show PackageMapProvider; |
| 11 import 'package:analyzer/src/context/context.dart'; | 13 import 'package:analyzer/src/context/context.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/generated/java_core.dart'; | 15 import 'package:analyzer/src/generated/java_core.dart'; |
| 14 import 'package:analyzer/src/generated/java_engine.dart'; | 16 import 'package:analyzer/src/generated/java_engine.dart'; |
| 15 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; | 17 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; |
| 16 import 'package:analyzer/src/generated/sdk.dart'; | 18 import 'package:analyzer/src/generated/sdk.dart'; |
| 17 import 'package:analyzer/src/generated/source.dart'; | 19 import 'package:analyzer/src/generated/source.dart'; |
| 18 import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource; | 20 import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource; |
| 19 import 'package:yaml/yaml.dart'; | 21 import 'package:yaml/yaml.dart'; |
| 20 | 22 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 String filePath = srcPath.replaceAll('/', JavaFile.separator); | 147 String filePath = srcPath.replaceAll('/', JavaFile.separator); |
| 146 try { | 148 try { |
| 147 JavaFile file = new JavaFile(filePath); | 149 JavaFile file = new JavaFile(filePath); |
| 148 return new FileBasedSource(file, parseUriWithException(dartUri)); | 150 return new FileBasedSource(file, parseUriWithException(dartUri)); |
| 149 } on URISyntaxException { | 151 } on URISyntaxException { |
| 150 return null; | 152 return null; |
| 151 } | 153 } |
| 152 } | 154 } |
| 153 } | 155 } |
| 154 | 156 |
| 155 /// Given the [embedderYamls] from [EmbedderYamlLocator] check each one for the | 157 /// Given the 'embedderYamls' from [EmbedderYamlLocator] check each one for the |
| 156 /// top level key 'embedded_libs'. Under the 'embedded_libs' key are key value | 158 /// top level key 'embedded_libs'. Under the 'embedded_libs' key are key value |
| 157 /// pairs. Each key is a 'dart:' library uri and each value is a path | 159 /// pairs. Each key is a 'dart:' library uri and each value is a path |
| 158 /// (relative to the directory containing `_embedder.yaml`) to a dart script | 160 /// (relative to the directory containing `_embedder.yaml`) to a dart script |
| 159 /// for the given library. For example: | 161 /// for the given library. For example: |
| 160 /// | 162 /// |
| 161 /// embedded_libs: | 163 /// embedded_libs: |
| 162 /// 'dart:io': '../../sdk/io/io.dart' | 164 /// 'dart:io': '../../sdk/io/io.dart' |
| 163 /// | 165 /// |
| 164 /// If a key doesn't begin with `dart:` it is ignored. | 166 /// If a key doesn't begin with `dart:` it is ignored. |
| 165 /// | 167 /// |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 String _readEmbedderYaml(Folder libDir) { | 289 String _readEmbedderYaml(Folder libDir) { |
| 288 File file = libDir.getChild(EMBEDDER_FILE_NAME); | 290 File file = libDir.getChild(EMBEDDER_FILE_NAME); |
| 289 try { | 291 try { |
| 290 return file.readAsStringSync(); | 292 return file.readAsStringSync(); |
| 291 } on FileSystemException { | 293 } on FileSystemException { |
| 292 // File can't be read. | 294 // File can't be read. |
| 293 return null; | 295 return null; |
| 294 } | 296 } |
| 295 } | 297 } |
| 296 } | 298 } |
| OLD | NEW |