Skip to content

Commit 28108b9

Browse files
authored
Require Dart 3.8, bump deps, regenerate code, update actions (#514)
1 parent b825610 commit 28108b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1161
-1374
lines changed

.github/workflows/dart.yml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mono_repo/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 6.6.4
2+
3+
- Update to latest action versions.
4+
- Require `sdk: ^3.7.0`.
5+
16
## 6.6.3
27

38
- Update to latest action versions.

mono_repo/lib/src/ci_shared.dart

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ class CIJobEntry {
6969
Map<String, List<CIJobEntry>> groupCIJobEntries(List<CIJobEntry> jobEntries) =>
7070
groupBy<CIJobEntry, String>(
7171
jobEntries,
72-
(e) => [
73-
...e.job.groupByKeys,
74-
e.commands,
75-
].join(':::'),
72+
(e) => [...e.job.groupByKeys, e.commands].join(':::'),
7673
);
7774

7875
void validateRootConfig(RootConfig rootConfig) {
@@ -83,17 +80,19 @@ void validateRootConfig(RootConfig rootConfig) {
8380
continue;
8481
}
8582

86-
final disallowedExplicitVersions = config.jobs
87-
.map((tj) => tj.explicitSdkVersion)
88-
.whereType<Version>()
89-
.toSet()
90-
.where((v) => !sdkConstraint.allows(v))
91-
.toList()
92-
..sort();
83+
final disallowedExplicitVersions =
84+
config.jobs
85+
.map((tj) => tj.explicitSdkVersion)
86+
.whereType<Version>()
87+
.toSet()
88+
.where((v) => !sdkConstraint.allows(v))
89+
.toList()
90+
..sort();
9391

9492
if (disallowedExplicitVersions.isNotEmpty) {
95-
final disallowedString =
96-
disallowedExplicitVersions.map((v) => '`$v`').join(', ');
93+
final disallowedString = disallowedExplicitVersions
94+
.map((v) => '`$v`')
95+
.join(', ');
9796
print(
9897
yellow.wrap(
9998
' There are jobs defined that are not compatible with '
@@ -129,15 +128,15 @@ void writeFile(
129128

130129
@visibleForTesting
131130
List<String> scriptLines(String scriptPath) => [
132-
'Make sure to mark `$scriptPath` as executable.',
133-
' chmod +x $scriptPath',
134-
if (Platform.isWindows) ...[
135-
'It appears you are using Windows, and may not have access to chmod.',
136-
'If you are using git, the following will emulate the Unix permissions '
137-
'change:',
138-
' git update-index --add --chmod=+x $scriptPath',
139-
],
140-
];
131+
'Make sure to mark `$scriptPath` as executable.',
132+
' chmod +x $scriptPath',
133+
if (Platform.isWindows) ...[
134+
'It appears you are using Windows, and may not have access to chmod.',
135+
'If you are using git, the following will emulate the Unix permissions '
136+
'change:',
137+
' git update-index --add --chmod=+x $scriptPath',
138+
],
139+
];
141140

142141
/// Gives a map of command to unique task key for all [configs].
143142
Map<String, String> extractCommands(Iterable<PackageConfig> configs) {
@@ -241,7 +240,8 @@ List<String> calculateOrderedStages(
241240

242241
throw UserException(
243242
'Error parsing mono_repo.yaml',
244-
details: 'One or more stage was referenced in `mono_repo.yaml` that do '
243+
details:
244+
'One or more stage was referenced in `mono_repo.yaml` that do '
245245
'not exist in any `$monoPkgFileName` files: $items.',
246246
);
247247
}
@@ -252,9 +252,7 @@ List<String> calculateOrderedStages(
252252
// as a secondary sort. This is an intuitive secondary sort order as it
253253
// follows the order given in configuration files.
254254
final keys = edges.keys.toList();
255-
final edgeIndexes = {
256-
for (var i = 0; i < keys.length; i++) keys[i]: i,
257-
};
255+
final edgeIndexes = {for (var i = 0; i < keys.length; i++) keys[i]: i};
258256

259257
// Orders by dependencies first, and detect cycles (which aren't allowed).
260258
// Our edges here are actually reverse edges already, so a topological sort

mono_repo/lib/src/ci_test_script.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ function $commandName() {
3030
}''';
3131
}
3232

33-
final bashScriptHeader = '''
33+
final bashScriptHeader =
34+
'''
3435
#!/bin/bash
3536
$createdWith
3637

mono_repo/lib/src/commands/check.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ Map<String, PackageReport> getPackageReports(RootConfig rootConfig) {
3636
final siblings = rootConfig.map((pc) => pc.pubspec).toSet();
3737
return Map.fromEntries(
3838
rootConfig.map(
39-
(p) => MapEntry(
40-
p.relativePath,
41-
PackageReport.create(p.pubspec, siblings),
42-
),
39+
(p) =>
40+
MapEntry(p.relativePath, PackageReport.create(p.pubspec, siblings)),
4341
),
4442
);
4543
}

mono_repo/lib/src/commands/ci_script/generate.dart

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,12 @@ import '../../user_exception.dart';
1313

1414
const ciScriptPath = 'tool/ci.sh';
1515

16-
void generateCIScript(
17-
RootConfig rootConfig, {
18-
bool validateOnly = false,
19-
}) {
16+
void generateCIScript(RootConfig rootConfig, {bool validateOnly = false}) {
2017
final ciScript = _GeneratedCIScript.generate(rootConfig).ciScript;
2118
if (validateOnly) {
22-
_validateFile(
23-
rootConfig.rootDirectory,
24-
ciScript,
25-
ciScriptPath,
26-
);
19+
_validateFile(rootConfig.rootDirectory, ciScript, ciScriptPath);
2720
} else {
28-
writeFile(
29-
rootConfig.rootDirectory,
30-
ciScriptPath,
31-
ciScript,
32-
isScript: true,
33-
);
21+
writeFile(rootConfig.rootDirectory, ciScriptPath, ciScript, isScript: true);
3422
}
3523
}
3624

@@ -57,10 +45,10 @@ class _GeneratedCIScript {
5745
/// the `--validate` option.
5846
class CIScriptOutOfDateException extends UserException {
5947
CIScriptOutOfDateException()
60-
: super(
61-
'Generated ci script is out of date',
62-
details: 'Rerun `mono_repo generate` to update the generated script',
63-
);
48+
: super(
49+
'Generated ci script is out of date',
50+
details: 'Rerun `mono_repo generate` to update the generated script',
51+
);
6452
}
6553

6654
/// Checks [expectedPath] versus the content in [expectedContent].

mono_repo/lib/src/commands/dart.dart

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ class DartCommand extends MonoRepoCommand {
2626
'packages.';
2727

2828
@override
29-
Future<void> run() => dart(
30-
rootConfig(),
31-
arguments,
32-
executableForPackage,
33-
);
29+
Future<void> run() => dart(rootConfig(), arguments, executableForPackage);
3430

3531
/// The arguments to pass to the executable.
3632
List<String> get arguments => argResults?.rest ?? const [];
@@ -61,10 +57,7 @@ Future<void> dart(
6157

6258
print('');
6359
print(
64-
wrapWith(
65-
'`$dir`: Starting `${args.join(' ')}`',
66-
[styleBold, lightBlue],
67-
),
60+
wrapWith('`$dir`: Starting `${args.join(' ')}`', [styleBold, lightBlue]),
6861
);
6962
final workingDir = p.join(rootConfig.rootDirectory, dir);
7063

@@ -116,14 +109,11 @@ final String _dartPath = p.join(_sdkDir, 'bin', 'dart');
116109
/// The "flutter[.bat]" command.
117110
final String _flutterPath = Platform.isWindows ? 'flutter.bat' : 'flutter';
118111

119-
enum Executable {
120-
dart,
121-
flutter,
122-
}
112+
enum Executable { dart, flutter }
123113

124114
extension ExecutablePath on Executable {
125115
String get path => switch (this) {
126-
Executable.dart => _dartPath,
127-
Executable.flutter => _flutterPath,
128-
};
116+
Executable.dart => _dartPath,
117+
Executable.flutter => _flutterPath,
118+
};
129119
}

mono_repo/lib/src/commands/generate.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class GenerateCommand extends MonoRepoCommand {
2020
argParser.addFlag(
2121
'validate',
2222
negatable: false,
23-
help: 'Validates that the existing CI config is up to date with '
23+
help:
24+
'Validates that the existing CI config is up to date with '
2425
'the current configuration. Does not write any files.',
2526
);
2627
}

mono_repo/lib/src/commands/github/action_info.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ enum ActionInfo implements Comparable<ActionInfo> {
7777
}
7878

7979
Job _coverageCompletionJob(RootConfig rootConfig) => Job(
80+
name: 'Mark Coveralls job finished',
81+
runsOn: 'ubuntu-latest',
82+
steps: [
83+
ActionInfo.coveralls.usage(
8084
name: 'Mark Coveralls job finished',
81-
runsOn: 'ubuntu-latest',
82-
steps: [
83-
ActionInfo.coveralls.usage(
84-
name: 'Mark Coveralls job finished',
85-
withContent: {
86-
// https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
87-
'github-token': r'${{ secrets.GITHUB_TOKEN }}',
88-
'parallel-finished': true,
89-
},
90-
versionOverrides: rootConfig.existingActionVersions,
91-
),
92-
],
93-
);
85+
withContent: {
86+
// https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
87+
'github-token': r'${{ secrets.GITHUB_TOKEN }}',
88+
'parallel-finished': true,
89+
},
90+
versionOverrides: rootConfig.existingActionVersions,
91+
),
92+
],
93+
);
9494

9595
/// Allows finding [ActionInfo] for a corresponding [Step].
9696
final _actionInfoExpando = Expando<ActionInfo>();

mono_repo/lib/src/commands/github/action_versions.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//
77
// To regenerate it, run the `tool/generate_action_versions.dart` script.
88

9-
const actionsCacheVersion = 'd4323d4df104b026a6aa633fdb11d772146be0bf';
9+
const actionsCacheVersion = '0057852bfaa89a56745cba8c7296529d2fc39830';
1010
const dartLangSetupDartVersion = 'e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c';
11-
const actionsCheckoutVersion = '11bd71901bbe5b1630ceea73d27597364c9af683';
12-
const subositoFlutterActionVersion = 'f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff';
11+
const actionsCheckoutVersion = '08c6903cd8c0fde910a37f88322edcfb5dd907a8';
12+
const subositoFlutterActionVersion = 'fd55f4c5af5b953cc57a2be44cb082c8f6635e8e';
1313
const coverallsappGithubActionVersion =
1414
'648a8eb78e6d50909eff900e4ec85cab4524a45b';
15-
const codecovCodecovActionVersion = '0565863a31f2c772f9f0395002a31e3f06189574';
15+
const codecovCodecovActionVersion = '5a1091511ad55cbe89839c7260b706298ca349f7';

0 commit comments

Comments
 (0)