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 library dev_compiler.tool.patch_sdk; | 8 library dev_compiler.tool.patch_sdk; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
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(Platform.script.path); | 18 var self = path.relative(path.fromUri(Platform.script)); |
19 var toolDir = path.relative(path.dirname(Platform.script.path)); | 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 = path.relative( |
23 path.normalize(path.join(toolDir, '..', 'test', 'generated_sdk'))); | 23 path.normalize(path.join(toolDir, '..', 'test', 'generated_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 | 28 |
29 inputExample = path.join(toolDir, 'min_sdk'); | 29 inputExample = path.join(toolDir, 'min_sdk'); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 if (diff != 0) return diff; | 392 if (diff != 0) return diff; |
393 return end - other.end; | 393 return end - other.end; |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 List<SdkLibrary> _getSdkLibraries(String contents) { | 397 List<SdkLibrary> _getSdkLibraries(String contents) { |
398 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); | 398 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); |
399 parseCompilationUnit(contents).accept(libraryBuilder); | 399 parseCompilationUnit(contents).accept(libraryBuilder); |
400 return libraryBuilder.librariesMap.sdkLibraries; | 400 return libraryBuilder.librariesMap.sdkLibraries; |
401 } | 401 } |
OLD | NEW |