| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 /// Command line tool to merge the SDK libraries and our patch files. | 6 /// Command line tool to merge the SDK libraries and our patch files. |
| 7 /// This is currently designed as an offline tool, but we could automate it. | 7 /// This is currently designed as an offline tool, but we could automate it. |
| 8 | 8 |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
| 11 | 11 |
| 12 import 'package:analyzer/analyzer.dart'; | 12 import 'package:analyzer/analyzer.dart'; |
| 13 import 'package:analyzer/src/generated/sdk.dart'; | 13 import 'package:analyzer/src/generated/sdk.dart'; |
| 14 import 'package:path/path.dart' as path; | 14 import 'package:path/path.dart' as path; |
| 15 | 15 |
| 16 void main(List<String> argv) { | 16 void main(List<String> argv) { |
| 17 if (argv.length < 2) { | 17 if (argv.length < 2) { |
| 18 var self = path.relative(path.fromUri(Platform.script)); | 18 var self = path.relative(path.fromUri(Platform.script)); |
| 19 var toolDir = path.relative(path.dirname(path.fromUri(Platform.script))); | 19 var toolDir = path.relative(path.dirname(path.fromUri(Platform.script))); |
| 20 | 20 |
| 21 var inputExample = path.join(toolDir, 'input_sdk'); | 21 var inputExample = path.join(toolDir, 'input_sdk'); |
| 22 var outExample = path.relative( | 22 var outExample = |
| 23 path.normalize(path.join('gen', 'patched_sdk'))); | 23 path.relative(path.normalize(path.join('gen', 'patched_sdk'))); |
| 24 | 24 |
| 25 print('Usage: $self INPUT_DIR OUTPUT_DIR'); | 25 print('Usage: $self INPUT_DIR OUTPUT_DIR'); |
| 26 print('For example:'); | 26 print('For example:'); |
| 27 print('\$ $self $inputExample $outExample'); | 27 print('\$ $self $inputExample $outExample'); |
| 28 exit(1); | 28 exit(1); |
| 29 } | 29 } |
| 30 | 30 |
| 31 var input = argv[0]; | 31 var input = argv[0]; |
| 32 var sdkLibIn = path.join(input, 'lib'); | 32 var sdkLibIn = path.join(input, 'lib'); |
| 33 var patchIn = path.join(input, 'patch'); | 33 var patchIn = path.join(input, 'patch'); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 if (diff != 0) return diff; | 427 if (diff != 0) return diff; |
| 428 return end - other.end; | 428 return end - other.end; |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 | 431 |
| 432 List<SdkLibrary> _getSdkLibraries(String contents) { | 432 List<SdkLibrary> _getSdkLibraries(String contents) { |
| 433 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); | 433 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); |
| 434 parseCompilationUnit(contents).accept(libraryBuilder); | 434 parseCompilationUnit(contents).accept(libraryBuilder); |
| 435 return libraryBuilder.librariesMap.sdkLibraries; | 435 return libraryBuilder.librariesMap.sdkLibraries; |
| 436 } | 436 } |
| OLD | NEW |