Exemple #1
0
        public virtual void GenerateCode(ConfigurationCodeGenerationMetadata metadata)
        {
            var tasks = _scripts
                        .Select(script =>
            {
                var codegenContext = new CSharpScriptCodeGeneratorContext(metadata, _logger);

                try
                {
                    return(script
                           .RunAsync(codegenContext, catchException: exception => throw exception)
                           .ContinueWith(task => codegenContext));
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException($"Error executing {script.Options.FilePath}", ex);
                }
            })
                        .ToArray();

            Task.WhenAll(tasks)
            .ContinueWith(task => EmitCode(task.Result))
            .Wait();
        }
Exemple #2
0
 public CSharpScriptCodeGeneratorContext(ConfigurationCodeGenerationMetadata metadata, ILogger logger)
 {
     Log       = logger;
     _metadata = metadata;
 }