| 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 library analyzer.src.context.context_builder; | 5 library analyzer.src.context.context_builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:core'; | 8 import 'dart:core'; |
| 9 | 9 |
| 10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
| 11 import 'package:analyzer/file_system/file_system.dart'; | 11 import 'package:analyzer/file_system/file_system.dart'; |
| 12 import 'package:analyzer/plugin/resolver_provider.dart'; | 12 import 'package:analyzer/plugin/resolver_provider.dart'; |
| 13 import 'package:analyzer/source/analysis_options_provider.dart'; | 13 import 'package:analyzer/source/analysis_options_provider.dart'; |
| 14 import 'package:analyzer/source/package_map_resolver.dart'; | 14 import 'package:analyzer/source/package_map_resolver.dart'; |
| 15 import 'package:analyzer/src/command_line/arguments.dart' | 15 import 'package:analyzer/src/command_line/arguments.dart' |
| 16 show applyAnalysisOptionFlags; | 16 show applyAnalysisOptionFlags; |
| 17 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 17 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
| 18 import 'package:analyzer/src/generated/bazel.dart'; | 18 import 'package:analyzer/src/generated/bazel.dart'; |
| 19 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 20 import 'package:analyzer/src/generated/gn.dart'; |
| 20 import 'package:analyzer/src/generated/sdk.dart'; | 21 import 'package:analyzer/src/generated/sdk.dart'; |
| 21 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
| 22 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 23 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| 23 import 'package:analyzer/src/summary/pub_summary.dart'; | 24 import 'package:analyzer/src/summary/pub_summary.dart'; |
| 24 import 'package:analyzer/src/summary/summary_sdk.dart'; | 25 import 'package:analyzer/src/summary/summary_sdk.dart'; |
| 25 import 'package:analyzer/src/task/options.dart'; | 26 import 'package:analyzer/src/task/options.dart'; |
| 26 import 'package:args/args.dart'; | 27 import 'package:args/args.dart'; |
| 27 import 'package:package_config/packages.dart'; | 28 import 'package:package_config/packages.dart'; |
| 28 import 'package:package_config/packages_file.dart'; | 29 import 'package:package_config/packages_file.dart'; |
| 29 import 'package:package_config/src/packages_impl.dart'; | 30 import 'package:package_config/src/packages_impl.dart'; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 BazelWorkspace.find(resourceProvider, rootPath); | 202 BazelWorkspace.find(resourceProvider, rootPath); |
| 202 if (bazelWorkspace != null) { | 203 if (bazelWorkspace != null) { |
| 203 List<UriResolver> resolvers = <UriResolver>[ | 204 List<UriResolver> resolvers = <UriResolver>[ |
| 204 new DartUriResolver(findSdk(null, options)), | 205 new DartUriResolver(findSdk(null, options)), |
| 205 new BazelPackageUriResolver(bazelWorkspace), | 206 new BazelPackageUriResolver(bazelWorkspace), |
| 206 new BazelFileUriResolver(bazelWorkspace) | 207 new BazelFileUriResolver(bazelWorkspace) |
| 207 ]; | 208 ]; |
| 208 return new SourceFactory(resolvers, null, resourceProvider); | 209 return new SourceFactory(resolvers, null, resourceProvider); |
| 209 } | 210 } |
| 210 | 211 |
| 212 GnWorkspace gnWorkspace = GnWorkspace.find(resourceProvider, rootPath); |
| 213 if (gnWorkspace != null) { |
| 214 DartSdk sdk = findSdk(gnWorkspace.packageMap, options); |
| 215 List<UriResolver> resolvers = <UriResolver>[ |
| 216 new DartUriResolver(sdk), |
| 217 new GnPackageUriResolver(gnWorkspace), |
| 218 new GnFileUriResolver(gnWorkspace) |
| 219 ]; |
| 220 return new SourceFactory(resolvers, null, resourceProvider); |
| 221 } |
| 222 |
| 211 Packages packages = createPackageMap(rootPath); | 223 Packages packages = createPackageMap(rootPath); |
| 212 Map<String, List<Folder>> packageMap = convertPackagesToMap(packages); | 224 Map<String, List<Folder>> packageMap = convertPackagesToMap(packages); |
| 213 List<UriResolver> resolvers = <UriResolver>[ | 225 List<UriResolver> resolvers = <UriResolver>[ |
| 214 new DartUriResolver(findSdk(packageMap, options)), | 226 new DartUriResolver(findSdk(packageMap, options)), |
| 215 new PackageMapUriResolver(resourceProvider, packageMap), | 227 new PackageMapUriResolver(resourceProvider, packageMap), |
| 216 new ResourceUriResolver(resourceProvider) | 228 new ResourceUriResolver(resourceProvider) |
| 217 ]; | 229 ]; |
| 218 return new SourceFactory(resolvers, packages, resourceProvider); | 230 return new SourceFactory(resolvers, packages, resourceProvider); |
| 219 } | 231 } |
| 220 | 232 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 String _readEmbedderYaml(Folder libDir) { | 643 String _readEmbedderYaml(Folder libDir) { |
| 632 File file = libDir.getChild(EMBEDDER_FILE_NAME); | 644 File file = libDir.getChild(EMBEDDER_FILE_NAME); |
| 633 try { | 645 try { |
| 634 return file.readAsStringSync(); | 646 return file.readAsStringSync(); |
| 635 } on FileSystemException { | 647 } on FileSystemException { |
| 636 // File can't be read. | 648 // File can't be read. |
| 637 return null; | 649 return null; |
| 638 } | 650 } |
| 639 } | 651 } |
| 640 } | 652 } |
| OLD | NEW |