| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_impl; | 5 library analyzer_impl; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'generated/java_io.dart'; | 10 import 'generated/java_io.dart'; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void prepareAnalysisContext(JavaFile sourceFile) { | 74 void prepareAnalysisContext(JavaFile sourceFile) { |
| 75 List<UriResolver> resolvers = [new DartUriResolver(sdk), new FileUriResolver
()]; | 75 List<UriResolver> resolvers = [new DartUriResolver(sdk), new FileUriResolver
()]; |
| 76 // may be add package resolver | 76 // may be add package resolver |
| 77 { | 77 { |
| 78 JavaFile packageDirectory; | 78 JavaFile packageDirectory; |
| 79 if (options.packageRootPath != null) { | 79 if (options.packageRootPath != null) { |
| 80 packageDirectory = new JavaFile(options.packageRootPath); | 80 packageDirectory = new JavaFile(options.packageRootPath); |
| 81 } else { | 81 } else { |
| 82 packageDirectory = getPackageDirectoryFor(sourceFile); | 82 packageDirectory = getPackageDirectoryFor(sourceFile); |
| 83 } | 83 } |
| 84 print('packageDirectory: ${packageDirectory.getPath()}'); | |
| 85 if (packageDirectory != null) { | 84 if (packageDirectory != null) { |
| 86 resolvers.add(new PackageUriResolver([packageDirectory])); | 85 resolvers.add(new PackageUriResolver([packageDirectory])); |
| 87 } | 86 } |
| 88 } | 87 } |
| 89 sourceFactory = new SourceFactory.con1(contentCache, resolvers); | 88 sourceFactory = new SourceFactory.con1(contentCache, resolvers); |
| 90 context = AnalysisEngine.instance.createAnalysisContext(); | 89 context = AnalysisEngine.instance.createAnalysisContext(); |
| 91 context.sourceFactory = sourceFactory; | 90 context.sourceFactory = sourceFactory; |
| 92 } | 91 } |
| 93 | 92 |
| 94 /// Fills [sources]. | 93 /// Fills [sources]. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 JavaFile packagesDir = new JavaFile.relative(dir, "packages"); | 155 JavaFile packagesDir = new JavaFile.relative(dir, "packages"); |
| 157 if (packagesDir.exists()) { | 156 if (packagesDir.exists()) { |
| 158 return packagesDir; | 157 return packagesDir; |
| 159 } | 158 } |
| 160 dir = dir.getParentFile(); | 159 dir = dir.getParentFile(); |
| 161 } | 160 } |
| 162 // not found | 161 // not found |
| 163 return null; | 162 return null; |
| 164 } | 163 } |
| 165 } | 164 } |
| OLD | NEW |