@@ -6,6 +6,7 @@ import 'dart:collection';
66
77import 'package:path/path.dart' ;
88
9+ import '../../basic_config.dart' ;
910import '../../ci_shared.dart' ;
1011import '../../github_config.dart' ;
1112import '../../mono_config.dart' ;
@@ -22,10 +23,7 @@ import 'step.dart';
2223
2324const _onCompletionStage = '_on_completion' ;
2425
25- Map <String , String > generateGitHubYml (
26- RootConfig rootConfig,
27- Map <String , String > commandsToKeys,
28- ) {
26+ Map <String , String > generateGitHubYml (RootConfig rootConfig) {
2927 final jobs = < HasStageName > [
3028 ...rootConfig.expand ((config) => config.jobs),
3129 ];
@@ -82,7 +80,6 @@ Map<String, String> generateGitHubYml(
8280 final allJobs = _listJobs (
8381 rootConfig,
8482 sortedJobs,
85- commandsToKeys,
8683 rootConfig.monoConfig.mergeStages,
8784 rootConfig.monoConfig.github.onCompletion,
8885 rootConfig.monoConfig.githubConditionalStages,
@@ -178,7 +175,6 @@ ${toYaml({'jobs': jobList})}
178175Iterable <_MapEntryWithStage > _listJobs (
179176 RootConfig rootConfig,
180177 List <HasStageName > jobs,
181- Map <String , String > commandsToKeys,
182178 Set <String > mergeStages,
183179 List <Job >? onCompletionJobs,
184180 Map <String , ConditionalStage > conditionalStages,
@@ -203,12 +199,14 @@ Iterable<_MapEntryWithStage> _listJobs(
203199
204200 for (var job in jobs) {
205201 if (job is _SelfValidateJob ) {
206- yield jobEntry (_selfValidateJob (), job.stageName);
202+ yield jobEntry (_selfValidateJob (rootConfig.monoConfig ), job.stageName);
207203 continue ;
208204 }
209205
210206 final ciJob = job as CIJob ;
211207
208+ final commandsToKeys = extractCommands (rootConfig);
209+
212210 final commands =
213211 ciJob.tasks.map ((task) => commandsToKeys[task.command]! ).toList ();
214212
@@ -357,6 +355,7 @@ extension on CIJobEntry {
357355 job.flavor,
358356 job.sdk,
359357 commandEntries,
358+ config: rootConfig.monoConfig,
360359 additionalCacheKeys: {
361360 'packages' : packages.join ('-' ),
362361 'commands' : commands.join ('-' ),
@@ -399,6 +398,7 @@ Job _githubJob(
399398 PackageFlavor packageFlavor,
400399 String sdkVersion,
401400 List <_CommandEntryBase > runCommands, {
401+ required BasicConfiguration config,
402402 Map <String , String >? additionalCacheKeys,
403403}) =>
404404 Job (
@@ -416,10 +416,9 @@ Job _githubJob(
416416 packageFlavor.setupStep (sdkVersion),
417417 ..._beforeSteps (runCommands.whereType <_CommandEntry >()),
418418 ActionInfo .checkout.usage (
419- name: 'Checkout repository' ,
420419 id: 'checkout' ,
421420 ),
422- for (var command in runCommands) ...command.runContent,
421+ for (var command in runCommands) ...command.runContent (config) ,
423422 ],
424423 );
425424
@@ -440,7 +439,8 @@ class _CommandEntryBase {
440439
441440 _CommandEntryBase (this .name, this .run);
442441
443- Iterable <Step > get runContent => [Step .run (name: name, run: run)];
442+ Iterable <Step > runContent (BasicConfiguration config) =>
443+ [Step .run (name: name, run: run)];
444444}
445445
446446class _CommandEntry extends _CommandEntryBase implements GitHubActionOverrides {
@@ -489,9 +489,9 @@ class _CommandEntry extends _CommandEntryBase implements GitHubActionOverrides {
489489 });
490490
491491 @override
492- Iterable <Step > get runContent => [
492+ Iterable <Step > runContent ( BasicConfiguration config) => [
493493 Step .fromOverrides (this ),
494- ...? type? .afterEachSteps (workingDirectory),
494+ ...? type? .afterEachSteps (workingDirectory, config ),
495495 ];
496496}
497497
@@ -524,7 +524,6 @@ Step _cacheEntries(
524524 const pubCacheHosted = '~/.pub-cache/hosted' ;
525525
526526 return ActionInfo .cache.usage (
527- name: 'Cache Pub hosted dependencies' ,
528527 withContent: {
529528 'path' : pubCacheHosted,
530529 'key' : restoreKeys.first,
@@ -540,7 +539,7 @@ String _maxLength(String input) {
540539 return input.substring (0 , 512 - hash.length) + hash;
541540}
542541
543- Job _selfValidateJob () => _githubJob (
542+ Job _selfValidateJob (BasicConfiguration config ) => _githubJob (
544543 selfValidateJobName,
545544 _ubuntuLatest,
546545 PackageFlavor .dart,
@@ -549,6 +548,7 @@ Job _selfValidateJob() => _githubJob(
549548 for (var command in selfValidateCommands)
550549 _CommandEntryBase (selfValidateJobName, command),
551550 ],
551+ config: config,
552552 );
553553
554554const _ubuntuLatest = 'ubuntu-latest' ;
@@ -580,13 +580,11 @@ extension on PackageFlavor {
580580 switch (this ) {
581581 case PackageFlavor .dart:
582582 return ActionInfo .setupDart.usage (
583- name: 'Setup Dart SDK' ,
584583 withContent: {'sdk' : sdkVersion},
585584 );
586585
587586 case PackageFlavor .flutter:
588587 return ActionInfo .setupFlutter.usage (
589- name: 'Setup Flutter SDK' ,
590588 withContent: {'channel' : sdkVersion},
591589 );
592590 }
0 commit comments