Skip to content

Commit fd6e1d3

Browse files
committed
repaired generated files
1 parent 0ca791c commit fd6e1d3

8 files changed

Lines changed: 1075 additions & 5 deletions

File tree

v2/Generator/DocusaurusExample.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ This is the CSharp Project that references **{{ Description.Generator.Name }}**
9595
</Tabs>
9696

9797
### Generated Files
98+
{{~ if HasFilesGenerated ~}}
9899

99100
Those are taken from $(BaseIntermediateOutputPath)\GX
100-
{{~ if Description.Data.outputFiles.HasFilesGenerated ~}}
101101
<Tabs>
102102

103103
{{~ for fileContent in Description.Data.outputFiles.generatedFiles ~}}

v2/Generator/MultiGeneratorV2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,10 @@ private async Task<bool> WroteDocusaurus(Description it, string pathDocusaurus)
924924
.Where(loop=>loop.Generator?.Name != it.Generator?.Name)
925925
.OrderBy(it=>it.Generator?.Name)
926926
.ToArray();
927-
927+
bool HasFilesGenerated = it?.Data?.outputFiles?.HasFilesGenerated() ?? false;
928928
var template = await File.ReadAllTextAsync("DocusaurusExample.txt");
929929
var templateScriban = Scriban.Template.Parse(template);
930-
var output = templateScriban.Render(new {Description=it, otherDesc, category}, member => member.Name);
930+
var output = templateScriban.Render(new {Description=it,HasFilesGenerated, otherDesc, category}, member => member.Name);
931931
output = output
932932
.Replace(" { ", " \\{ ")
933933
.Replace(" } ", " \\} ")

v2/Generator/OutputFiles.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public string NameCsproj
3939
}
4040
public string[]? excludeDirectoryGenerated { get; internal set; }
4141
public string[]? includeAdditionalFiles { get; internal set; }
42+
public bool HasFilesGenerated() => generatedFiles?.Length > 0;
43+
4244

4345
public async Task GatherData(string nuget)
4446
{

v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,57 @@ public class Customer : Person
237237
### Generated Files
238238

239239
Those are taken from $(BaseIntermediateOutputPath)\GX
240+
<Tabs>
241+
242+
243+
<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\FactoryGenerator.Abstractions\src\InjectDemo\obj\GX\FactoryGenerator.Microsoft.Extensions.DependencyInjection\FactoryGenerator.Microsoft.Extensions.DependencyInjection.FactoryGenerator\FactoryGenerator.Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.g.cs" label="FactoryGenerator.Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.g.cs" >
244+
```csharp showLineNumbers
245+
// <auto-generated/>
246+
using FactoryGenerator.Abstractions;
247+
using Microsoft.Extensions.DependencyInjection;
248+
249+
namespace AutoGeneratedNamespaceFromFactoryGenerator;
250+
251+
public static class ServiceCollectionExtensions
252+
{
253+
public static IServiceCollection RegisterGeneratedFactories(this IServiceCollection self)
254+
{
255+
self.AddTransient<FactoryGenerator.Abstractions.IFactory<global::InjectDemo.PersonType, InjectDemo.PersonFactory>, InjectDemo.PersonTypePersonFactoryFactory>();
256+
257+
return self;
258+
}
259+
}
260+
```
261+
</TabItem>
262+
263+
264+
<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\FactoryGenerator.Abstractions\src\InjectDemo\obj\GX\FactoryGenerator.Microsoft.Extensions.DependencyInjection\FactoryGenerator.Microsoft.Extensions.DependencyInjection.FactoryGenerator\InjectDemo.PersonTypePersonFactoryFactory.g.cs" label="InjectDemo.PersonTypePersonFactoryFactory.g.cs" >
265+
```csharp showLineNumbers
266+
// <auto-generated/>
267+
268+
using FactoryGenerator.Abstractions;
269+
270+
namespace InjectDemo;
271+
272+
public sealed class PersonTypePersonFactoryFactory : FactoryGenerator.Abstractions.IFactory<global::InjectDemo.PersonType, InjectDemo.PersonFactory>
273+
{
274+
275+
276+
public PersonTypePersonFactoryFactory()
277+
{
278+
279+
}
280+
281+
public InjectDemo.PersonFactory Create(global::InjectDemo.PersonType dependency0)
282+
{
283+
return new InjectDemo.PersonFactory(dependency0);
284+
}
285+
}
286+
```
287+
</TabItem>
288+
289+
290+
</Tabs>
240291
## Useful
241292

242293
### Download Example (.NET C#)

v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,65 @@ internal class LogData
319319
### Generated Files
320320

321321
Those are taken from $(BaseIntermediateOutputPath)\GX
322+
<Tabs>
323+
324+
325+
<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\JinShil.MixinSourceGenerator\src\DemoMixin\obj\GX\JinShil.MixinSourceGenerator\JinShil.MixinSourceGenerator.SourceGenerator\MixinAttribute.g.cs" label="MixinAttribute.g.cs" >
326+
```csharp showLineNumbers
327+
328+
namespace JinShil.MixinSourceGenerator
329+
{
330+
/// <summary>
331+
/// Specifies the type whose members are to be mixed in to a partial class or struct.
332+
/// </summary>
333+
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple = true)]
334+
public class MixinAttribute : System.Attribute
335+
{
336+
public System.Type Type \{ get; }
337+
public MixinAttribute(System.Type type)
338+
{
339+
Type = type;
340+
}
341+
}
342+
}
343+
```
344+
</TabItem>
345+
346+
347+
<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\JinShil.MixinSourceGenerator\src\DemoMixin\obj\GX\JinShil.MixinSourceGenerator\JinShil.MixinSourceGenerator.SourceGenerator\MixinIgnoreAttribute.g.cs" label="MixinIgnoreAttribute.g.cs" >
348+
```csharp showLineNumbers
349+
350+
namespace JinShil.MixinSourceGenerator
351+
{
352+
/// <summary>
353+
/// Used to identify a member that should be ignored when mixing in members from other types.
354+
/// </summary>
355+
[System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event, AllowMultiple = false)]
356+
public class MixinIgnoreAttribute : System.Attribute
357+
{
358+
public MixinIgnoreAttribute()
359+
\{ }
360+
}
361+
}
362+
```
363+
</TabItem>
364+
365+
366+
<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\JinShil.MixinSourceGenerator\src\DemoMixin\obj\GX\JinShil.MixinSourceGenerator\JinShil.MixinSourceGenerator.SourceGenerator\Person.g.cs" label="Person.g.cs" >
367+
```csharp showLineNumbers
368+
#nullable enable
369+
namespace DemoMixin
370+
{
371+
partial class Person
372+
{
373+
public void Log(string data) => Console.WriteLine(data);
374+
}
375+
}
376+
```
377+
</TabItem>
378+
379+
380+
</Tabs>
322381
## Useful
323382

324383
### Download Example (.NET C#)

0 commit comments

Comments
 (0)