Skip to content

Commit

Permalink
fix merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Willich committed Aug 20, 2018
1 parent bbbdae4 commit a621a62
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
11 changes: 9 additions & 2 deletions IdeIntegration/Generator/OutOfProcess/OutOfProcessExecutor.cs
Expand Up @@ -17,12 +17,19 @@ class OutOfProcessExecutor
private const string ExeName = "TechTalk.SpecFlow.VisualStudio.CodeBehindGenerator.exe";


public OutOfProcessExecutor(Info info)
public OutOfProcessExecutor(Info info, IntegrationOptions integrationOptions)
{
_info = info;
_integrationOptions = integrationOptions;
string currentDirectory = Path.GetDirectoryName(GetType().Assembly.Location);
_fullPathToExe = Path.Combine(currentDirectory, ExeName);
if (String.IsNullOrWhiteSpace(integrationOptions.CodeBehindFileGeneratorPath))
{
_fullPathToExe = Path.Combine(currentDirectory, ExeName);
}
else
{
_fullPathToExe = integrationOptions.CodeBehindFileGeneratorPath;
}
}

public Result Execute(CommonParameters commonParameters, bool transferViaFile)
Expand Down
Expand Up @@ -15,10 +15,10 @@ public class OutOfProcessTestGenerator : ITestGenerator
private readonly OutOfProcessExecutor _outOfProcessExecutor;
private readonly ProjectSettings _projectSettings;

public OutOfProcessTestGenerator(Info info, ProjectSettings projectSettings)
public OutOfProcessTestGenerator(Info info, ProjectSettings projectSettings, IntegrationOptions integrationOptions)
{
_projectSettings = projectSettings;
_outOfProcessExecutor = new OutOfProcessExecutor(info);
_outOfProcessExecutor = new OutOfProcessExecutor(info, integrationOptions);
}

public void Dispose()
Expand Down
Expand Up @@ -12,10 +12,12 @@ public class OutOfProcessTestGeneratorFactory : IOutOfProcessTestGeneratorFactor
{
private readonly Info _info = new Info();
private readonly OutOfProcessExecutor _outOfProcessExecutor;
private readonly IntegrationOptions _integrationOptions;

public OutOfProcessTestGeneratorFactory()
public OutOfProcessTestGeneratorFactory(IntegrationOptions integrationOptions)
{
_outOfProcessExecutor = new OutOfProcessExecutor(_info);
_integrationOptions = integrationOptions;
_outOfProcessExecutor = new OutOfProcessExecutor(_info, integrationOptions);
}

public Version GetGeneratorVersion()
Expand All @@ -30,7 +32,7 @@ public Version GetGeneratorVersion()

public ITestGenerator CreateGenerator(ProjectSettings projectSettings)
{
return new OutOfProcessTestGenerator(_info, projectSettings);
return new OutOfProcessTestGenerator(_info, projectSettings, _integrationOptions);
}

public bool IsRunning { get; private set; }
Expand Down
5 changes: 3 additions & 2 deletions VsIntegration/Generator/VsGeneratorServices.cs
Expand Up @@ -7,6 +7,7 @@
using TechTalk.SpecFlow.IdeIntegration.Configuration;
using TechTalk.SpecFlow.IdeIntegration.Generator;
using TechTalk.SpecFlow.IdeIntegration.Generator.OutOfProcess;
using TechTalk.SpecFlow.IdeIntegration.Options;
using TechTalk.SpecFlow.IdeIntegration.Tracing;
using TechTalk.SpecFlow.VsIntegration.LanguageService;
using TechTalk.SpecFlow.VsIntegration.Utils;
Expand All @@ -19,10 +20,10 @@ internal class VsGeneratorServices : RemoteGeneratorServices
protected readonly Project project;


public VsGeneratorServices(Project project, IConfigurationReader configurationReader, IIdeTracer tracer) :
public VsGeneratorServices(Project project, IConfigurationReader configurationReader, IIdeTracer tracer, IIntegrationOptionsProvider integrationOptionsProvider) :
base( //TODO: load dependencies through DI
new TestGeneratorFactory(),
new OutOfProcessTestGeneratorFactory(),
new OutOfProcessTestGeneratorFactory(integrationOptionsProvider.GetOptions()),
new VsGeneratorInfoProvider(project, tracer, configurationReader),
tracer, false)
{
Expand Down
2 changes: 1 addition & 1 deletion VsIntegration/LanguageService/VsProjectScope.cs
Expand Up @@ -131,7 +131,7 @@ internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFil

GherkinProcessingScheduler = new GherkinProcessingScheduler(tracer, integrationOptions.EnableAnalysis);

GeneratorServices = new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer);
GeneratorServices = new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer, integrationOptionsProvider);
}

private void EnsureInitialized()
Expand Down
Expand Up @@ -15,7 +15,7 @@ namespace TechTalk.SpecFlow.VsIntegration
{
[ComVisible(true)]
[Guid("44F8C2E2-18A9-4B97-B830-6BCD0CAA161C")]
// Must register new project type which contains the new multi target model, https://github.com/aspnet/Tooling/issues/394#issuecomment-319244129
// Must register new project type which contains the new multi target model, https://github.com/aspnet/Tooling/issues/394#issuecomment-319244129
[CodeGeneratorRegistrationWithFileExtension(typeof(SpecFlowSingleFileGenerator), "C# SpecFlow Generator", "{9A19103F-16F7-4668-BE54-9A1E7A4F7556}", GeneratesDesignTimeSource = true, FileExtension = ".feature")]
[CodeGeneratorRegistrationWithFileExtension(typeof(SpecFlowSingleFileGenerator), "C# SpecFlow Generator", vsContextGuids.vsContextGuidVCSProject, GeneratesDesignTimeSource = true, FileExtension = ".feature")]
[CodeGeneratorRegistrationWithFileExtension(typeof(SpecFlowSingleFileGenerator), "VB.NET SpecFlow Generator", vsContextGuids.vsContextGuidVBProject, GeneratesDesignTimeSource = true, FileExtension = ".feature")]
Expand All @@ -30,7 +30,7 @@ protected override Func<GeneratorServices> GeneratorServicesProvider(Project pro
{
IVisualStudioTracer tracer = VsxHelper.ResolveMefDependency<IVisualStudioTracer>(ServiceProvider.GlobalProvider);
IntegrationOptionsProvider = VsxHelper.ResolveMefDependency<IIntegrationOptionsProvider>(ServiceProvider.GlobalProvider);
return () => new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer);
return () => new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer, IntegrationOptionsProvider);
}
}
}

0 comments on commit a621a62

Please sign in to comment.