1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00
Files
samples/web/_tool/verify_packages.dart
John Ryan 3f5ab56485 Add workflow to deploy the sample index (#791)
* Add workflow to build and deploy the sample index

* update gh-pages action

* fix yaml

* create web/ directory in build

* grammar

* add ignored directories

* revert pubspec.lock files

* add job to run _tool/verify_samples.dart

* Update filipino_cuisine for Flutter 2

* remove timeflow demo.

The unnamed List constructor is now deprecated, refactoring
this code to use add() requires more knowledge about the code for
this demo.
https://dart.dev/null-safety/understanding-null-safety#no-unnamed-list-constructor

* update slide_puzzle

* ensure stable channel is used to verify

* move verify web demos action into separate yaml file - avoid running
on each flutter version.

* add on: pull_request

* update slide_puzzle

* Update gh-pages.yml

* Add copyright header
2021-05-06 10:26:15 -07:00

49 lines
1.3 KiB
Dart

// Copyright 2020 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:io';
import 'package:path/path.dart' as p;
import 'common.dart';
void main() async {
final packageDirs = listPackageDirs(Directory.current)
.map((path) => p.relative(path, from: Directory.current.path))
.toList();
print('Package dirs:\n${packageDirs.map((path) => ' $path').join('\n')}');
final results = <bool>[];
for (var i = 0; i < packageDirs.length; i++) {
final dir = packageDirs[i];
logWrapped(ansiMagenta, '\n$dir (${i + 1} of ${packageDirs.length})');
results.add(await run(dir, 'flutter', [
'pub',
'pub',
'upgrade',
'--no-precompile',
]));
results.add(await run(
dir,
'dartanalyzer',
['--fatal-infos', '--fatal-warnings', '.'],
));
_printStatus(results);
}
if (results.any((v) => !v)) {
exitCode = 1;
}
}
void _printStatus(List<bool> results) {
var successCount = results.where((t) => t).length;
var success = (successCount == results.length);
var pct = 100 * successCount / results.length;
logWrapped(success ? ansiGreen : ansiRed,
'$successCount of ${results.length} (${pct.toStringAsFixed(2)}%)');
}