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

Side by Side Diff: packages/analyzer/tool/summary/build_sdk_summaries.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 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
« no previous file with comments | « packages/analyzer/tool/generate_files ('k') | packages/analyzer/tool/summary/check_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import 'dart:io';
2
3 import 'package:analyzer/file_system/physical_file_system.dart';
4 import 'package:analyzer/src/dart/sdk/sdk.dart';
5 import 'package:analyzer/src/summary/summary_file_builder.dart';
6
7 main(List<String> args) {
8 String command;
9 String outFilePath;
10 String sdkPath;
11 if (args.length == 2) {
12 command = args[0];
13 outFilePath = args[1];
14 } else if (args.length == 3) {
15 command = args[0];
16 outFilePath = args[1];
17 sdkPath = args[2];
18 } else {
19 _printUsage();
20 exitCode = 1;
21 return;
22 }
23
24 //
25 // Validate the SDK path.
26 //
27 sdkPath ??= FolderBasedDartSdk
28 .defaultSdkDirectory(PhysicalResourceProvider.INSTANCE)
29 .path;
30 if (!FileSystemEntity.isDirectorySync('$sdkPath/lib')) {
31 print("'$sdkPath/lib' does not exist.");
32 _printUsage();
33 return;
34 }
35
36 //
37 // Handle commands.
38 //
39 if (command == 'build-spec') {
40 _buildSummary(sdkPath, outFilePath, false);
41 } else if (command == 'build-strong') {
42 _buildSummary(sdkPath, outFilePath, true);
43 } else {
44 _printUsage();
45 return;
46 }
47 }
48
49 /**
50 * The name of the SDK summaries builder application.
51 */
52 const BINARY_NAME = "build_sdk_summaries";
53
54 void _buildSummary(String sdkPath, String outPath, bool strong) {
55 String modeName = strong ? 'strong' : 'spec';
56 print('Generating $modeName mode summary.');
57 Stopwatch sw = new Stopwatch()..start();
58 List<int> bytes = new SummaryBuilder.forSdk(sdkPath, strong).build();
59 new File(outPath).writeAsBytesSync(bytes, mode: FileMode.WRITE_ONLY);
60 print('\tDone in ${sw.elapsedMilliseconds} ms.');
61 }
62
63 /**
64 * Print information about how to use the SDK summaries builder.
65 */
66 void _printUsage() {
67 print('Usage: $BINARY_NAME command arguments');
68 print('Where command can be one of the following:');
69 print(' build-spec output_file [sdk_path]');
70 print(' Generate spec mode summary file.');
71 print(' build-strong output_file [sdk_path]');
72 print(' Generate strong mode summary file.');
73 }
OLDNEW
« no previous file with comments | « packages/analyzer/tool/generate_files ('k') | packages/analyzer/tool/summary/check_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698