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

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

Issue 2276033003: Correctly use sdk passed on command-line (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // No path to the SDK was provided. 418 // No path to the SDK was provided.
419 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess. 419 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess.
420 defaultSdkPath = FolderBasedDartSdk 420 defaultSdkPath = FolderBasedDartSdk
421 .defaultSdkDirectory(PhysicalResourceProvider.INSTANCE) 421 .defaultSdkDirectory(PhysicalResourceProvider.INSTANCE)
422 .path; 422 .path;
423 } 423 }
424 bool useSummaries = analysisServerOptions.fileReadMode == 'as-is'; 424 bool useSummaries = analysisServerOptions.fileReadMode == 'as-is';
425 SdkCreator defaultSdkCreator = (AnalysisOptions options) { 425 SdkCreator defaultSdkCreator = (AnalysisOptions options) {
426 PhysicalResourceProvider resourceProvider = 426 PhysicalResourceProvider resourceProvider =
427 PhysicalResourceProvider.INSTANCE; 427 PhysicalResourceProvider.INSTANCE;
428 FolderBasedDartSdk sdk = new FolderBasedDartSdk(resourceProvider, 428 FolderBasedDartSdk sdk = new FolderBasedDartSdk(
429 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)); 429 resourceProvider, resourceProvider.getFolder(defaultSdkPath));
430 sdk.analysisOptions = options; 430 sdk.analysisOptions = options;
431 sdk.useSummary = useSummaries; 431 sdk.useSummary = useSummaries;
432 return sdk; 432 return sdk;
433 }; 433 };
434 // TODO(brianwilkerson) It would be nice to avoid creating an SDK that 434 // TODO(brianwilkerson) It would be nice to avoid creating an SDK that
435 // cannot be re-used, but the SDK is needed to create a package map provider 435 // cannot be re-used, but the SDK is needed to create a package map provider
436 // in the case where we need to run `pub` in order to get the package map. 436 // in the case where we need to run `pub` in order to get the package map.
437 DartSdk defaultSdk = defaultSdkCreator(null); 437 DartSdk defaultSdk = defaultSdkCreator(null);
438 // 438 //
439 // Initialize the instrumentation service. 439 // Initialize the instrumentation service.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 */ 637 */
638 static void _rollLogFiles(String path, int numOld) { 638 static void _rollLogFiles(String path, int numOld) {
639 for (int i = numOld - 1; i >= 0; i--) { 639 for (int i = numOld - 1; i >= 0; i--) {
640 try { 640 try {
641 String oldPath = i == 0 ? path : '$path.$i'; 641 String oldPath = i == 0 ? path : '$path.$i';
642 new File(oldPath).renameSync('$path.${i+1}'); 642 new File(oldPath).renameSync('$path.${i+1}');
643 } catch (e) {} 643 } catch (e) {}
644 } 644 }
645 } 645 }
646 } 646 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698