mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Migrate desktop_photo_search to top level (#1002)
This commit is contained in:
72
desktop_photo_search/fluent_ui/tool/grind.dart
Normal file
72
desktop_photo_search/fluent_ui/tool/grind.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user