@@ -200,10 +200,17 @@ public static GenOutcome RunGen(
200200 /// to the current directory for a caller that names no project (mirrors
201201 /// <c>GenConfig.ProjectRoot</c>'s own default).
202202 /// </param>
203+ /// <param name="selection">
204+ /// The <c>--generators</c> names the run was asked for, when it was asked by name. A docs
205+ /// generator is never run here; one this selection names is reported as skipped
206+ /// (<see cref="DocsGeneratorSkipped"/>), and one that is only in <paramref name="generators"/>
207+ /// — an owned list, where the docs run looks for it — is left out without a word.
208+ /// </param>
203209 public static GenOutcome RunGen (
204210 LoadResult load , string outDir , string ns , bool emitAbstractShapes ,
205211 IReadOnlyList < IGenerator > generators , string ? projectRoot = null ,
206- ColumnNamingStrategy columnNaming = ColumnNamingStrategy . Literal , string baseline = "default" )
212+ ColumnNamingStrategy columnNaming = ColumnNamingStrategy . Literal , string baseline = "default" ,
213+ IReadOnlyList < string > ? selection = null )
207214 {
208215 var loadErrors = load . Errors . Select ( e => e . Code . ToString ( ) ) . ToList ( ) ;
209216 if ( loadErrors . Count > 0 ) return new GenOutcome ( loadErrors , null ) ;
@@ -228,9 +235,10 @@ public static GenOutcome RunGen(
228235 IncludeNames = generators . Any ( g => g . Name == "names" ) ,
229236 } ;
230237
231- // A docs generator writes the api reference, not code: CodegenRunner leaves it out, and
232- // this run says so rather than writing pages into the generated-code tree.
233- var docsSkipped = generators . OfType < IDocsGenerator > ( ) . Select ( g => g . Name ) . ToList ( ) ;
238+ // A docs generator writes the api reference, not code: CodegenRunner leaves it out. A run
239+ // asked for one by name says so; an owned list carries one for the docs run, not for this.
240+ var docsSkipped = generators . OfType < IDocsGenerator > ( ) . Select ( g => g . Name )
241+ . Where ( name => selection ? . Contains ( name ) == true ) . ToList ( ) ;
234242
235243 CodegenRunner . RunResult result ;
236244 try
@@ -253,7 +261,7 @@ public static GenOutcome RunGen(
253261 return new GenOutcome ( loadErrors , result ) ;
254262 }
255263
256- /// <summary>What a code run says about a docs generator it was handed and did not run.</summary>
264+ /// <summary>What a code run says about a docs generator its selection named and it did not run.</summary>
257265 public static string DocsGeneratorSkipped ( string name ) =>
258266 $ "\" { name } \" writes the api reference, so `gen` skipped it. Run it with `dotnet meta docs`.";
259267
@@ -488,7 +496,7 @@ private static int RunGenArgs(string[] rest, IReadOnlyList<IGenerator> owned)
488496 }
489497
490498 WarnUnknownAttrs ( meta ) ;
491- var outcome = RunGen ( meta . Load ( ) , a . OutDir , a . Namespace , a . EmitAbstractShapes , suite , projectRoot , columnNaming , a . Baseline ) ;
499+ var outcome = RunGen ( meta . Load ( ) , a . OutDir , a . Namespace , a . EmitAbstractShapes , suite , projectRoot , columnNaming , a . Baseline , a . Selection ) ;
492500 if ( ! outcome . Ok )
493501 {
494502 ReportFailure ( outcome , "codegen (owned) gen" ) ;
0 commit comments