OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 context.directory.manager; | 5 library context.directory.manager; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:core'; | 10 import 'dart:core'; |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 } | 981 } |
982 _addSourceFiles(changeSet, child, info); | 982 _addSourceFiles(changeSet, child, info); |
983 } | 983 } |
984 } | 984 } |
985 } | 985 } |
986 | 986 |
987 void _checkForAnalysisOptionsUpdate( | 987 void _checkForAnalysisOptionsUpdate( |
988 String path, ContextInfo info, ChangeType changeType) { | 988 String path, ContextInfo info, ChangeType changeType) { |
989 if (AnalysisEngine.isAnalysisOptionsFileName(path, pathContext)) { | 989 if (AnalysisEngine.isAnalysisOptionsFileName(path, pathContext)) { |
990 if (enableNewAnalysisDriver) { | 990 if (enableNewAnalysisDriver) { |
991 // TODO(brianwilkerson) Implement this. | 991 AnalysisDriver driver = info.analysisDriver; |
992 // AnalysisDriver driver = info.analysisDriver; | 992 String contextRoot = info.folder.path; |
993 // String contextRoot = info.folder.path; | 993 ContextBuilder builder = |
994 // ContextBuilder builder = | 994 callbacks.createContextBuilder(info.folder, defaultContextOptions); |
995 // callbacks.createContextBuilder(info.folder, defaultContextOptions); | 995 AnalysisOptions options = builder.getAnalysisOptions(contextRoot); |
996 // AnalysisOptions options = builder.getAnalysisOptions(contextRoot); | 996 SourceFactory factory = |
997 // driver.analysisOptions = options; | 997 builder.createSourceFactory(contextRoot, options); |
998 // driver.sourceFactory = builder.createSourceFactory(contextRoot, option
s); | 998 driver.configure(analysisOptions: options, sourceFactory: factory); |
999 // TODO(brianwilkerson) Set exclusion patterns. | 999 // TODO(brianwilkerson) Set exclusion patterns. |
1000 } else { | 1000 } else { |
1001 var analysisContext = info.context; | 1001 var analysisContext = info.context; |
1002 if (analysisContext is context.AnalysisContextImpl) { | 1002 if (analysisContext is context.AnalysisContextImpl) { |
1003 Map<String, Object> options = | 1003 Map<String, Object> options = |
1004 readOptions(info.folder, info.disposition.packages); | 1004 readOptions(info.folder, info.disposition.packages); |
1005 processOptionsForContext(info, options, | 1005 processOptionsForContext(info, options, |
1006 optionsRemoved: changeType == ChangeType.REMOVE); | 1006 optionsRemoved: changeType == ChangeType.REMOVE); |
1007 analysisContext.sourceFactory = _createSourceFactory( | 1007 analysisContext.sourceFactory = _createSourceFactory( |
1008 analysisContext, analysisContext.analysisOptions, info.folder); | 1008 analysisContext, analysisContext.analysisOptions, info.folder); |
1009 callbacks.applyChangesToContext(info.folder, new ChangeSet()); | 1009 callbacks.applyChangesToContext(info.folder, new ChangeSet()); |
1010 } | 1010 } |
1011 } | 1011 } |
1012 } | 1012 } |
1013 } | 1013 } |
1014 | 1014 |
1015 void _checkForPackagespecUpdate( | 1015 void _checkForPackagespecUpdate( |
1016 String path, ContextInfo info, Folder folder) { | 1016 String path, ContextInfo info, Folder folder) { |
1017 // Check to see if this is the .packages file for this context and if so, | 1017 // Check to see if this is the .packages file for this context and if so, |
1018 // update the context's source factory. | 1018 // update the context's source factory. |
1019 if (absolutePathContext.basename(path) == PACKAGE_SPEC_NAME) { | 1019 if (absolutePathContext.basename(path) == PACKAGE_SPEC_NAME) { |
1020 String contextRoot = info.folder.path; | 1020 String contextRoot = info.folder.path; |
1021 ContextBuilder builder = | 1021 ContextBuilder builder = |
1022 callbacks.createContextBuilder(info.folder, defaultContextOptions); | 1022 callbacks.createContextBuilder(info.folder, defaultContextOptions); |
1023 AnalysisOptions options = builder.getAnalysisOptions(contextRoot); | 1023 AnalysisOptions options = builder.getAnalysisOptions(contextRoot); |
1024 SourceFactory factory = builder.createSourceFactory(contextRoot, options); | 1024 SourceFactory factory = builder.createSourceFactory(contextRoot, options); |
1025 info.context.analysisOptions = options; | 1025 if (enableNewAnalysisDriver) { |
1026 info.context.sourceFactory = factory; | 1026 AnalysisDriver driver = info.analysisDriver; |
| 1027 driver.configure(analysisOptions: options, sourceFactory: factory); |
| 1028 } else { |
| 1029 info.context.analysisOptions = options; |
| 1030 info.context.sourceFactory = factory; |
| 1031 } |
1027 } | 1032 } |
1028 } | 1033 } |
1029 | 1034 |
1030 /** | 1035 /** |
1031 * Compute the set of files that are being flushed, this is defined as | 1036 * Compute the set of files that are being flushed, this is defined as |
1032 * the set of sources in the removed context (context.sources), that are | 1037 * the set of sources in the removed context (context.sources), that are |
1033 * orphaned by this context being removed (no other context includes this | 1038 * orphaned by this context being removed (no other context includes this |
1034 * file.) | 1039 * file.) |
1035 */ | 1040 */ |
1036 List<String> _computeFlushedFiles(ContextInfo info) { | 1041 List<String> _computeFlushedFiles(ContextInfo info) { |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 } | 1951 } |
1947 return _embedderLocator; | 1952 return _embedderLocator; |
1948 } | 1953 } |
1949 | 1954 |
1950 @override | 1955 @override |
1951 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { | 1956 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { |
1952 return _sdkExtensionFinder ??= | 1957 return _sdkExtensionFinder ??= |
1953 new SdkExtensionFinder(buildPackageMap(resourceProvider)); | 1958 new SdkExtensionFinder(buildPackageMap(resourceProvider)); |
1954 } | 1959 } |
1955 } | 1960 } |
OLD | NEW |