@@ -595,21 +595,28 @@ class ToolEnvironment {
595595 );
596596
597597 // extract the package name from the `include: package:<package>/path.yaml` entry in analysis options:
598- String ? includedPackage ;
598+ final includedPackages = < String > {} ;
599599 final analysisOptionsFile = File (
600600 p.join (packageDir, 'analysis_options.yaml' ),
601601 );
602602 if (await analysisOptionsFile.exists ()) {
603+ void addPackageInclude (String includeValue) {
604+ final include = includeValue.trim ();
605+ if (include.startsWith ('package:' )) {
606+ includedPackages.add (
607+ include.substring ('package:' .length).split ('/' ).first,
608+ );
609+ }
610+ }
611+
603612 final analysisOptions = await analysisOptionsFile.readAsString ();
604613 final parsed = yamlToJson (analysisOptions);
605614 final includeValue = parsed? ['include' ];
606615 if (includeValue is String ) {
607- final include = includeValue.trim ();
608- if (include.startsWith ('package:' )) {
609- includedPackage = include
610- .substring ('package:' .length)
611- .split ('/' )
612- .first;
616+ addPackageInclude (includeValue);
617+ } else if (includeValue is List ) {
618+ for (final v in includeValue.whereType <String >()) {
619+ addPackageInclude (v);
613620 }
614621 }
615622 }
@@ -621,16 +628,15 @@ class ToolEnvironment {
621628 if (oldDevDependencies is Map <String , dynamic >) {
622629 final keptDevDependencies = < String , dynamic > {};
623630 for (final name in oldDevDependencies.keys) {
624- if (name != includedPackage) continue ;
631+ if (! includedPackages.contains (name)) {
632+ continue ;
633+ }
625634 final value = oldDevDependencies[name];
626- var passthrough = true ;
627635 if (value is Map &&
628636 (value.containsKey ('path' ) || value.containsKey ('git' ))) {
629- passthrough = false ;
630- }
631- if (passthrough) {
632- keptDevDependencies[name] = value;
637+ continue ;
633638 }
639+ keptDevDependencies[name] = value;
634640 }
635641 if (keptDevDependencies.isNotEmpty) {
636642 parsed['dev_dependencies' ] = keptDevDependencies;
0 commit comments