You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/experimental/desktop_photo_search/tool/grind.dart

73 lines
1.6 KiB

// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:async/async.dart' show StreamGroup;
import 'package:grinder/grinder.dart';
void main(List<String> args) => grind(args);
@DefaultTask()
@Depends(pubGet, generateJsonBindings, analyzeSource, test)
void build() {}
@Task()
Future<void> pubGet() async => _logProcessOutput(
Process.start(
'flutter',
['pub', 'get'],
),
);
@Task()
Future<void> generateJsonBindings() async => _logProcessOutput(
Process.start(
'flutter',
['pub', 'run', 'build_runner', 'build', '--delete-conflicting-outputs'],
),
);
@Task()
Future<void> watch() async => _logProcessOutput(
Process.start(
'flutter',
['pub', 'run', 'build_runner', 'watch'],
),
);
@Task()
Future<void> analyzeSource() async => _logProcessOutput(
Process.start(
'flutter',
['analyze'],
),
);
@Task()
Future<void> test() async => _logProcessOutput(
Process.start(
'flutter',
['test'],
),
);
@Task()
Future<void> clean() => _logProcessOutput(
Process.start(
'flutter',
['clean'],
),
);
Future<void> _logProcessOutput(Future<Process> proc) async {
final process = await proc;
final output = StreamGroup.merge([process.stdout, process.stderr]);
await for (final message in output) {
log(utf8.decode(message));
}
}