Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: pkg/analysis_server/lib/src/server/driver.dart

Issue 1830703002: Pass AnalysisOptions into SdkCreator, disable changing afterwards. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 driver; 5 library driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math'; 9 import 'dart:math';
10 10
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 manager.processPlugins(plugins); 392 manager.processPlugins(plugins);
393 393
394 JavaFile defaultSdkDirectory; 394 JavaFile defaultSdkDirectory;
395 if (results[SDK_OPTION] != null) { 395 if (results[SDK_OPTION] != null) {
396 defaultSdkDirectory = new JavaFile(results[SDK_OPTION]); 396 defaultSdkDirectory = new JavaFile(results[SDK_OPTION]);
397 } else { 397 } else {
398 // No path to the SDK was provided. 398 // No path to the SDK was provided.
399 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess. 399 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess.
400 defaultSdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; 400 defaultSdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory;
401 } 401 }
402 SdkCreator defaultSdkCreator = 402 SdkCreator defaultSdkCreator = (AnalysisOptions options) {
403 () => new DirectoryBasedDartSdk(defaultSdkDirectory); 403 DirectoryBasedDartSdk sdk =
404 new DirectoryBasedDartSdk(defaultSdkDirectory);
405 sdk.analysisOptions = options;
406 return sdk;
407 };
404 // TODO(brianwilkerson) It would be nice to avoid creating an SDK that 408 // TODO(brianwilkerson) It would be nice to avoid creating an SDK that
405 // cannot be re-used, but the SDK is needed to create a package map provider 409 // cannot be re-used, but the SDK is needed to create a package map provider
406 // in the case where we need to run `pub` in order to get the package map. 410 // in the case where we need to run `pub` in order to get the package map.
407 DirectoryBasedDartSdk defaultSdk = defaultSdkCreator(); 411 DirectoryBasedDartSdk defaultSdk = defaultSdkCreator(null);
408 // 412 //
409 // Initialize the instrumentation service. 413 // Initialize the instrumentation service.
410 // 414 //
411 String logFilePath = results[INSTRUMENTATION_LOG_FILE]; 415 String logFilePath = results[INSTRUMENTATION_LOG_FILE];
412 if (logFilePath != null) { 416 if (logFilePath != null) {
413 _rollLogFiles(logFilePath, 5); 417 _rollLogFiles(logFilePath, 5);
414 FileInstrumentationServer fileBasedServer = 418 FileInstrumentationServer fileBasedServer =
415 new FileInstrumentationServer(logFilePath); 419 new FileInstrumentationServer(logFilePath);
416 instrumentationServer = instrumentationServer != null 420 instrumentationServer = instrumentationServer != null
417 ? new MulticastInstrumentationServer( 421 ? new MulticastInstrumentationServer(
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 */ 602 */
599 static void _rollLogFiles(String path, int numOld) { 603 static void _rollLogFiles(String path, int numOld) {
600 for (int i = numOld - 1; i >= 0; i--) { 604 for (int i = numOld - 1; i >= 0; i--) {
601 try { 605 try {
602 String oldPath = i == 0 ? path : '$path.$i'; 606 String oldPath = i == 0 ? path : '$path.$i';
603 new File(oldPath).renameSync('$path.${i+1}'); 607 new File(oldPath).renameSync('$path.${i+1}');
604 } catch (e) {} 608 } catch (e) {}
605 } 609 }
606 } 610 }
607 } 611 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698