mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:10:22 +00:00
5c2ca380a4
Change-Id: Ie9c7548dc81b58db0c1149124db79e4cf1430cc1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239723 Reviewed-by: Nate Biggs <natebiggs@google.com> Reviewed-by: Joshua Litt <joshualitt@google.com> Commit-Queue: Stephen Adams <sra@google.com>
54 lines
1.1 KiB
Dart
54 lines
1.1 KiB
Dart
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// @dart = 2.10
|
|
|
|
library dart2js.profile_many;
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:compiler/src/dart2js.dart' as cmdline;
|
|
|
|
const String USAGE = """
|
|
Usage: dart2js_profile_many.dart [OPTIONS] [FILES]
|
|
|
|
Invokes dart2js separately for each file using the given options.
|
|
This is for profiling multiple compilations in the Dart Observatory.
|
|
""";
|
|
|
|
printUsage() {
|
|
print(USAGE);
|
|
}
|
|
|
|
void main(List<String> args) {
|
|
var options = <String>[];
|
|
var files = <String>[];
|
|
|
|
for (String arg in args) {
|
|
if (arg.startsWith('-')) {
|
|
options.add(arg);
|
|
} else {
|
|
files.add(arg);
|
|
}
|
|
}
|
|
|
|
if (files.length == 0) {
|
|
printUsage();
|
|
return;
|
|
}
|
|
|
|
cmdline.exitFunc = (code) {
|
|
throw "Exit with code $code";
|
|
};
|
|
|
|
Future.forEach(files, (String file) {
|
|
List subargs = [];
|
|
subargs.addAll(options);
|
|
subargs.add(file);
|
|
return cmdline.compilerMain(subargs).catchError((e) {});
|
|
}).then((_) {
|
|
print("Done");
|
|
});
|
|
}
|