| 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 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |