Skip to content

Commit d561d1a

Browse files
committed
refactor: replace shell-based CI and utility scripts with a Dart-based cleaning tool and update workspace configuration
1 parent 9925e35 commit d561d1a

8 files changed

Lines changed: 85 additions & 316 deletions

pubspec.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ workspace:
2525
- compass_app/server
2626
- context_menus
2727
- date_planner
28+
- deeplink_store_example
2829
- desktop_photo_search/fluent_ui
2930
- desktop_photo_search/material
3031
- dynamic_theme
@@ -63,9 +64,13 @@ skip_ci:
6364

6465
skip_ci_beta:
6566
# TODO: lots of shader arg failures in the tests on beta branch
66-
- animations
67-
- compass_app/app
68-
- compass_app/server
69-
- deeplink_store_example
67+
# - animations
68+
# - compass_app/app
69+
# - compass_app/server
70+
# - deeplink_store_example
71+
# - desktop_photo_search/fluent_ui
72+
# - desktop_photo_search/material
73+
# - form_app
74+
- material_3_demo
7075
# TODO(ewindmill): info - lib/basic_text_input_client.dart:262:11 - 'setStyle' is deprecated and shouldn't be used. Use updateStyle instead. This feature was deprecated after v3.41.0-0.0.pre. Try replacing the use of the deprecated member with the replacement. - deprecated_member_use on beta branch
7176
- simplistic_editor

tool/clean_all.dart

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import 'dart:io';
2+
import 'package:path/path.dart' as path;
3+
import 'package:yaml/yaml.dart';
4+
5+
/// Runs `flutter clean` in every package listed in the root pubspec.yaml
6+
/// workspace. Useful for clearing stale build artifacts after switching Flutter
7+
/// channels.
8+
Future<void> main() async {
9+
final rootDir = Directory.current;
10+
final pubspecFile = File(path.join(rootDir.path, 'pubspec.yaml'));
11+
final pubspecContent = await pubspecFile.readAsString();
12+
final pubspecYaml = loadYaml(pubspecContent);
13+
14+
final workspace = pubspecYaml['workspace'] as YamlList?;
15+
if (workspace == null) {
16+
print('No workspace found in pubspec.yaml');
17+
exit(1);
18+
}
19+
20+
final flutterBin = _resolveFlutterBin();
21+
print('Using flutter: $flutterBin');
22+
23+
var cleaned = 0;
24+
var skipped = 0;
25+
26+
for (final entry in workspace) {
27+
final package = entry.toString();
28+
final packagePath = path.join(rootDir.path, package);
29+
30+
// Only clean packages that have a pubspec.yaml (i.e. are Flutter/Dart pkgs)
31+
final pubspec = File(path.join(packagePath, 'pubspec.yaml'));
32+
if (!await pubspec.exists()) {
33+
print('-- Skipping \'$package\' (no pubspec.yaml found)');
34+
skipped++;
35+
continue;
36+
}
37+
38+
print('== Cleaning \'$package\' ==');
39+
final process = await Process.start(
40+
flutterBin,
41+
['clean'],
42+
workingDirectory: packagePath,
43+
runInShell: true,
44+
mode: ProcessStartMode.inheritStdio,
45+
);
46+
final exitCode = await process.exitCode;
47+
if (exitCode != 0) {
48+
print(
49+
'Warning: flutter clean failed with exit code $exitCode in $packagePath',
50+
);
51+
} else {
52+
cleaned++;
53+
}
54+
}
55+
56+
print('');
57+
print('Done. Cleaned $cleaned package(s), skipped $skipped.');
58+
}
59+
60+
/// Resolves the path to the `flutter` binary by finding it relative to the
61+
/// running Dart SDK. Falls back to 'flutter' (uses PATH) if not found.
62+
String _resolveFlutterBin() {
63+
// Platform.resolvedExecutable points to the dart binary, e.g.:
64+
// /path/to/flutter/bin/cache/dart-sdk/bin/dart
65+
// Flutter binary is at /path/to/flutter/bin/flutter
66+
final dartBin = File(Platform.resolvedExecutable);
67+
final flutterBin = path.join(
68+
dartBin.parent.parent.parent.parent.path,
69+
'bin',
70+
'flutter',
71+
);
72+
if (File(flutterBin).existsSync()) {
73+
return flutterBin;
74+
}
75+
return 'flutter'; // fallback to PATH
76+
}

tool/flutter_ci_script_beta.sh

Lines changed: 0 additions & 62 deletions
This file was deleted.

tool/flutter_ci_script_master.sh

Lines changed: 0 additions & 65 deletions
This file was deleted.

tool/flutter_ci_script_shared.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

tool/flutter_ci_script_stable.sh

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)