* remove the dependency of unprocessed swagger file * all code generator * good bye generated code * remove generator cmd from sln * eliminate generated folder * fix multi target build * disable dotnet fmt due to cannot load lib generator * fix race * fix race for multi target
21 lines
782 B
C#
21 lines
782 B
C#
using Microsoft.CodeAnalysis;
|
|
using Microsoft.CodeAnalysis.Text;
|
|
using Nustache.Core;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace LibKubernetesGenerator
|
|
{
|
|
internal static class GeneratorExecutionContextExt
|
|
{
|
|
public static void RenderToContext(this GeneratorExecutionContext context, string templatefile, object data, string generatedfile)
|
|
{
|
|
context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.projectdir", out var root);
|
|
var generated = Render.FileToString(Path.Combine(root, "..", "..", "gen", "LibKubernetesGenerator", "templates", templatefile), data);
|
|
context.AddSource(generatedfile, SourceText.From(generated, Encoding.UTF8));
|
|
}
|
|
}
|
|
}
|