Skip to content

Commit 6a1db77

Browse files
committed
Update driver to only generate system modules for C# generators.
1 parent db08034 commit 6a1db77

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Generator/Generator.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ public virtual List<GeneratorOutput> Generate()
114114
}
115115
}
116116

117-
if (Context.Options.SystemModule != null)
117+
var generateSystemModule = Context.Options.SystemModule != null &&
118+
Context.Options.GeneratorKind == GeneratorKind.CSharp;
119+
if (generateSystemModule)
118120
{
119121
var output = GenerateModule(Context.Options.SystemModule);
120122
if (output != null)
@@ -150,14 +152,18 @@ public virtual GeneratorOutput GenerateUnit(TranslationUnit unit)
150152

151153
public virtual GeneratorOutput GenerateModule(Module module)
152154
{
155+
var generatedUnits = module.Units.GetGenerated().ToList();
156+
if (generatedUnits.Count == 0)
157+
return null;
158+
153159
var output = new GeneratorOutput
154160
{
155161
TranslationUnit = new TranslationUnit
156162
{
157163
FilePath = $"{module.LibraryName}",
158164
Module = module
159165
},
160-
Outputs = Generate(module.Units.GetGenerated())
166+
Outputs = Generate(generatedUnits)
161167
};
162168

163169
output.Outputs[0].Process();

tests/NamespacesDerived/NamespacesDerived.CSharp.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
<ItemGroup>
77
<Compile Include="$(GenDir)NamespacesDerived\NamespacesDerived.cs" />
8-
<Compile Include="$(GenDir)NamespacesDerived\Std.cs" />
98
</ItemGroup>
109

1110
<ItemGroup>

0 commit comments

Comments
 (0)