New make.dart

This commit is contained in:
Junyuan Feng
2022-04-15 19:48:43 +08:00
parent c524db9f59
commit 9663e4174d
2 changed files with 23 additions and 14 deletions

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 112;
static const int build = 113;
static const String engine =
"Flutter 2.10.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision c860cba910 (3 weeks ago) • 2022-03-25 00:23:12 -0500\nEngine • revision 57d3bac3dd\nTools • Dart 2.16.2 • DevTools 2.9.2\n";
static const String buildAt = "2022-04-15 19:07:21.221650";
static const int modifications = 7;
static const String buildAt = "2022-04-15 19:46:15.224203";
static const int modifications = 2;
}

View File

@@ -83,7 +83,6 @@ void flutterRun(String? mode) {
}
Future<void> flutterBuild(String source, String target, bool isAndroid) async {
final startTime = DateTime.now();
final build = await getGitCommitCount();
final args = [
@@ -112,14 +111,12 @@ Future<void> flutterBuild(String source, String target, bool isAndroid) async {
}
}
print('Done.');
print('Done.\n');
} else {
print(buildResult.stderr.toString());
print('\nBuild failed with exit code $exitCode');
exit(exitCode);
}
final endTime = DateTime.now();
print('Spent time: ${endTime.difference(startTime).toString()}');
}
Future<void> flutterBuildIOS() async {
@@ -144,16 +141,28 @@ void main(List<String> args) async {
case 'run':
return flutterRun(args.length == 2 ? args[1] : null);
case 'build':
if (args.length > 1) {
final stopwatch = Stopwatch()..start();
final buildFunc = [flutterBuildIOS, flutterBuildAndroid];
await updateBuildData();
dartFormat();
if (args[1] == 'android' || args[1] == 'harmony') {
return flutterBuildAndroid();
} else if (args[1] == 'ios') {
return flutterBuildIOS();
if (args.length > 1) {
final platform = args[1];
switch (platform) {
case 'ios':
buildFunc.remove(flutterBuildIOS);
break;
case 'android':
buildFunc.remove(flutterBuildAndroid);
break;
default:
print('Unknown platform: $platform');
exit(1);
}
print('unkonwn build arg: ${args[1]}');
}
for (final func in buildFunc) {
await func();
}
print('Build finished in ${stopwatch.elapsed}');
return;
default:
print('Unsupported command: $command');