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 = path.relative( |
23 path.normalize(path.join(toolDir, '..', 'test', 'generated_sdk'))); | 23 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 | |
29 inputExample = path.join(toolDir, 'min_sdk'); | |
30 outExample = path.join(toolDir, 'out', 'min_sdk'); | |
31 print('\$ $self $inputExample $outExample'); | |
32 exit(1); | 28 exit(1); |
33 } | 29 } |
34 | 30 |
35 var input = argv[0]; | 31 var input = argv[0]; |
36 var sdkLibIn = path.join(input, 'lib'); | 32 var sdkLibIn = path.join(input, 'lib'); |
37 var patchIn = path.join(input, 'patch'); | 33 var patchIn = path.join(input, 'patch'); |
38 var privateIn = path.join(input, 'private'); | 34 var privateIn = path.join(input, 'private'); |
39 var sdkOut = path.join(argv[1], 'lib'); | 35 var sdkOut = path.join(argv[1], 'lib'); |
40 | 36 |
41 var INTERNAL_PATH = '_internal/compiler/js_lib/'; | 37 var INTERNAL_PATH = '_internal/compiler/js_lib/'; |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 if (diff != 0) return diff; | 427 if (diff != 0) return diff; |
432 return end - other.end; | 428 return end - other.end; |
433 } | 429 } |
434 } | 430 } |
435 | 431 |
436 List<SdkLibrary> _getSdkLibraries(String contents) { | 432 List<SdkLibrary> _getSdkLibraries(String contents) { |
437 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); | 433 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); |
438 parseCompilationUnit(contents).accept(libraryBuilder); | 434 parseCompilationUnit(contents).accept(libraryBuilder); |
439 return libraryBuilder.librariesMap.sdkLibraries; | 435 return libraryBuilder.librariesMap.sdkLibraries; |
440 } | 436 } |
OLD | NEW |