Example #1
0
        /// <summary>
        /// Runs the asynchronous.
        /// </summary>
        /// <param name="setupsFactory">The setups factory.</param>
        /// <param name="generatorOptions">The generator options.</param>
        /// <returns>
        /// A list of output names.
        /// </returns>
        public static async Task <ConcurrentBag <string> > RunAsync(ISetupsFactory setupsFactory, GeneratorOptions?generatorOptions = null)
        {
            generatorOptions ??= GeneratorOptions.Default;
            using var progressReporter = new ProgressReporterFactory().Create(generatorOptions.ProgressReporter, generatorOptions.ProgressTextWriter);
            try
            {
                progressReporter.Start();
                var generatorRunnerFactory = new GeneratorRunnerFactory();
                var generatorRunner        = generatorRunnerFactory.Create((await setupsFactory.GetSetupsAsync().ConfigureAwait(false))
                                                                           .Select(x => new SetupInfo(setupsFactory.GetType().ToString(), x)));

                return(await generatorRunner.GenerateAsync(generatorOptions, new ProgressTracker <Report>(progressReporter)).ConfigureAwait(false));
            }
            catch (Exception)
            {
                progressReporter.Stop();
                throw;
            }
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CompositeSetupsFactory"/> class.
 /// </summary>
 /// <param name="setupsFactory">The setups factory.</param>
 /// <param name="additionalSetupsFactory">The additional setups factory.</param>
 public CompositeSetupsFactory(ISetupsFactory setupsFactory, ISetupsFactory additionalSetupsFactory)
 {
     this.setupsFactory           = setupsFactory;
     this.additionalSetupsFactory = additionalSetupsFactory;
 }